use of org.eclipse.core.resources.IResourceRuleFactory in project egit by eclipse.
the class RuleUtil method getRuleForContainers.
/**
* Calculates a {@link ISchedulingRule} for all containers of the paths that
* are in the workspace.
*
* @param paths
* @return scheduling rule
*/
public static ISchedulingRule getRuleForContainers(Collection<IPath> paths) {
List<ISchedulingRule> rules = new ArrayList<ISchedulingRule>();
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
for (IPath path : paths) {
IResource resource = ResourceUtil.getResourceForLocation(path, false);
if (resource != null) {
IContainer container = resource.getParent();
ISchedulingRule rule = ruleFactory.modifyRule(container);
if (rule != null)
rules.add(rule);
}
}
if (rules.size() == 0)
return null;
else
return new MultiRule(rules.toArray(new ISchedulingRule[rules.size()]));
}
use of org.eclipse.core.resources.IResourceRuleFactory in project whole by wholeplatform.
the class WorkspaceDecorationManager method addDecoration.
public void addDecoration(DecorationKind kind, final IEntity entity, final String message, final String location) {
final int severity = getSeverity(kind);
if (resource != null && severity != -1) {
try {
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
MarkerUtils.addMarker(resource, severity, message, entity, location);
}
}, ruleFactory.markerRule(resource), 0, monitor);
} catch (CoreException e) {
}
}
}
use of org.eclipse.core.resources.IResourceRuleFactory in project titan.EclipsePlug-ins by eclipse.
the class MergeLog method refreshOutputFilesAsync.
private void refreshOutputFilesAsync(final IFile[] outputFiles) {
final WorkspaceJob mergeJob = new WorkspaceJob("Refreshing output file information") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) {
if (outputFiles != null) {
ResourceUtils.refreshResources(Arrays.asList(outputFiles));
for (IFile file : outputFiles) {
ResourceUtils.setPersistentProperty(file, MERGED_FILE_PROPERTY.getQualifier(), MERGED_FILE_PROPERTY.getLocalName(), true);
}
}
return Status.OK_STATUS;
}
};
final IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ISchedulingRule combinedRule = null;
for (final IFile file : outputFiles) {
combinedRule = MultiRule.combine(ruleFactory.createRule(file), combinedRule);
}
mergeJob.setRule(combinedRule);
mergeJob.setPriority(Job.LONG);
mergeJob.setUser(true);
mergeJob.setProperty(IProgressConstants.ICON_PROPERTY, ImageCache.getImageDescriptor("titan.gif"));
mergeJob.schedule();
}
use of org.eclipse.core.resources.IResourceRuleFactory in project titan.EclipsePlug-ins by eclipse.
the class MergeLog method createSchedulingRule.
private ISchedulingRule createSchedulingRule(final List<IFile> files) {
final IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ISchedulingRule combinedRule = null;
for (final IFile file : files) {
combinedRule = MultiRule.combine(ruleFactory.createRule(file), combinedRule);
}
return combinedRule;
}
use of org.eclipse.core.resources.IResourceRuleFactory in project titan.EclipsePlug-ins by eclipse.
the class ConfigurationManagerControl method changeActualConfiguration.
/**
* Changes the actually used configuration to the one being selected in
* the configuration selector. Also loads all of the settings of the new
* configuration into the project.
*/
public void changeActualConfiguration() {
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ISchedulingRule rule = ruleFactory.createRule(project);
try {
Job.getJobManager().beginRule(rule, new NullProgressMonitor());
actualConfiguration = configurations.getText();
final HashSet<IResource> changedResources = new HashSet<IResource>();
final Document document = ProjectDocumentHandlingUtility.getDocument(project);
Node configurationNode = ProjectFileHandler.findConfigurationNode(document.getDocumentElement(), actualConfiguration);
if (actualConfiguration == null) {
ErrorReporter.logError("The configuration `" + actualConfiguration + "' for project `" + project.getName() + "' does not exist.");
} else {
ProjectFileHandler fileHandler = new ProjectFileHandler(project);
fileHandler.loadProjectInfoFromNode(configurationNode, changedResources);
}
} finally {
Job.getJobManager().endRule(rule);
}
}
Aggregations