本文整理了Java中ch.cyberduck.core.Path.equals()
方法的一些代码示例,展示了Path.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.equals()
方法的具体详情如下:
包路径:ch.cyberduck.core.Path
类名称:Path
方法名:equals
暂无
代码示例来源:origin: iterate-ch/cyberduck
/**
* @param p Directory
*/
public void add(final Path p) {
if(back.size() > 0) {
// Do not add if this was a reload
if(p.equals(back.get(back.size() - 1))) {
return;
}
}
back.add(p);
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean contains(final Path directory) {
for(Vault vault : this) {
if(directory.equals(vault.getHome())) {
return true;
}
}
return false;
}
代码示例来源:origin: iterate-ch/cyberduck
private boolean findTarget(final Path target, final Path root) {
return target.equals(root) || target.isChild(root);
}
}
代码示例来源:origin: iterate-ch/cyberduck
private Path buildNormalizedHomePath(final String rawHomePath) {
final String defaultPath = StringUtils.defaultIfBlank(rawHomePath, Path.HOME);
final String accountRootRegex = String.format("^/?(%s|~~?)/?", accountRoot.getAbsolute());
final String subdirectoryRawPath = defaultPath.replaceFirst(accountRootRegex, "");
if(StringUtils.isEmpty(subdirectoryRawPath)) {
return accountRoot;
}
final String[] subdirectoryPathSegments = StringUtils.split(subdirectoryRawPath, Path.DELIMITER);
Path homePath = accountRoot;
for(final String pathSegment : subdirectoryPathSegments) {
EnumSet<Path.Type> types = EnumSet.of(Path.Type.directory);
if(homePath.getParent().equals(accountRoot)
&& StringUtils.equalsAny(pathSegment, HOME_PATH_PRIVATE, HOME_PATH_PUBLIC)) {
types.add(Path.Type.volume);
}
homePath = new Path(homePath, pathSegment, types);
}
return homePath;
}
代码示例来源:origin: iterate-ch/cyberduck
if(SharepointListService.DEFAULT_NAME.equals(file)) {
return false;
if(!container && SharepointListService.DEFAULT_NAME.equals(file.getParent())) {
return false;
if(SharepointListService.GROUPS_NAME.equals(file) || SharepointListService.GROUPS_NAME.equals(file.getParent())) {
return false;
if(!container && SharepointListService.GROUPS_NAME.equals(file.getParent().getParent())) {
return false;
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean isSupported(final Path source, final Path target) {
if(!session.isAccessible(source, false)) {
return false;
}
if(!session.getContainer(source).equals(session.getContainer(target))) {
return false;
}
if(source.getType().contains(Path.Type.shared)) {
return false;
}
return true;
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean isSupported(final Path source, final Path target) {
if(!session.isAccessible(source, false)) {
return false;
}
if(!session.getContainer(source).equals(session.getContainer(target))) {
return false;
}
if(source.getType().contains(Path.Type.shared)) {
return false;
}
return true;
}
}
代码示例来源: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 Path getContainer(final Path file) {
if(file.isRoot()) {
return file;
}
Path previous = file;
Path parent = file.getParent();
while(!parent.isRoot()) {
if(SharepointListService.DEFAULT_NAME.equals(parent.getParent())) {
return parent;
}
else if(SharepointListService.GROUPS_NAME.equals(parent.getParent())) {
return previous;
}
previous = parent;
parent = parent.getParent();
}
return file;
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected boolean isUserWritable(final Path file) {
final MantaAccountHomeInfo account = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath());
return file.equals(account.getAccountPublicRoot())
|| file.equals(account.getAccountPrivateRoot())
|| file.isChild(account.getAccountPublicRoot())
|| file.isChild(account.getAccountPrivateRoot());
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void render(final NSTableView view, final List<Path> folders) {
super.render(view, folders);
if(log.isDebugEnabled()) {
log.debug(String.format("Reload table view %s for changes files %s", view, folders));
}
if(controller.isMounted()) {
final NSOutlineView outline = (NSOutlineView) view;
if(folders.isEmpty()) {
view.reloadData();
}
else {
for(Path folder : folders) {
if(folder.equals(controller.workdir())) {
outline.reloadData();
break;
}
else {
outline.reloadItem_reloadChildren(NSObjectPathReference.get(folder), true);
}
}
}
}
else {
view.reloadData();
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void backButtonClicked(final ID sender) {
final Path selected = navigation.back();
if(selected != null) {
final Path previous = this.workdir();
if(previous.getParent().equals(selected)) {
this.setWorkdir(selected, previous);
}
else {
this.setWorkdir(selected);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
if(directory.isRoot()) {
final AttributedList<Path> list = new AttributedList<>();
list.add(DEFAULT_NAME);
list.add(GROUPS_NAME);
listener.chunk(directory, list);
return list;
}
else {
if(DEFAULT_NAME.equals(directory)) {
return new GraphDrivesListService(session).list(directory, listener);
}
else if(GROUPS_NAME.equals(directory)) {
return new SharepointGroupListService(session).list(directory, listener);
}
else if(GROUPS_NAME.equals(directory.getParent())) {
return new SharepointGroupDrivesListService(session).list(directory, listener);
}
return new GraphItemListService(session).list(directory, listener);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
if(directory.isRoot()) {
final AttributedList<Path> list = new AttributedList<>();
list.add(DriveHomeFinderService.MYDRIVE_FOLDER);
list.add(DriveHomeFinderService.SHARED_FOLDER_NAME);
list.add(DriveHomeFinderService.TEAM_DRIVES_NAME);
listener.chunk(directory, list);
return list;
}
else {
if(DriveHomeFinderService.SHARED_FOLDER_NAME.equals(directory)) {
return new DriveSharedFolderListService(session, fileid).list(directory, listener);
}
if(DriveHomeFinderService.TEAM_DRIVES_NAME.equals(directory)) {
return new DriveTeamDrivesListService(session).list(directory, listener);
}
return new DriveDefaultListService(session, fileid).list(directory, listener);
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Action
public void pathPopupSelectionChanged(final NSPopUpButton sender) {
final String selected = sender.selectedItem().representedObject();
if(selected != null) {
final Path workdir = this.workdir();
Path p = workdir;
while(!p.getAbsolute().equals(selected)) {
p = p.getParent();
}
this.setWorkdir(p);
if(workdir.getParent().equals(p)) {
this.setWorkdir(p, workdir);
}
else {
this.setWorkdir(p);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void callback(final int returncode) {
switch(returncode) {
case DEFAULT_OPTION:
final String filename = folderCombobox.stringValue();
final Path workdir = parent.workdir();
final Path directory = parent.getSession().getFeature(Home.class).find(workdir, filename);
if(workdir.getParent().equals(directory)) {
parent.setWorkdir(directory, workdir);
}
else {
parent.setWorkdir(directory);
}
break;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Permission getUnixPermission(final Path file) throws BackgroundException {
try {
return new FTPAttributesFinderFeature(session).find(file).getPermission();
}
catch(InteroperabilityException e) {
for(Path f : session.getFeature(ListService.class).list(file.getParent(), new DisabledListProgressListener())) {
if(f.equals(file)) {
return f.attributes().getPermission();
}
}
}
throw new NotfoundException(file.getAbsolute());
}
代码示例来源:origin: iterate-ch/cyberduck
patchOperation.rename(renamed.getName());
if(!file.getParent().equals(renamed.getParent())) {
final OneDriveFolder moveTarget = session.toFolder(renamed.getParent());
patchOperation.move(moveTarget);
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
for(Path file : files) {
if(file.getType().contains(Path.Type.placeholder)) {
continue;
}
callback.delete(file);
try {
if(DriveHomeFinderService.TEAM_DRIVES_NAME.equals(file.getParent())) {
session.getClient().teamdrives().delete(fileid.getFileid(file, new DisabledListProgressListener())).execute();
}
else {
if(PreferencesFactory.get().getBoolean("googledrive.delete.trash")) {
final File properties = new File();
properties.setTrashed(true);
session.getClient().files().update(fileid.getFileid(file, new DisabledListProgressListener()), properties)
.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
}
else {
session.getClient().files().delete(fileid.getFileid(file, new DisabledListProgressListener()))
.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
}
}
}
catch(IOException e) {
throw new DriveExceptionMappingService().map("Cannot delete {0}", e, file);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
try {
if(DriveHomeFinderService.TEAM_DRIVES_NAME.equals(folder.getParent())) {
final TeamDrive execute = session.getClient().teamdrives().create(
new UUIDRandomStringService().random(), new TeamDrive().setName(folder.getName())
).execute();
return new Path(folder.getParent(), folder.getName(), folder.getType(),
new PathAttributes(folder.attributes()).withVersionId(execute.getId()));
}
else {
// Identified by the special folder MIME type application/vnd.google-apps.folder
final Drive.Files.Create insert = session.getClient().files().create(new File()
.setName(folder.getName())
.setMimeType("application/vnd.google-apps.folder")
.setParents(Collections.singletonList(fileid.getFileid(folder.getParent(), new DisabledListProgressListener()))));
final File execute = insert
.setSupportsTeamDrives(PreferencesFactory.get().getBoolean("googledrive.teamdrive.enable")).execute();
return new Path(folder.getParent(), folder.getName(), folder.getType(),
new DriveAttributesFinderFeature(session, fileid).toAttributes(execute));
}
}
catch(IOException e) {
throw new DriveExceptionMappingService().map("Cannot create folder {0}", e, folder);
}
}
内容来源于网络,如有侵权,请联系作者删除!