/** * @return the location or <code>null</code> */ private IPath getWorkspaceLocation() { return ResourcesPlugin.getWorkspace().getRoot().getLocation(); } }
public EclipseProjectAnalysisEngine(P project) { this.project = project; this.workspaceRootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); assert project != null; assert workspaceRootPath != null; }
public static Validator<File> nonWorkspaceFolderValidator(final String prefix) { final File workspaceDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(); return new Validator<File>() { @Override public Optional<String> validate(File file) { if (workspaceDir.equals(file)) { return Optional.of(NLS.bind(CoreMessages.ErrorMessage_0_WorkspaceDirectory, prefix)); } else { return Optional.absent(); } } }; }
private void verifyNoWorkspaceRootIsImported(File rootDir, IProgressMonitor monitor) { File workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(); if (rootDir.equals(workspaceRoot)) { throw new UnsupportedConfigurationException(String.format("Project %s location matches workspace root %s", rootDir.getName(), workspaceRoot.getAbsolutePath())); } }
private File newFolderLocation() { IPath workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); int appendedNumber = 0; File newFile = workspacePath.append("NewDotnetProject").toFile(); //$NON-NLS-1$ while (newFile.isDirectory()) { appendedNumber++; newFile = workspacePath.append("NewDotnetProject" + appendedNumber).toFile(); //$NON-NLS-1$ } return newFile; }
private String getWorkspaceRelativePath(String path) { String workspacePath = PDECore.getWorkspace().getRoot().getLocation().toString(); if (path.startsWith(workspacePath)) path = path.replaceFirst(workspacePath, ""); //$NON-NLS-1$ return path; }
/** * Determine if there is a directory with the project name in the workspace path. * * @param projectName the name of the project * @return true if there is a directory with the same name of the imported project */ private boolean isProjectInWorkspacePath(String projectName){ final IWorkspace workspace = ResourcesPlugin.getWorkspace(); IPath wsPath = workspace.getRoot().getLocation(); IPath localProjectPath = wsPath.append(projectName); return localProjectPath.toFile().exists(); }
static File getExpandDirectory(final File archive) { if (!isValidArchive(archive)) { throw new IllegalArgumentException("Input must be an archive"); //$NON-NLS-1$ } return new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), archive.getName() + "_expanded"); //$NON-NLS-1$ }
boolean isWorkspaceFolder(MavenProjectInfo info) { if(info != null) { File pomFile = info.getPomFile(); if(pomFile != null) { File parentFile = pomFile.getParentFile(); if(parentFile.getAbsolutePath().equals(workspaceRoot.getLocation().toFile().getAbsolutePath())) { return true; } } } return false; }
public static String getWorkspaceDirectory() { if (!alreadyComputeWorkspaceDirectory){ workspaceDirectory = ResourcesPlugin.getWorkspace().getRoot() .getLocation().toOSString(); alreadyComputeWorkspaceDirectory = true; } return workspaceDirectory; }
@Override public boolean applies(IProgressMonitor monitor) throws OperationCanceledException, CoreException { IPath workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); IPath rootPath = ResourceUtils.filePathFromURI(rootFolder.toPath().toUri().toString()); if (workspaceLocation.equals(rootPath)) { return false; } return ProjectUtils.getVisibleProjects(rootPath).isEmpty(); }
/** * Return the fully-qualifed native OS path of the workspace. e.g. * D:\eclipse\workspace */ public static String getWorkspacePath() { return AspectJPlugin.getWorkspace().getRoot().getLocation() .toOSString(); }
private CDOWorkspaceStore createWorkspaceStore(String name) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath location = root.getLocation().append(name); return new CDOWorkspaceStore(name, new File(location.toOSString())); } }
private IFileStore computeDestinationStore(IProjectDescription destDescription) throws CoreException { URI destLocation = destDescription.getLocationURI(); // Use the default area if necessary for the destination. if (destLocation == null) { IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); destLocation = rootLocation.append(destDescription.getName()).toFile().toURI(); } return EFS.getStore(destLocation); }
private IFileStore computeDestinationStore(IProjectDescription destDescription) throws CoreException { URI destLocation = destDescription.getLocationURI(); // Use the default area if necessary for the destination. if (destLocation == null) { IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); destLocation = rootLocation.append(destDescription.getName()).toFile().toURI(); } return EFS.getStore(destLocation); }
private String getDefaultLocation() { IPath path = ResourcesPlugin.getWorkspace().getRoot().getLocation(); String projectName = (String) getProperty(PROJECT_NAME); if (projectName != null) path = path.append(projectName); return path.toOSString(); }
/** * Get the OS specific full path for the given file * @param configFile * @return */ private static String getFileName(IFile configFile) { return ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString() + configFile.getFullPath().toOSString(); }
private boolean isDirectChildOfWorkspaceRootFolder(File location) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IPath rootLocationPath = workspace.getRoot().getLocation(); IPath locationPath = Path.fromOSString(location.getPath()); return rootLocationPath.equals(locationPath) || rootLocationPath.equals(locationPath.removeLastSegments(1)); }
/** * * @return IPath or null */ private IPath computeTargetPath() { IPath pluginsLocation = PDEPlugin.getWorkspace().getRoot().getLocation(); if ("plugins".equals(pluginsLocation.lastSegment())) //$NON-NLS-1$ return pluginsLocation.removeLastSegments(1).append("features"); //$NON-NLS-1$ return null; }
static public IResource findWorkspaceResource(IPath path) { IWorkspaceRoot ws = ResourcesPlugin.getWorkspace().getRoot(); IPath wsPath = ws.getLocation(); if (wsPath.isPrefixOf(path)) { path = path.removeFirstSegments(wsPath.segmentCount()); path = path.setDevice(null); } return ws.findMember(path); }