private EclipseProject lookupEclipseModel(IProject project) { IPath path = project.getLocation(); if (path == null) { return null; } return this.locationToProject.get(path.toFile()); }
@Override public boolean apply(IProject project) { IPath location = project.getLocation(); // since Eclipse 3.4 projects can be non-local and they could return null locations // for Buildship this is not the case, Gradle projects are always available on the // local file system return location != null && location.toFile().equals(directory); } });
/** * Returns a File that corresponds to the absolute location of the project's * root directory. */ public File workingDirectory() { return project.getProject().getLocation().toFile(); }
@Override public int compare(IProject p1, IProject p2) { return p2.getLocation().toOSString().length() - p1.getLocation().toOSString().length(); } }).collect(Collectors.toList());
@Override protected IPath getLocation() { if (project == null || qualifier == null) return null; IPath path = project.getLocation(); return computeLocation(path, qualifier); }
public static boolean shouldSynchronize(File location) { boolean shouldSynchronize = true; List<IProject> projects = ProjectUtils.getGradleProjects(); for (IProject project : projects) { File projectDir = project.getLocation() == null ? null : project.getLocation().toFile(); if (location.equals(projectDir)) { shouldSynchronize = checkGradlePersistence(shouldSynchronize, project, projectDir); break; } } return shouldSynchronize; }
@Override public boolean select(Viewer viewer, Object parentElement, Object element) { Entry<IProject, List<ProjectConfigurator>> entry = (Entry<IProject, List<ProjectConfigurator>>) element; return entry.getKey().getLocation().toFile().getAbsolutePath().startsWith(job.getRoot().getAbsolutePath()); } } });
private void refreshProjectsList() { IProject[] knownProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); synchronized (locationsToProjects) { locationsToProjects.clear(); for (IProject project : knownProjects) { IPath location = project.getLocation(); if (location != null) { locationsToProjects.put(location, project); } } } }
@Override public ProjectConfiguration loadProjectConfiguration(IProject project) { String pathToRoot = this.buildConfigurationPersistence.readPathToRoot(project.getLocation().toFile()); File rootDir = relativePathToProjectRoot(project.getLocation(), pathToRoot); BuildConfiguration buildConfig = loadBuildConfiguration(rootDir); return new DefaultProjectConfiguration(project.getLocation().toFile(), buildConfig); }
public DefaultBuildConfigurationProperties readBuildConfiguratonProperties(IProject project) { Preconditions.checkNotNull(project); PreferenceStore preferences = PreferenceStore.forProjectScope(project, PREF_NODE); return readPreferences(preferences, project.getLocation().toFile()); }
private static boolean isScheduledForRenaming(IProject duplicate, Set<? extends EclipseProject> allProjects) { if (!duplicate.isOpen()) { return false; } Optional<? extends EclipseProject> duplicateEclipseProject = Iterables.tryFind(allProjects, eclipseProjectMatchesProjectDir(duplicate.getLocation().toFile())); if (!duplicateEclipseProject.isPresent()) { return false; } String newName = checkProjectName(duplicateEclipseProject.get()); return !newName.equals(duplicate.getName()); }
public static List<IProject> getVisibleProjects(IPath workspaceRoot) { List<IProject> projects = new ArrayList<>(); for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.exists() && isVisibleProject(project) && workspaceRoot.isPrefixOf(project.getLocation())) { projects.add(project); } } return projects; }
@Override public IPath getLocation() { IProject project = ((IResource) context).getProject(); IPath location = project.getLocation(); return location == null ? null : location.append(EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME); }
@Override public boolean apply(IProject project) { ProjectConfiguration projectConfiguration = CorePlugin.configurationManager().tryLoadProjectConfiguration(project); if (projectConfiguration != null) { BuildConfiguration buildConfiguration = projectConfiguration.getBuildConfiguration(); return buildConfiguration.getRootProjectDirectory().equals(SynchronizeGradleBuildOperation.this.gradleBuild.getBuildConfig().getRootProjectDirectory()) && (project.getLocation() == null || !gradleProjectDirectories.contains(project.getLocation().toFile())); } else { return false; } } }).toList();
@Override public void deleteProjectConfiguration(IProject project) { if (project.isAccessible()) { this.buildConfigurationPersistence.deletePathToRoot(project); } else { this.buildConfigurationPersistence.deletePathToRoot(project.getLocation().toFile()); } }
private String getDefaultAntPath(IJavaProject project) { if (project != null) { // The Javadoc.xml file can only be stored locally. So if // the project isn't local then we can't provide a good // default location. IPath path= project.getProject().getLocation(); if (path != null) return path.append("javadoc.xml").toOSString(); //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
public void initialize(IJavaProject project, IClasspathEntry[] currentEntries) { javaProject = project; model = Activator.getDefault().getCentral().getModel(project); basedir = project.getProject().getLocation().makeAbsolute().toFile(); }
private IPath getProjectPath() { String projName = (String)getProperty(FACET_PROJECT_NAME); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projName); if (project.exists()){ return project.getLocation(); } IDataModel projModel = (IDataModel)getProperty(MASTER_PROJECT_DM); if (projModel.getBooleanProperty(IProjectCreationPropertiesNew.USE_DEFAULT_LOCATION)){ return new Path(projModel.getStringProperty(IProjectCreationPropertiesNew.PROJECT_LOCATION)).append(projName); } return new Path(projModel.getStringProperty(IProjectCreationPropertiesNew.USER_DEFINED_LOCATION)).append(projName); }
public static boolean isVisibleProject(IProject project) { PreferenceManager manager = JavaLanguageServerPlugin.getPreferencesManager(); Collection<IPath> rootPaths = manager.getPreferences().getRootPaths(); if (rootPaths == null) { return false; } return ResourceUtils.isContainedIn(project.getLocation(), rootPaths); }
private static IResource tryFindWorkspaceFile(InternalGradleBuild gradleBuild, Path filePath) { for (IProject project : getWorkspaceProjectsFor(gradleBuild)) { IPath projectLocation = project.getLocation(); if (projectLocation.isPrefixOf(filePath)) { IFile file = project.getFile(filePath.makeRelativeTo(projectLocation)); if (file.exists()) { return file; } } } return null; }