/** * Returns the VM name from the given container ID path. * * @param path the path * @return the VM name from the given container ID path */ public static String getVMName(IPath path) { return path.segment(2); }
public static boolean hasDotDot(IPath path) { for (int i = 0, length = path.segmentCount(); i < length; i++) { if (DOT_DOT.equals(path.segment(i))) return true; } return false; }
public static boolean hasDotDot(IPath path) { for (int i = 0, length = path.segmentCount(); i < length; i++) { if (DOT_DOT.equals(path.segment(i))) return true; } return false; }
@Override public boolean belongsTo(String projectNameOrJarPath) { // used to remove pending jobs because the project was deleted... not to delete index files // can be found either by project name or JAR path name return projectNameOrJarPath.equals(this.containerPath.segment(0)) || projectNameOrJarPath.equals(this.containerPath.toString()); } @Override
protected boolean isNonProjectSpecificContainer(IPath containerPath) { if (containerPath.segmentCount() > 0) { String id= containerPath.segment(0); if (id.equals(JavaCore.USER_LIBRARY_CONTAINER_ID) || id.equals(JavaRuntime.JRE_CONTAINER)) { return true; } } return false; }
protected void createUserLibrary(final Shell shell, IPath unboundPath) { String name= unboundPath.segment(1); String id= UserLibraryPreferencePage.ID; HashMap<String, Object> data= new HashMap<>(3); data.put(UserLibraryPreferencePage.DATA_LIBRARY_TO_SELECT, name); data.put(UserLibraryPreferencePage.DATA_DO_CREATE, Boolean.TRUE); PreferencesUtil.createPreferenceDialogOn(shell, id, new String[] { id }, data).open(); }
public boolean isDeprecated() { if (fEntryKind != IClasspathEntry.CPE_VARIABLE) { return false; } if (fPath.segmentCount() > 0) { return JavaCore.getClasspathVariableDeprecationMessage(fPath.segment(0)) != null; } return false; }
private IPath fixDevice(IPath path) { if (path != null && path.getDevice() != null) { return path.setDevice(path.getDevice().toUpperCase()); } if (Platform.OS_WIN32.equals(Platform.getOS()) && path != null && path.toString().startsWith("//")) { String server = path.segment(0); String pathStr = path.toString().replace(server, server.toUpperCase()); return new Path(pathStr); } return path; }
/** * @deprecated use {@link #getFileStore(IPath)} instead */ @Deprecated @Override public IFileStore getChild(IPath path) { IFileStore result = this; for (int i = 0, imax = path.segmentCount(); i < imax; i++) result = result.getChild(path.segment(i)); return result; }
private IPath getResolvedPath(IPath path) { if (path != null) { String varName= path.segment(0); if (varName != null) { IPath varPath= JavaCore.getClasspathVariable(varName); if (varPath != null) { return varPath.append(path.removeFirstSegments(1)); } } } return null; }
/** * @deprecated use {@link #getFileStore(IPath)} instead */ @Deprecated @Override public IFileStore getChild(IPath path) { IFileStore result = this; for (int i = 0, imax = path.segmentCount(); i < imax; i++) result = result.getChild(path.segment(i)); return result; }
/** * @see Object#hashCode() */ @Override public int hashCode() { if (getType() == CONTAINER) { return getPath().segment(0).hashCode() + getType(); } return getPath().hashCode() + getType(); }
private IResource internalGetResource(IPath fullPath, boolean container) { if (container) { if (fullPath.segmentCount() == 1) return ResourcesPlugin.getWorkspace().getRoot().getProject(fullPath.segment(0)); return ResourcesPlugin.getWorkspace().getRoot().getFolder(fullPath); } return ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath); }
public String getComponentName(){ IResource resource = getResourceFromInitialSelection(); if (resource!=null) { IPath absolutePath = resource.getFullPath(); if (absolutePath.isAbsolute()) { return absolutePath.segment(1); } } return null; }
/** * @see org.eclipse.core.resources.IPathVariableManager#resolvePath(IPath) */ @Deprecated @Override public IPath resolvePath(IPath path) { if (path == null || path.segmentCount() == 0 || path.isAbsolute() || path.getDevice() != null) return path; IPath value = getValue(path.segment(0)); return value == null ? path : value.append(path.removeFirstSegments(1)); }
/** * Returns the local file system location in which the meta data for the * resource with the given path is stored. */ public IPath locationFor(IPath resourcePath) { if (Path.ROOT.equals(resourcePath)) return metaAreaLocation.append(F_ROOT); return projectMetaLocation.append(resourcePath.segment(0)); }
@Override public long setLocalTimeStamp(long value) throws CoreException { //override to handle changing timestamp on project description file long result = super.setLocalTimeStamp(value); if (path.segmentCount() == 2 && path.segment(1).equals(IProjectDescription.DESCRIPTION_FILE_NAME)) { //handle concurrent project deletion ResourceInfo projectInfo = ((Project) getProject()).getResourceInfo(false, false); if (projectInfo != null) getLocalManager().updateLocalSync(projectInfo, result); } return result; }
/** * @see IRuntimeClasspathEntry#getVariableName() */ @Override public String getVariableName() { if (getType() == IRuntimeClasspathEntry.VARIABLE || getType() == IRuntimeClasspathEntry.CONTAINER) { return getPath().segment(0); } return null; }
@Override public IContainer getParent() { int segments = path.segmentCount(); //zero and one segments handled by subclasses if (segments < 2) Assert.isLegal(false, path.toString()); if (segments == 2) return workspace.getRoot().getProject(path.segment(0)); return (IFolder) workspace.newResource(path.removeLastSegments(1), IResource.FOLDER); }
private void updateDescription(IClasspathEntry containerEntry) { if (containerEntry == null || containerEntry.getPath().segmentCount() != 2) { setDescription(NewWizardMessages.UserLibraryWizardPage_description_new); } else { setDescription(Messages.format(NewWizardMessages.UserLibraryWizardPage_description_edit, containerEntry.getPath().segment(1))); } }