/** * Tries to find the 'MANIFEST.MF' file with in the given project in the * 'META-INF folder'. * * @param currentProject * @return a handle to the manifest file or <code>null</code> if not found */ public static IResource getManifestFile(IProject currentProject) { return currentProject.findMember("META-INF/MANIFEST.MF"); //$NON-NLS-1$ }
protected IFile getClasspathFile(IResource resource) { IProject project= resource.getProject(); if (project == null) return null; IResource result= project.findMember(".classpath"); //$NON-NLS-1$ if (result instanceof IFile) return (IFile)result; return null; } }
protected IFile getClasspathFile(IResource resource) { IProject project= resource.getProject(); if (project == null) { return null; } IResource result= project.findMember(".classpath"); //$NON-NLS-1$ if (result instanceof IFile) { return (IFile)result; } return null; } }
protected IFile getClasspathFile(IResource resource) { IProject project= resource.getProject(); if (project == null) return null; IResource result= project.findMember(".classpath"); //$NON-NLS-1$ if (result instanceof IFile) return (IFile)result; return null; } }
protected IFile getClasspathFile(IResource resource) { IProject project= resource.getProject(); if (project == null) return null; IResource result= project.findMember(".classpath"); //$NON-NLS-1$ if (result instanceof IFile) return (IFile)result; return null; } }
private static void addJARdPlugin(IProject project, String filename, IPath sourceAttachment, IClasspathAttribute[] attrs, ArrayList<IClasspathEntry> result) { String name = ClasspathUtilCore.expandLibraryName(filename); IResource jarFile = project.findMember(name); if (jarFile != null) { IClasspathEntry entry = createClasspathEntry(project, jarFile, filename, sourceAttachment, attrs, true); if (!result.contains(entry)) result.add(entry); } }
private IResource findSelectReveal(IProject project, String originalName) { IConfigurationElement[] projects = sample.getChildren("project"); //$NON-NLS-1$ for (int i = 0; i < projects.length; i++) { if (originalName.equals(projects[i].getAttribute("name"))) { //$NON-NLS-1$ String path = projects[i].getAttribute("selectReveal"); //$NON-NLS-1$ if (path == null) continue; IResource res = project.findMember(path); if (res != null && res.exists()) return res; } } return null; }
private boolean tryCreatingLinkedResource(File dependencyFile, Builder<IClasspathEntry> result) { if (!dependencyFile.exists()) { IPath path = new Path("/" + dependencyFile.getPath()); IResource member = this.eclipseProject.getProject().findMember(path); if (member != null) { IClasspathEntry entry = JavaCore.newLibraryEntry(member.getFullPath(), null, null); result.add(entry); return true; } } return false; }
private Object[] findResource(String name, IProject project) { Path path = new Path(name); for (int i = path.segmentCount() - 1; i >= 0; i--) { IResource resource = project.findMember(path.removeFirstSegments(i)); if (resource != null) { return new Object[] {resource}; } } return EMPTY; }
protected static IPath getPath(IPluginModelBase model, String libraryName) { IResource resource = model.getUnderlyingResource(); if (resource != null) { IResource jarFile = resource.getProject().findMember(libraryName); return (jarFile != null) ? jarFile.getFullPath() : null; } File file = new File(model.getInstallLocation(), libraryName); return file.exists() ? new Path(file.getAbsolutePath()) : null; }
private static IClasspathEntry createClasspathEntry(IProject project, IResource library, String fileName, IPath sourceAttachment, IClasspathAttribute[] attrs, boolean isExported) { IResource resource = sourceAttachment != null ? project.findMember(sourceAttachment) : project.findMember(ClasspathUtilCore.getSourceZipName(fileName)); return JavaCore.newLibraryEntry(library.getFullPath(), resource == null ? null : resource.getFullPath(), null, new IAccessRule[0], attrs, isExported); }
private static IPath getPath(IPluginModelBase model, String libraryName) { IResource resource = model.getUnderlyingResource(); if (resource != null) { IResource jarFile = resource.getProject().findMember(libraryName); if (jarFile != null) return jarFile.getFullPath(); } else { File file = new File(model.getInstallLocation(), libraryName); if (file.exists()) return new Path(file.getAbsolutePath()); } return null; }
private File getInterfaceModelFile(String name) { if (localSearch) { return localSearch(name); } File returnFile = null; final IProject project = getProject(); if (project != null) { final IResource res = project.findMember(format("Interfaces/%s.velvet", name)); if (res != null) { returnFile = res.getLocation().toFile(); } } return returnFile; }
private File getInterfaceModelFile(String name) { if (localSearch) { return localSearch(name); } File returnFile = null; final IProject project = getProject(); if (project != null) { final IResource res = project.findMember(format("Interfaces/%s.velvet", name)); if (res != null) { returnFile = res.getLocation().toFile(); } } return returnFile; }
protected URI resolvePath(IProject project, URI path) { IResource candidate = project.findMember(path.toString()); if (candidate != null && candidate.exists()) return URI.createPlatformResourceURI(project.getFullPath() + "/" + path, true); return path; }
private static void addPath(ArrayList result, IProject project, IPath path) { IPath resultPath = null; if (path.isAbsolute()) resultPath = path; else if (path.segmentCount() > 0 && path.segment(0).equals(project.getName())) { path = path.removeFirstSegments(1); if (path.segmentCount() == 0) resultPath = new Path(DOT); else { IResource resource = project.findMember(path); if (resource != null) resultPath = path; } } if (resultPath != null && !result.contains(resultPath)) result.add(resultPath); }
private void addNewMarkers(Collection<IPath> folderPaths, PersistentModelBuilder persistentModel, SubMonitor progress) throws CoreException { progress.setWorkRemaining(folderPaths.size()); for (IPath resourcePath : folderPaths) { IResource resource = this.workspaceProject.findMember(resourcePath); if (resource != null) { resource.setDerived(true, progress.newChild(1)); } else { progress.worked(1); } } persistentModel.derivedResources(folderPaths); }
private void updateDefaultPluginCustomizationFile(IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); // Check to see if the default file already exists in the project IResource resource = fProject.findMember(F_FILE_NAME_PLUGIN_CUSTOM); if (isFileExist(resource)) { // File exists in the project // Update it updatePluginCustomizationFile((IFile) resource, subMonitor.split(1)); } }
private void removeOutdatedLinkedResources(PersistentModelBuilder persistentModel, SubMonitor progress) throws CoreException { PersistentModel previousModel = persistentModel.getPrevious(); Collection<IPath> linkedPaths = previousModel.isPresent() ? previousModel.getLinkedResources() : Collections.<IPath>emptyList(); progress.setWorkRemaining(linkedPaths.size()); for (IPath linkedPath : linkedPaths) { SubMonitor childProgress = progress.newChild(1); IResource linkedResource = this.project.findMember(linkedPath); if (shouldDelete(linkedResource)) { linkedResource.delete(false, childProgress); } } }
private void removePreviousMarkers(Collection<IPath> folderPaths, PersistentModelBuilder persistentModel, SubMonitor progress) throws CoreException { PersistentModel previousModel = persistentModel.getPrevious(); Collection<IPath> previouslyKnownPaths = previousModel.isPresent() ? previousModel.getDerivedResources() : Collections.<IPath>emptyList(); progress.setWorkRemaining(previouslyKnownPaths.size()); for (IPath resourcePath : previouslyKnownPaths) { IResource resource = this.workspaceProject.findMember(resourcePath); if (resource != null) { resource.setDerived(false, progress.newChild(1)); } else { progress.worked(1); } } }