本文整理了Java中ch.cyberduck.core.Path.isDirectory()
方法的一些代码示例,展示了Path.isDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.isDirectory()
方法的具体详情如下:
包路径:ch.cyberduck.core.Path
类名称:Path
方法名:isDirectory
暂无
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Path p) {
return p.isDirectory();
}
};
代码示例来源:origin: iterate-ch/cyberduck
@Override
public int compare(final Path o1, final Path o2) {
if(o1.isDirectory() && o2.isDirectory()) {
return 0;
}
if(o1.isFile() && o2.isFile()) {
return 0;
}
if(o1.isDirectory()) {
return -1;
}
if(o2.isDirectory()) {
return 1;
}
return 0;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(final Path file) {
if(file.isDirectory()) {
return true;
}
return filter.accept(file);
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getKey(final Path file) {
final String key = super.getKey(file);
if(!file.isRoot() && !this.isContainer(file) && file.isDirectory()) {
return key.concat(String.valueOf(Path.DELIMITER)).concat(PLACEHOLDER);
}
return key;
}
}
代码示例来源:origin: iterate-ch/cyberduck
/**
* @see NSOutlineView.DataSource
*/
@Override
public boolean outlineView_isItemExpandable(final NSOutlineView view, final NSObject item) {
if(log.isTraceEnabled()) {
log.trace("outlineViewIsItemExpandable:" + item);
}
if(null == item) {
return false;
}
final Path lookup = cache.lookup(new NSObjectPathReference(item));
if(null == lookup) {
return false;
}
return lookup.isDirectory();
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getKey(final Path file) {
final String key = super.getKey(file);
if(!file.isRoot() && !this.isContainer(file) && file.isDirectory()) {
return key.concat(String.valueOf(Path.DELIMITER));
}
return key;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException {
// Move inside vault moves actual files and only metadata files for directories but not the actual directories
final Path target = proxy.move(
vault.encrypt(session, file, file.isDirectory()),
vault.encrypt(session, renamed, file.isDirectory()),
status, callback, connectionCallback);
return vault.decrypt(session, target);
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getKey(final Path file) {
final String key = super.getKey(file);
if(!file.isRoot() && !this.isContainer(file) && file.isDirectory()) {
return key.concat(String.valueOf(Path.DELIMITER));
}
return key;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean outlineView_isItemExpandable(final NSOutlineView view, final NSObject item) {
return cache.lookup(new NSObjectTransferItemReference(item)).remote.isDirectory();
}
代码示例来源:origin: iterate-ch/cyberduck
public String encode(final Path file) {
final String encoded = URIEncoder.encode(file.getAbsolute());
if(file.isDirectory()) {
if(file.isRoot()) {
return encoded;
}
return String.format("%s/", encoded);
}
return encoded;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
protected int compareFirst(final Path p1, final Path p2) {
if((p1.isDirectory() && p2.isDirectory())
|| p1.isFile() && p2.isFile()) {
if(ascending) {
return impl.compare(descriptor.getKind(p1), descriptor.getKind(p2));
}
return -impl.compare(descriptor.getKind(p1), descriptor.getKind(p2));
}
if(p1.isFile()) {
return ascending ? 1 : -1;
}
return ascending ? -1 : 1;
}
}
代码示例来源:origin: iterate-ch/cyberduck
private void setDropRowAndDropOperation(final NSTableView view, final Path destination, final NSInteger row) {
if(destination.equals(controller.workdir())) {
log.debug("setDropRowAndDropOperation:-1");
// Passing a value of –1 for row, and NSTableViewDropOn as the operation causes the
// entire table view to be highlighted rather than a specific row.
view.setDropRow(new NSInteger(-1), NSTableView.NSTableViewDropOn);
}
else if(destination.isDirectory()) {
log.debug("setDropRowAndDropOperation:" + row.intValue());
view.setDropRow(row, NSTableView.NSTableViewDropOn);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean find(final Path file) throws BackgroundException {
try {
// Look for metadata file to exist when searching for folder
return delegate.withCache(new CryptoPathCache(cache)).find(vault.encrypt(session, file, file.isDirectory()));
}
catch(NotfoundException e) {
return false;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String getKind(final Path file) {
if(file.isFile()) {
return this.getKind(file.getName());
}
if(file.isDirectory()) {
return LocaleFactory.localizedString("Folder");
}
return LocaleFactory.localizedString("Unknown");
}
代码示例来源:origin: iterate-ch/cyberduck
protected void write(final Session<?> session, final UnixPermission feature, final Path file, final Permission permission) throws BackgroundException {
listener.message(MessageFormat.format(LocaleFactory.localizedString("Changing permission of {0} to {1}", "Status"),
file.getName(), permission));
feature.setUnixPermission(file, permission);
if(file.isDirectory()) {
if(callback.recurse(file, permission)) {
for(Path child : session.getFeature(ListService.class).list(file, new WorkerListProgressListener(this, listener))) {
this.write(session, feature, child, permission);
}
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public DescriptiveUrlBag toUrl(final Path file) {
final String nodeid = file.isDirectory() ? file.attributes().getVersionId() : file.getParent().attributes().getVersionId();
if(StringUtils.isBlank(nodeid)) {
return DescriptiveUrlBag.empty();
}
return new DescriptiveUrlBag(Collections.singletonList(
new DescriptiveUrl(URI.create(String.format("%s/#/node/%s",
new HostUrlProvider().withUsername(false).get(session.getHost()), URIEncoder.encode(
nodeid
))),
DescriptiveUrl.Type.http,
MessageFormat.format(LocaleFactory.localizedString("{0} URL"), session.getHost().getProtocol().getScheme().toString().toUpperCase(Locale.ROOT)))
));
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected void write(final Session<?> session, final Redundancy feature, final Path file) throws BackgroundException {
if(this.isCanceled()) {
throw new ConnectionCanceledException();
}
if(!level.equals(file.attributes().getStorageClass())) {
listener.message(MessageFormat.format(LocaleFactory.localizedString("Writing metadata of {0}", "Status"),
file.getName()));
feature.setClass(file, level);
}
if(file.isDirectory()) {
if(callback.recurse(file, level)) {
for(Path child : session.getFeature(ListService.class).list(file, new WorkerListProgressListener(this, listener))) {
this.write(session, feature, child);
}
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected void write(final Session<?> session, final Encryption feature, final Path file) throws BackgroundException {
if(this.isCanceled()) {
throw new ConnectionCanceledException();
}
listener.message(MessageFormat.format(LocaleFactory.localizedString("Writing metadata of {0}", "Status"),
file.getName()));
feature.setEncryption(file, algorithm);
if(file.isDirectory()) {
if(callback.recurse(file, algorithm)) {
for(Path child : session.getFeature(ListService.class).list(file, new WorkerListProgressListener(this, listener))) {
this.write(session, feature, child);
}
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void insideButtonClicked(final ID sender) {
final Path selected = this.getSelectedPath(); //first row selected
if(null == selected) {
return;
}
if(selected.isDirectory()) {
this.setWorkdir(selected);
}
else if(selected.isFile() || this.getSelectionCount() > 1) {
if(preferences.getBoolean("browser.doubleclick.edit")) {
this.editButtonClicked(null);
}
else {
this.downloadButtonClicked(null);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
/**
* Open a new browser with the current selected folder as the working directory
*
* @param sender Toolbar button
*/
@Action
public void newBrowserButtonClicked(final ID sender) {
Path selected = this.getSelectedPath();
if(null == selected || !selected.isDirectory()) {
selected = this.workdir();
}
BrowserController c = MainController.newDocument(true);
final Host host = new HostDictionary().deserialize(pool.getHost().serialize(SerializerFactory.get()));
host.setDefaultPath(selected.getAbsolute());
c.mount(host);
}
内容来源于网络,如有侵权,请联系作者删除!