use of org.eclipse.core.resources.IWorkspace.ProjectOrder in project ow by vtst.
the class ProjectOrderManager method update.
public synchronized State update() throws CoreException {
State localState = this.state;
if (localState != null && !localState.dirty)
return localState;
OwJsDev.log("Computing project order");
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject[] projects = workspace.getRoot().getProjects();
ArrayList<IProject> projectsWithNature = new ArrayList<IProject>(projects.length);
for (IProject project : projects) {
if (project.isOpen() && project.hasNature(ClosureNature.NATURE_ID)) {
projectsWithNature.add(project);
}
}
ProjectOrder order = workspace.computeProjectOrder(projectsWithNature.toArray(projects));
HashMap<IProject, Integer> projectToIndex = new HashMap<IProject, Integer>();
for (int i = 0; i < order.projects.length; ++i) {
projectToIndex.put(order.projects[i], i);
}
localState = new State(projectToIndex);
this.state = localState;
return localState;
}
use of org.eclipse.core.resources.IWorkspace.ProjectOrder in project xtext-eclipse by eclipse.
the class JdtToBeBuiltComputer method updateProject.
@Override
public void updateProject(ToBeBuilt toBeBuilt, IProject project, IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 2);
if (progress.isCanceled()) {
throw new OperationCanceledException();
}
if (!project.isAccessible())
return;
IJavaProject javaProject = JavaCore.create(project);
if (javaProject.exists()) {
IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
progress.setWorkRemaining(roots.length);
final Map<String, Long> updated = Maps.newHashMap();
ProjectOrder orderedProjects = workspace.computeProjectOrder(workspace.getRoot().getProjects());
for (final IPackageFragmentRoot root : roots) {
if (progress.isCanceled())
throw new OperationCanceledException();
if (shouldHandle(root) && !isBuiltByUpstream(root, project, orderedProjects.projects)) {
Map<URI, IStorage> rootData = jdtUriMapperExtension.getAllEntries(root);
for (Map.Entry<URI, IStorage> e : rootData.entrySet()) if (uriValidator.canBuild(e.getKey(), e.getValue())) {
toBeBuilt.getToBeDeleted().add(e.getKey());
toBeBuilt.getToBeUpdated().add(e.getKey());
}
}
progress.worked(1);
}
synchronized (modificationStampCache) {
modificationStampCache.projectToModificationStamp.putAll(updated);
}
}
}
Aggregations