Class LegacyResourceSupport
-
Method Summary
Modifier and TypeMethodDescriptionstatic IStructuredSelection
adaptSelection
(IStructuredSelection selection, String objectClass) Adapts a selection to the given objectClass considering the Legacy resource support.static Object
getAdaptedContributorResource
(Object object) Returns the adapted resource using theIContributorResourceAdapter
registered for the given object.static Object
Returns the adapted resource mapping using theIContributorResourceAdapter2
registered for the given object.static Object
getAdaptedResource
(Object element) Adapt the given element to anIResource
using the following search order: using the IContributorResourceAdapter registered for the given element, or directly asking the element if it adapts.static Object
getAdaptedResourceMapping
(Object element) Adapt the given element to anResourceMapping
using the following search order: using the IContributorResourceAdapter2 registered for the given element, or directly asking the element if it adapts.static Object
getAdapter
(Object element, String objectClass) Adapts an object to a specified objectClass considering the Legacy resource support.static Class<?>
ReturnsDefaultContributorResourceAdapter.class
ornull
if the class is not available.static Class<?>
ReturnsIFile.class
ornull
if the class is not available.static Class<?>
ReturnsIContributorResourceAdapter2.class
ornull
if the class is not available.static Class<?>
ReturnsIContributorResourceAdapter.class
ornull
if the class is not available.static Class<?>
ReturnsIResource.class
ornull
if the class is not available.static Class<?>
ReturnsResourceMapping.class
ornull
if the class is not available.static boolean
isResourceMappingType
(String objectClassName) Returnstrue
if the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping"
, andfalse
otherwise.static boolean
isResourceType
(String objectClassName) Returnstrue
if the provided type name is anIResource
, andfalse
otherwise.
-
Method Details
-
getFileClass
ReturnsIFile.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
IFile.class
ornull
if class not available- Since:
- 3.1
-
getResourceClass
ReturnsIResource.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
IResource.class
ornull
if class not available- Since:
- 3.0
-
getResourceMappingClass
ReturnsResourceMapping.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the resources plug-in.
- Returns:
ResourceMapping.class
ornull
if class not available- Since:
- 3.1
-
getIContributorResourceAdapterClass
ReturnsIContributorResourceAdapter.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
IContributorResourceAdapter.class
ornull
if class not available- Since:
- 3.0
-
getIContributorResourceAdapter2Class
ReturnsIContributorResourceAdapter2.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
IContributorResourceAdapter.class
ornull
if class not available- Since:
- 3.1
-
getDefaultContributorResourceAdapterClass
ReturnsDefaultContributorResourceAdapter.class
ornull
if the class is not available.This method exists to avoid explicit references from the generic workbench to the IDE plug-in.
- Returns:
DefaultContributorResourceAdapter.class
ornull
if class not available- Since:
- 3.0
-
isResourceType
Returnstrue
if the provided type name is anIResource
, andfalse
otherwise.- Returns:
true
if the provided type name is anIResource
, andfalse
otherwise.- Since:
- 3.1
-
isResourceMappingType
Returnstrue
if the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping"
, andfalse
otherwise.- Returns:
true
if the provided type name is an"org.eclipse.core.resources.mapping.ResourceMapping"
, andfalse
otherwise.- Since:
- 3.1
-
getAdaptedContributorResource
Returns the adapted resource using theIContributorResourceAdapter
registered 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
IContributorResourceAdapter
ornull
if the Resources plug-in is not loaded. - Since:
- 3.1
-
getAdaptedContributorResourceMapping
Returns the adapted resource mapping using theIContributorResourceAdapter2
registered 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
IContributorResourceAdapter2
ornull
if 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 theIAdapterManager
and 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 theIAdapterManager
and 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
null
if the element could not be adapted. - Since:
- 3.1
-
getAdaptedResource
Adapt the given element to anIResource
using 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
IResource
instance if the element could be adapted ornull
otherwise. - Since:
- 3.1
-
getAdaptedResourceMapping
Adapt the given element to anResourceMapping
using 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
ResourceMapping
instance if the element could be adapted ornull
otherwise. - Since:
- 3.1
-