/** * Constructs a package fragment root which is the root of the Java package directory hierarchy * based on a JAR file. */ protected JarPackageFragmentRoot(IResource resource, JavaProject project) { super(resource, project); this.jarPath = resource.getFullPath(); }
@Override public IPath getDestinationPath() { return fResource.getFullPath(); } }
@Override public String toString() { String s = resource == null ? "null" : resource.getFullPath().toString(); //$NON-NLS-1$ return "Node: " + s; //$NON-NLS-1$ } }
private void ensureResourceCovered(IResource resource, List<IResource> list) { IPath path = resource.getFullPath(); for (IResource root : list) { if (root.getFullPath().isPrefixOf(path)) { return; } } list.add(resource); }
/** * Sets the resource that we are searching for aliases for. */ public void setSearchAlias(IResource aliasResource) { this.aliasType = aliasResource.getType(); this.searchPath = aliasResource.getFullPath(); } }
@Override public synchronized void deleteProperties(IResource target, int depth) throws CoreException { tree.accept(new PropertyBucket.Visitor() { @Override public int visit(Entry entry) { entry.delete(); return CONTINUE; } }, target.getFullPath(), depth == IResource.DEPTH_INFINITE ? BucketTree.DEPTH_INFINITE : depth); }
public static ClassFileReader newClassFileReader(IResource resource) throws CoreException, ClassFormatException, IOException { InputStream in = null; try { in = ((IFile) resource).getContents(true); return ClassFileReader.read(in, resource.getFullPath().toString()); } finally { if (in != null) in.close(); } }
private void attachWorkspaceFilesToResource(List<IJavaElement> elementsMappingOntoLocation, NdResourceFile resourceFile) { for (IJavaElement next : elementsMappingOntoLocation) { IResource nextResource = next.getResource(); if (nextResource != null) { new NdWorkspaceLocation(this.nd, resourceFile, nextResource.getFullPath().toString().toCharArray()); } } }
private IPath externalPath(IResource res) { IPath resourcePath = res.getFullPath(); if (ExternalFoldersManager.isInternalPathForExternalFolder(resourcePath)) return res.getLocation(); return resourcePath; }
/** * Returns true if this resource represents the project description file, and * false otherwise. */ protected boolean isProjectDescriptionFile(IResource resource) { return resource.getType() == IResource.FILE && resource.getFullPath().segmentCount() == 2 && resource.getName().equals(IProjectDescription.DESCRIPTION_FILE_NAME); }
/** * Refreshes the resource hierarchy with its children. In case of failure * adds an appropriate status to the resource tree's status. */ private void safeRefresh(IResource resource) { try { resource.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); } catch (CoreException ce) { IStatus status = new ResourceStatus(IStatus.ERROR, IResourceStatus.FAILED_DELETE_LOCAL, resource.getFullPath(), Messages.refresh_refreshErr, ce); failed(status); } }
@Override public String getText(Object element) { NonNLSElement nlsel= (NonNLSElement)element; String elementName= BasicElementLabels.getPathLabel(nlsel.cu.getResource().getFullPath(), false); return Messages.format( ActionMessages.FindStringsToExternalizeAction_foundStrings, new Object[] {Integer.valueOf(nlsel.count), elementName} ); } @Override
private static Change createDeleteChange(IResource resource) { Assert.isTrue(! (resource instanceof IWorkspaceRoot));//cannot be done Assert.isTrue(! (resource instanceof IProject)); //project deletion is handled by the workbench return new DeleteResourceChange(resource.getFullPath(), true); }
public String getName() { return Messages.format(RefactoringCoreMessages.CopyResourceString_copy, new String[]{getResource().getFullPath().toString(), getDestination().getName()}); } }
protected void copyResource(IResource source, IResource destination) throws CoreException { IPath destPath = destination.getFullPath(); try { source.copy(destPath, IResource.FORCE | IResource.DERIVED, null); } catch (CoreException e) { // handle the case when the source resource is deleted source.refreshLocal(0, null); if (!source.exists()) return; // source resource was deleted so skip it throw e; } Util.setReadOnly(destination, false); // just in case the original was read only }
ProposedResourceDelta getDelta(IResource resource) { ProposedResourceDelta delta = (ProposedResourceDelta) root.findMember(resource.getFullPath()); if (delta != null) { return delta; } ProposedResourceDelta parent = getDelta(resource.getParent()); delta = new ProposedResourceDelta(resource); parent.add(delta); return delta; }
public void addCopyDelta(IResource copy, CopyArguments arguments) { if (fIgnoreCount == 0) { IPath destination= ((IResource)arguments.getDestination()).getFullPath().append(copy.getName()); internalAdd(new CopyDescription(copy, destination)); } }
/** * {@inheritDoc} */ protected boolean isBusy(final Object element) { final ISynchronizationContext context= getContext(); final IResource resource= JavaModelProvider.getResource(element); if (context != null && resource != null) return context.getDiffTree().getProperty(resource.getFullPath(), IDiffTree.P_BUSY_HINT); return super.isBusy(element); }
/** * Creates a child node for a location in the file system. Does nothing and returns null if the location does not correspond to a valid file/folder. */ protected UnifiedTreeNode createChildNodeFromFileSystem(UnifiedTreeNode parent, IFileInfo info) { IPath childPath = parent.getResource().getFullPath().append(info.getName()); int type = info.isDirectory() ? IResource.FOLDER : IResource.FILE; IResource target = getWorkspace().newResource(childPath, type); return createNode(target, null, info, target.exists()); }
private RefactoringStatus checkTypesImportedInCu() throws CoreException { IImportDeclaration imp = getImportedType(fType.getCompilationUnit(), getNewElementName()); if (imp == null) { return null; } String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, new Object[] { getNewElementLabel(), BasicElementLabels.getPathLabel(fType.getCompilationUnit().getResource().getFullPath(), false) }); IJavaElement grandParent = imp.getParent().getParent(); if (grandParent instanceof ICompilationUnit) { return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp)); } return null; }