private void addFolder(Set selectedElements, Element element) throws IOException { IPath path= getPath(element); if (path != null) { IFolder folder= JavaPlugin.getWorkspace().getRoot().getFolder(path); if (folder != null) selectedElements.add(folder); } }
private void addFolder(Set<IAdaptable> selectedElements, Element element) throws IOException { IPath path= getPath(element); if (path != null) { IFolder folder= JavaPlugin.getWorkspace().getRoot().getFolder(path); if (folder != null) selectedElements.add(folder); } }
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); }
/** * Creates a folder resource handle for the folder with the given workspace path. * * @param folderPath the path of the folder to create a handle for * @return the new folder resource handle */ private IFolder createFolderHandle(IPath folderPath) { if (folderPath.isValidPath(folderPath.toString()) && folderPath.segmentCount() >= 2) return JavaPlugin.getWorkspace().getRoot().getFolder(folderPath); else return null; }
/** * Creates a folder resource handle for the folder with the given workspace path. * * @param folderPath the path of the folder to create a handle for * @return the new folder resource handle */ protected IFolder createFolderHandle(IPath folderPath) { if (folderPath.isValidPath(folderPath.toString()) && folderPath.segmentCount() >= 2) return JavaPlugin.getWorkspace().getRoot().getFolder(folderPath); else return null; }
/** * Creates a folder resource handle for the folder with the given workspace path. * * @param folderPath the path of the folder to create a handle for * @return the new folder resource handle */ private IFolder createFolderHandle(IPath folderPath) { if (folderPath.isValidPath(folderPath.toString()) && folderPath.segmentCount() >= 2) return JavaPlugin.getWorkspace().getRoot().getFolder(folderPath); else return null; }
public IResource createResourceHandle() { IWorkspaceRoot workspaceRoot = getWorkspace().getRoot(); IPath folderPath = parent.getFullPath().append(name); return workspaceRoot.getFolder(folderPath); }
@Override public IResource createResourceHandle() { IWorkspaceRoot workspaceRoot = getWorkspace().getRoot(); IPath folderPath = parent.getFullPath().append(name); return workspaceRoot.getFolder(folderPath); }
protected String toRelativePath(URI uri) { String relativePath = null; if (uri.isPlatformResource()) { IFolder folder = EcorePlugin.getWorkspaceRoot().getFolder((IPath) toPath(uri)); relativePath = folder.getProjectRelativePath().toString() + File.separator; } else { relativePath = new File(getConfiguration().getProjectFolder().toFileString()).toURI().relativize( new File(uri.toFileString()).toURI()).getPath(); relativePath = relativePath + File.separator; } return relativePath; }
private IFolder computeTargetFolder(IPackageFragment rootPackage, RenameArguments args, IPackageFragment pack) { IPath path= pack.getParent().getPath(); path= path.append(getNewPackageName(rootPackage, args.getNewName(), pack.getElementName()).replace('.', IPath.SEPARATOR)); IFolder target= ResourcesPlugin.getWorkspace().getRoot().getFolder(path); return target; }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
private IFolder computeTargetFolder(IPackageFragment rootPackage, RenameArguments args, IPackageFragment pack) { IPath path= pack.getParent().getPath(); path= path.append(getNewPackageName(rootPackage, args.getNewName(), pack.getElementName()).replace('.', IPath.SEPARATOR)); IFolder target= ResourcesPlugin.getWorkspace().getRoot().getFolder(path); return target; }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
private IFolder computeTargetFolder(IPackageFragment rootPackage, RenameArguments args, IPackageFragment pack) { IPath path= pack.getParent().getPath(); path= path.append(getNewPackageName(rootPackage, args.getNewName(), pack.getElementName()).replace('.', IPath.SEPARATOR)); IFolder target= ResourcesPlugin.getWorkspace().getRoot().getFolder(path); return target; }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
/** * The path is known to match a source/library folder entry. * @param path IPath * @return IPackageFragmentRoot */ public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) { if (path.segmentCount() == 1) { // default project root return getPackageFragmentRoot(this.project); } return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path)); }
protected void mkdirs(IPath path, IWorkspaceRoot root) throws CoreException { if (path.segmentCount() <= 1) return; IFolder folder = root.getFolder(path); if (!folder.exists()) { mkdirs(path.removeLastSegments(1), root); folder.create(true, true, null); } }
protected void mkFolders(IPath newPath, IWorkspaceRoot root) throws CoreException { if (newPath.segmentCount() <= 1) return; IFolder folder = root.getFolder(newPath); IPath parentPath = newPath.removeLastSegments(1); if (!folder.exists()) { mkFolders(parentPath, root); folder.create(true, true, null); } } /**