Class LegacyResourceSupport
-
Method Summary
Modifier and TypeMethodDescriptionstatic IStructuredSelectionadaptSelection(IStructuredSelection selection, String objectClass) Adapts a selection to the given objectClass considering the Legacy resource support.static ObjectgetAdaptedContributorResource(Object object) Returns the adapted resource using theIContributorResourceAdapterregistered for the given object.static ObjectReturns the adapted resource mapping using theIContributorResourceAdapter2registered for the given object.static ObjectgetAdaptedResource(Object element) Adapt the given element to anIResourceusing the following search order: using the IContributorResourceAdapter registered for the given element, or directly asking the element if it adapts.static ObjectgetAdaptedResourceMapping(Object element) Adapt the given element to anResourceMappingusing the following search order: using the IContributorResourceAdapter2 registered for the given element, or directly asking the element if it adapts.static ObjectgetAdapter(Object element, String objectClass) Adapts an object to a specified objectClass considering the Legacy resource support.static Class<?> ReturnsDefaultContributorResourceAdapter.classornullif the class is not available.static Class<?> ReturnsIFile.classornullif the class is not available.static Class<?> ReturnsIContributorResourceAdapter2.classornullif the class is not available.static Class<?> ReturnsIContributorResourceAdapter.classornullif the class is not available.static Class<?> ReturnsIResource.classornullif the class is not available.static Class<?> ReturnsResourceMapping.classornullif the class is not available.static booleanisResourceMappingType(String objectClassName) Returnstrueif the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping", andfalseotherwise.static booleanisResourceType(String objectClassName) Returnstrueif the provided type name is anIResource, andfalseotherwise.
-
Method Details
-
getFileClass
ReturnsIFile.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
IFile.classornullif class not available- Since:
- 3.1
-
getResourceClass
ReturnsIResource.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
IResource.classornullif class not available- Since:
- 3.0
-
getResourceMappingClass
ReturnsResourceMapping.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
ResourceMapping.classornullif class not available- Since:
- 3.1
-
getIContributorResourceAdapterClass
ReturnsIContributorResourceAdapter.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
IContributorResourceAdapter.classornullif class not available- Since:
- 3.0
-
getIContributorResourceAdapter2Class
ReturnsIContributorResourceAdapter2.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
IContributorResourceAdapter.classornullif class not available- Since:
- 3.1
-
getDefaultContributorResourceAdapterClass
ReturnsDefaultContributorResourceAdapter.classornullif the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
DefaultContributorResourceAdapter.classornullif class not available- Since:
- 3.0
-
isResourceType
Returnstrueif the provided type name is anIResource, andfalseotherwise.- Returns:
trueif the provided type name is anIResource, andfalseotherwise.- Since:
- 3.1
-
isResourceMappingType
Returnstrueif the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping", andfalseotherwise.- Returns:
trueif the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping", andfalseotherwise.- Since:
- 3.1
-
getAdaptedContributorResource
Returns the adapted resource using theIContributorResourceAdapterregistered for the given object. If the Resources plug-in is not loaded the object can not be adapted.- Parameters:
object- the object to adapt toIResource.- Returns:
- returns the adapted resource using the
IContributorResourceAdapterornullif the Resources plug-in is not loaded. - Since:
- 3.1
-
getAdaptedContributorResourceMapping
Returns the adapted resource mapping using theIContributorResourceAdapter2registered for the given object. If the Resources plug-in is not loaded the object can not be adapted.- Parameters:
object- the object to adapt toResourceMapping.- Returns:
- returns the adapted resource using the
IContributorResourceAdapter2ornullif the Resources plug-in is not loaded. - Since:
- 3.1
-
adaptSelection
public static IStructuredSelection adaptSelection(IStructuredSelection selection, String objectClass) Adapts a selection to the given objectClass considering the Legacy resource support. Non resource objectClasses are adapted using theIAdapterManagerand this may load the plug-in that contributes the adapter factory.The returned selection will only contain elements successfully adapted.
- Parameters:
selection- the selection to adaptobjectClass- the class name to adapt the selection to- Returns:
- an adapted selection
- Since:
- 3.1
-
getAdapter
Adapts an object to a specified objectClass considering the Legacy resource support. Non resource objectClasses are adapted using theIAdapterManagerand this may load the plug-in that contributes the adapter factory.The returned selection will be of the same size as the original, and elements that could not be adapted are added to the returned selection as is.
- Parameters:
element- the element to adaptobjectClass- the class name to adapt the selection to- Returns:
- an adapted element or
nullif the element could not be adapted. - Since:
- 3.1
-
getAdaptedResource
Adapt the given element to anIResourceusing the following search order:- using the IContributorResourceAdapter registered for the given element, or
- directly asking the element if it adapts.
- Parameters:
element- the element to adapt- Returns:
- an
IResourceinstance if the element could be adapted ornullotherwise. - Since:
- 3.1
-
getAdaptedResourceMapping
Adapt the given element to anResourceMappingusing the following search order:- using the IContributorResourceAdapter2 registered for the given element, or
- directly asking the element if it adapts.
- Parameters:
element- the element to adapt- Returns:
- an
ResourceMappinginstance if the element could be adapted ornullotherwise. - Since:
- 3.1
-