ch.cyberduck.core.Local.getBookmark()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中ch.cyberduck.core.Local.getBookmark()方法的一些代码示例,展示了Local.getBookmark()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.getBookmark()方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:getBookmark

Local.getBookmark介绍

暂无

代码示例

代码示例来源:origin: iterate-ch/cyberduck

@Override
public NSURL resolve(final Local file, final boolean interactive) throws AccessDeniedException {
  final NSData bookmark;
  if(null == file.getBookmark()) {
    log.warn(String.format("Missing security scoped bookmark for file %s", file));
    if(interactive) {
      // Prompt user if no bookmark reference is available
      final String reference = this.choose(file);
      file.setBookmark(reference);
      bookmark = NSData.dataWithBase64EncodedString(reference);
    }
    else {
      throw new LocalAccessDeniedException(String.format("No security scoped bookmark for %s", file.getName()));
    }
  }
  else {
    bookmark = NSData.dataWithBase64EncodedString(file.getBookmark());
  }
  final ObjCObjectByReference error = new ObjCObjectByReference();
  final NSURL resolved = NSURL.URLByResolvingBookmarkData(bookmark, resolve, error);
  if(null == resolved) {
    log.warn(String.format("Error resolving bookmark for %s to URL", file));
    final NSError f = error.getValueAs(NSError.class);
    if(null == f) {
      throw new LocalAccessDeniedException(file.getAbsolute());
    }
    throw new LocalAccessDeniedException(String.format("%s", f.localizedDescription()));
  }
  return resolved;
}

代码示例来源:origin: iterate-ch/cyberduck

public void downloadPathPanelDidEnd_returnCode_contextInfo(NSOpenPanel sheet, int returncode, ID contextInfo) {
  if(returncode == SheetCallback.DEFAULT_OPTION) {
    NSArray selected = sheet.filenames();
    String filename;
    if((filename = selected.lastObject().toString()) != null) {
      final Local folder = LocalFactory.get(filename);
      preferences.setProperty("queue.download.folder", folder.getAbbreviatedPath());
      preferences.setProperty("queue.download.folder.bookmark", folder.getBookmark());
    }
  }
  final Local custom = LocalFactory.get(preferences.getProperty("queue.download.folder"));
  final NSMenuItem item = downloadPathPopup.itemAtIndex(new NSInteger(0));
  item.setTitle(custom.getDisplayName());
  item.setRepresentedObject(custom.getAbsolute());
  item.setImage(IconCacheFactory.<NSImage>get().fileIcon(custom, 16));
  downloadPathPopup.selectItem(item);
  downloadPathPanel = null;
}

相关文章