本文整理了Java中ch.cyberduck.core.Local.getAbsolute()
方法的一些代码示例,展示了Local.getAbsolute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.getAbsolute()
方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:getAbsolute
暂无
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean open(final Local file) {
try {
runtime.exec(String.format("xdg-open %s", file.getAbsolute()));
return true;
}
catch(IOException e) {
log.warn(String.format("Failure launching application %s", e.getMessage()));
return false;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean remove(final Local file) {
this.cancel(file.getAbsolute());
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean open(final Local file) {
synchronized(NSWorkspace.class) {
if(!workspace.openFile(file.getAbsolute())) {
log.warn(String.format("Error opening file %s", file));
return false;
}
return true;
}
}
代码示例来源:origin: iterate-ch/cyberduck
public Local(final Local parent, final String name, final String delimiter) {
this(parent.isRoot() ?
String.format("%s%s", parent.getAbsolute(), name) :
String.format("%s%c%s", parent.getAbsolute(), CharUtils.toChar(delimiter), name));
}
代码示例来源:origin: iterate-ch/cyberduck
private void load(final String table) throws IOException {
final File file = new File(String.format("%s/%s.lproj/%s.strings.1", resources.getAbsolute(), locale, table));
if(file.exists()) {
this.load(table, file);
}
else {
this.load(table, new File(String.format("%s/%s.lproj/%s.strings", resources.getAbsolute(), locale, table)));
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected Local normalize(final Local file) {
try {
return LocalFactory.get(new File(file.getAbsolute()).getCanonicalPath());
}
catch(IOException e) {
log.warn(String.format("Failure getting real path for file %s", file));
return file;
}
}
代码示例来源:origin: iterate-ch/cyberduck
private void save(final Properties properties) {
try (OutputStream out = file.getOutputStream(false)) {
properties.store(out, "Credentials");
}
catch(AccessDeniedException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getDetail()));
}
catch(IOException e) {
log.warn(String.format("Failure saving credentials to %s. %s", file.getAbsolute(), e.getMessage()));
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void trash(Local file) throws LocalAccessDeniedException {
try {
Files.delete(Paths.get(file.getAbsolute()));
}
catch(IOException e) {
throw new LocalAccessDeniedException(String.format("Failed to move %s to Trash", file.getName()), e);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void mkdir(final Local file) throws AccessDeniedException {
try {
Files.createDirectories(Paths.get(file.getAbsolute()));
}
catch(IOException e) {
throw new LocalAccessDeniedException(MessageFormat.format(LocaleFactory.localizedString(
"Cannot create folder {0}", "Error"), file.getName()), e);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
public static NSAttributedString create(final String title, final Local file) {
if(null == file) {
return NSAttributedString.attributedString(title);
}
return create(NSMutableAttributedString.create(title,
BundleController.TRUNCATE_MIDDLE_ATTRIBUTES), String.format("file://%s", file.getAbsolute()));
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void add(final Local file) throws LocalAccessDeniedException {
if(log.isDebugEnabled()) {
log.debug(String.format("Add %s to %s", file, this.forList(list)));
}
if(!this.addItem(file.getAbsolute(), this.forList(list))) {
throw new LocalAccessDeniedException(String.format("Failure adding %s to %s", file, this.forList(list)));
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void write(final Collection<S> collection, final Local file) throws AccessDeniedException {
NSMutableArray list = NSMutableArray.array();
for(S bookmark : collection) {
list.addObject(bookmark.<NSDictionary>serialize(SerializerFactory.get()));
}
if(!list.writeToFile(file.getAbsolute())) {
throw new LocalAccessDeniedException(String.format("Cannot create file %s", file.getAbsolute()));
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void trash(final Local file) throws LocalAccessDeniedException {
try {
FileUtils.getInstance().moveToTrash(new File[]{new File(file.getAbsolute())});
}
catch(IOException e) {
log.warn(String.format("Failed to move %s to Trash", file.getName()));
new DefaultLocalTrashFeature().trash(file);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean reveal(final Local file) {
synchronized(NSWorkspace.class) {
// If a second path argument is specified, a new file viewer is opened. If you specify an
// empty string (@"") for this parameter, the file is selected in the main viewer.
return NSWorkspace.sharedWorkspace().selectFile(new NFDNormalizer().normalize(file.getAbsolute()).toString(),
new NFDNormalizer().normalize(file.getParent().getAbsolute()).toString());
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected boolean matches(final Local context, final Local file) {
if(!new File(context.getAbsolute()).isAbsolute()) {
return context.getName().equals(file.getName());
}
return this.normalize(context).equals(this.normalize(file));
}
代码示例来源:origin: iterate-ch/cyberduck
protected boolean update(final Local file, final NSImage icon) {
synchronized(NSWorkspace.class) {
// Specify 0 if you want to generate icons in all available icon representation formats
final NSWorkspace workspace = NSWorkspace.sharedWorkspace();
if(workspace.setIcon_forFile_options(icon, file.getAbsolute(), new NSUInteger(0))) {
workspace.noteFileSystemChanged(new NFDNormalizer().normalize(file.getAbsolute()).toString());
return true;
}
return false;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean set(final Local file, final TransferStatus status) {
this.progress(file.getAbsolute(), status.getOffset(), status.getLength());
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void downloadToButtonClicked(final ID sender) {
downloadToPanel = NSOpenPanel.openPanel();
downloadToPanel.setCanChooseDirectories(true);
downloadToPanel.setCanCreateDirectories(true);
downloadToPanel.setCanChooseFiles(false);
downloadToPanel.setAllowsMultipleSelection(false);
downloadToPanel.setPrompt(LocaleFactory.localizedString("Choose"));
downloadToPanel.beginSheetForDirectory(new DownloadDirectoryFinder().find(pool.getHost()).getAbsolute(),
null, this.window, this.id(),
Foundation.selector("downloadToPanelDidEnd:returnCode:contextInfo:"), null);
}
代码示例来源:origin: iterate-ch/cyberduck
private void addDownloadPath(final Local f) {
if(downloadPathPopup.menu().itemWithTitle(f.getDisplayName()) == null) {
downloadPathPopup.addItemWithTitle(f.getDisplayName());
downloadPathPopup.lastItem().setImage(IconCacheFactory.<NSImage>get().fileIcon(f, 16));
downloadPathPopup.lastItem().setRepresentedObject(f.getAbsolute());
if(new DownloadDirectoryFinder().find(bookmark).equals(f)) {
downloadPathPopup.selectItem(downloadPathPopup.lastItem());
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void downloadAsButtonClicked(final ID sender) {
downloadAsPanel = NSSavePanel.savePanel();
downloadAsPanel.setMessage(LocaleFactory.localizedString("Download the selected file to…"));
downloadAsPanel.setNameFieldLabel(LocaleFactory.localizedString("Download As:"));
downloadAsPanel.setPrompt(LocaleFactory.localizedString("Download", "Transfer"));
downloadAsPanel.setCanCreateDirectories(true);
downloadAsPanel.beginSheetForDirectory(new DownloadDirectoryFinder().find(pool.getHost()).getAbsolute(),
this.getSelectedPath().getName(), this.window, this.id(),
Foundation.selector("downloadAsPanelDidEnd:returnCode:contextInfo:"), null);
}
内容来源于网络,如有侵权,请联系作者删除!