use of org.eclipse.egit.core.synchronize.IgnoreInGitSynchronizations in project egit by eclipse.
the class ResourceUtil method getResourceMappings.
/**
* This will query all model providers for those that are enabled on the
* given resource and list all mappings available for that resource.
*
* @param resource
* The resource for which we need the associated resource
* mappings.
* @param context
* Context from which remote content could be retrieved.
* @return All mappings available for that file.
*/
public static ResourceMapping[] getResourceMappings(@NonNull IResource resource, ResourceMappingContext context) {
final IModelProviderDescriptor[] modelDescriptors = ModelProvider.getModelProviderDescriptors();
final Set<ResourceMapping> mappings = new LinkedHashSet<ResourceMapping>();
for (IModelProviderDescriptor candidate : modelDescriptors) {
try {
final IResource[] resources = candidate.getMatchingResources(new IResource[] { resource });
if (resources.length > 0) {
// get mappings from model provider if there are matching resources
final ModelProvider model = candidate.getModelProvider();
IgnoreInGitSynchronizations adapter = model.getAdapter(IgnoreInGitSynchronizations.class);
if (adapter != null) {
continue;
}
final ResourceMapping[] modelMappings = model.getMappings(resource, context, new NullProgressMonitor());
for (ResourceMapping mapping : modelMappings) mappings.add(mapping);
}
} catch (CoreException e) {
Activator.logError(e.getMessage(), e);
}
}
return mappings.toArray(new ResourceMapping[mappings.size()]);
}
Aggregations