private void copyFileStores(final IFileStore[] stores, final IPath destinationPath, IProgressMonitor monitor) { // Checks only required if this is an exisiting container path. IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (root.exists(destinationPath)) { IContainer container = (IContainer) root .findMember(destinationPath); performFileImport(stores, container, monitor); } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
protected String computeDefaultFileName() { int count = 0; String fileName = defaultName + defaultFileExtension; IPath containerFullPath = getContainerFullPath(); if (containerFullPath != null) { while (true) { IPath path = containerFullPath.append(fileName); if (ResourcesPlugin.getWorkspace().getRoot().exists(path)) { count++; fileName = defaultName + count + defaultFileExtension; } else { break; } } } return fileName; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= ResourcesPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the container resource specified in the container name entry field, * or <code>null</code> if such a container does not exist in the workbench. * * @return the container resource specified in the container name entry field, * or <code>null</code> */ protected IContainer getSpecifiedContainer() { IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); IPath path = getContainerFullPath(); if (workspace.getRoot().exists(path)) { return (IContainer) workspace.getRoot().findMember(path); } return null; }
private CPListElement[] openJarFileDialog(CPListElement existing, Object parent) { if (existing == null) { return doOpenExternalJarFileDialog(existing, parent); } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IPath path = existing.getPath(); if (root.exists(path)) { return doOpenInternalJarFileDialog(existing, parent); } return doOpenExternalJarFileDialog(existing, parent); }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
private void createFolder(IPath folderPath) throws CoreException { if (project.getFullPath().equals(folderPath)) { return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); if (!workspaceRoot.exists(folderPath)) { IFolder folder = workspaceRoot.getFolder(folderPath); folder.create(IResource.FORCE, true, null); } }
private CPListElement[] openJarFileDialog(CPListElement existing, Object parent) { if (existing == null) { return doOpenExternalJarFileDialog(existing, parent); } IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IPath path = existing.getPath(); if (root.exists(path)) { return doOpenInternalJarFileDialog(existing, parent); } return doOpenExternalJarFileDialog(existing, parent); }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; }
/** * Returns the resource for the specified path. * * @param path the path for which the resource should be returned * @return the resource specified by the path or <code>null</code> */ protected IResource findResource(IPath path) { IWorkspace workspace= JavaPlugin.getWorkspace(); IStatus result= workspace.validatePath( path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE); if (result.isOK() && workspace.getRoot().exists(path)) return workspace.getRoot().findMember(path); return null; } }
private void removeOutputFile(IFile file, IProgressMonitor monitor) { String outputFileName = getOutputFileName(file); monitor.subTask(NLS.bind(PDECoreMessages.Builders_Schema_removing, outputFileName)); IWorkspace workspace = file.getWorkspace(); IPath path = new Path(outputFileName); if (workspace.getRoot().exists(path)) { IFile outputFile = workspace.getRoot().getFile(path); if (outputFile != null) { try { outputFile.delete(true, true, monitor); } catch (CoreException e) { PDECore.logException(e); } } } monitor.done(); } }
public IClasspathEntry[] newClasspathEntriesForArchive() { if( !archiveURI.equals("")){ String resourcePath = ""; try { resourcePath = ModuleURIUtil.getArchiveName(archiveURI); } catch (UnresolveableURIException e) { Logger.getLogger().logError(e); } IPath resPath = new Path(resourcePath); if (!resPath.isAbsolute()) resPath = resPath.makeAbsolute(); java.io.File file = new java.io.File(resourcePath); if( file.exists() || J2EEPlugin.getWorkspace().getRoot().exists(new Path(resourcePath))){ return new IClasspathEntry[]{JavaCore.newLibraryEntry( resPath, null, null, true)}; }else{ return new IClasspathEntry[]{JavaCore.newVariableEntry( resPath, null, null)}; } } return new IClasspathEntry[0]; }