use of org.eclipse.core.resources.IResourceRuleFactory in project titan.EclipsePlug-ins by eclipse.
the class ProjectSourceParser method getSchedulingRule.
private ISchedulingRule getSchedulingRule() {
Deque<IProject> temporalList = new LinkedList<IProject>();
IProject[] tempProjects;
IProject tempProject;
List<IProject> projectTobeLocked = ProjectBasedBuilder.getProjectBasedBuilder(project).getAllReachableProjects();
for (Iterator<IProject> iterator = projectTobeLocked.iterator(); iterator.hasNext(); ) {
IProject temp = iterator.next();
if (GlobalParser.getProjectSourceParser(temp).getLastTimeChecked() != null) {
iterator.remove();
}
}
// analyze the project referencing the just now analyzed
// projects in a bottom up order.
temporalList.addLast(project);
projectTobeLocked.remove(project);
while (!temporalList.isEmpty()) {
tempProject = temporalList.getFirst();
temporalList.removeFirst();
if (!projectTobeLocked.contains(tempProject)) {
projectTobeLocked.add(tempProject);
tempProjects = ProjectBasedBuilder.getProjectBasedBuilder(tempProject).getReferencingProjects();
for (IProject tempProject2 : tempProjects) {
if (!GlobalParser.getProjectSourceParser(tempProject2).analyzesRunning) {
temporalList.addLast(tempProject2);
}
}
}
}
// Collect those projects that might be needed to do the correct
// analysis.
List<IProject> additionalRequired = new ArrayList<IProject>();
for (IProject project : projectTobeLocked) {
List<IProject> temp = ProjectBasedBuilder.getProjectBasedBuilder(project).getAllReachableProjects();
for (IProject temp2 : temp) {
// or not.
if (!projectTobeLocked.contains(temp2) && !additionalRequired.contains(temp2)) {
additionalRequired.add(temp2);
}
}
}
projectTobeLocked.addAll(additionalRequired);
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ISchedulingRule combinedRule = null;
for (IProject project : projectTobeLocked) {
combinedRule = MultiRule.combine(ruleFactory.createRule(project), combinedRule);
}
return combinedRule;
}
use of org.eclipse.core.resources.IResourceRuleFactory in project eclipse.jdt.ls by eclipse.
the class BaseDocumentLifeCycleHandler method getRule.
private ISchedulingRule getRule(Set<ICompilationUnit> units) {
ISchedulingRule result = null;
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
for (ICompilationUnit unit : units) {
if (unit.getResource() != null) {
ISchedulingRule rule = ruleFactory.createRule(unit.getResource());
result = MultiRule.combine(rule, result);
}
}
return result;
}
Aggregations