@Override protected int compareNames(IResource r1, IResource r2) { if (getLayout().equals(IPreferenceIds.COMPRESSED_LAYOUT) && r1 instanceof IFolder && r2 instanceof IFolder) { return collator.compare(r1.getProjectRelativePath().toString(), r2.getProjectRelativePath().toString()); } return super.compareNames(r1, r2); }
protected int compareNames(IResource r1, IResource r2) { if (getLayout().equals(IPreferenceIds.COMPRESSED_LAYOUT) && r1 instanceof IFolder && r2 instanceof IFolder) { return collator.compare(r1.getProjectRelativePath().toString(), r2.getProjectRelativePath().toString()); } return super.compareNames(r1, r2); }
@Override public String getName() { IResource resource = getResource(); return resource.getProjectRelativePath().toString(); }
private String getProjectRelativePath(Repository db, String repoPath) { IResource resource = ResourceUtil.getFileForLocation(db, repoPath); if (resource == null) return null; return resource.getProjectRelativePath().toString(); }
@Override public IPath getProjectRelativePath() { return getResource().getProjectRelativePath(); }
public LinkDescription(IResource linkedResource, URI location) { super(); Assert.isNotNull(linkedResource); Assert.isNotNull(location); this.type = linkedResource.getType(); this.path = linkedResource.getProjectRelativePath(); this.localLocation = location; }
public LinkDescription(IResource linkedResource, URI location) { super(); Assert.isNotNull(linkedResource); Assert.isNotNull(location); this.type = linkedResource.getType(); this.path = linkedResource.getProjectRelativePath(); this.localLocation = location; }
protected int compareNames(IResource resource1, IResource resource2) { if (resource1.getType() == IResource.FOLDER && resource2.getType() == IResource.FOLDER) { return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString()); } return super.compareNames(resource1, resource2); } };
@Override protected int compareNames(IResource resource1, IResource resource2) { if (resource1.getType() == IResource.FOLDER && resource2.getType() == IResource.FOLDER) { return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString()); } return super.compareNames(resource1, resource2); } };
private static void addBuildEntryEdit(IBuildEntry entry, IResource res, String string) { IPath resPath = res.getProjectRelativePath(); String[] tokens = entry.getTokens(); for (String token : tokens) { if (resPath.isPrefixOf(new Path(token))) { try { entry.renameToken(token, string.concat(token.substring(resPath.toString().length()))); } catch (CoreException e) { } } } }
/** * Method retrieveClassesFolder. * * @param resource * @return IFolder */ protected IFolder retrieveClassesFolder(IResource resource, IFolder[] classesFolders) { for (int i = 0; i < classesFolders.length; i++) { if (classesFolders[i].getName().equals(resource.getProjectRelativePath().segment(0))) return classesFolders[i]; } return null; }
private void createLinkedResources(PersistentModelBuilder persistentModel, SubMonitor progress) throws CoreException { progress.setWorkRemaining(this.resources.size()); Set<IPath> linkedPaths = Sets.newHashSet(); for (EclipseLinkedResource linkedFile : this.resources) { SubMonitor childProgress = progress.newChild(1); IResource file = createLinkedResource(linkedFile, childProgress); linkedPaths.add(file.getProjectRelativePath()); } persistentModel.linkedResources(linkedPaths); }
@Override public void addElement(Object element, RefactoringArguments arguments) { String newName = ((RenameArguments) arguments).getNewName(); if (element instanceof IResource) { IPath projectPath = ((IResource) element).getProjectRelativePath(); newName = projectPath.removeLastSegments(1).append(newName).toString(); } fElements.put(element, newName); }
private void collectAffectedResourcePaths(Set<IPath> result, IResourceDelta[] deltas) { for (IResourceDelta delta : deltas) { result.add(delta.getResource().getProjectRelativePath()); collectAffectedResourcePaths(result, delta.getAffectedChildren()); } }
private static TextEdit createTextEdit(IDocumentAttributeNode attr, IResource resource, String newName) { if (attr != null) { String oldName = resource.getProjectRelativePath().toString(); String value = attr.getAttributeValue(); if (oldName.equals(value) || ((resource instanceof IContainer) && isGoodFolderMatch(value, oldName))) { int offset = attr.getValueOffset(); if (offset >= 0) return new ReplaceEdit(offset, oldName.length(), newName); } } return null; }
private boolean isLocalizationFile(IResource file) { IPluginModelBase model = PluginRegistry.findModel(getProject()); String localization = null; if (model instanceof IBundlePluginModelBase) { localization = ((IBundlePluginModelBase)model).getBundleLocalization(); } else { localization = "plugin"; //$NON-NLS-1$ } if (localization != null) return file.getProjectRelativePath().equals(new Path(localization + ".properties")); //$NON-NLS-1$ return false; }
public boolean visit(IResourceDelta delta) { if(delta.getAffectedChildren().length == 0) { IResource resource = delta.getResource(); if(resource instanceof IFile || resource instanceof IFolder) { projectNode.addResource(resource.getProjectRelativePath()).setBuildCount(buildCount); } } return true; // keep visiting } });
private String getRelativePathTokenName(IResource elem) { IProject thisProject = getBuildModel().getUnderlyingResource().getProject(); IProject elemProject = elem.getProject(); String projectRelative = elem.getProjectRelativePath().toString(); if (thisProject == elemProject) return projectRelative; IPluginModelBase model = PluginRegistry.findModel(elemProject); if (model != null) return "platform:/plugin/" + model.getPluginBase().getId() + '/' + projectRelative; //$NON-NLS-1$ return null; }
protected void write(IResourceFilterDescription description, XMLWriter writer) { writer.startTag(FILTER, null); if (description != null) { writer.printSimpleTag(ID, ((FilterDescription) description).getId()); writer.printSimpleTag(NAME, description.getResource().getProjectRelativePath()); writer.printSimpleTag(TYPE, Integer.toString(description.getType())); if (description.getFileInfoMatcherDescription() != null) { write(description.getFileInfoMatcherDescription(), writer); } } writer.endTag(FILTER); }
protected void write(IResourceFilterDescription description, XMLWriter writer) { writer.startTag(FILTER, null); if (description != null) { writer.printSimpleTag(ID, ((FilterDescription) description).getId()); writer.printSimpleTag(NAME, description.getResource().getProjectRelativePath()); writer.printSimpleTag(TYPE, Integer.toString(description.getType())); if (description.getFileInfoMatcherDescription() != null) { write(description.getFileInfoMatcherDescription(), writer); } } writer.endTag(FILTER); }