Class PlatformElementUtil
java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil
This provides access to commonly used functions for platform elements, such as adaptation or file lookup.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TTries and adapt the given object to an instance of the given class.static org.eclipse.core.resources.IFilefindFile(org.eclipse.compare.ITypedElement element) Try and determine the resource of the given element.
-
Constructor Details
-
PlatformElementUtil
public PlatformElementUtil()
-
-
Method Details
-
findFile
public static org.eclipse.core.resources.IFile findFile(org.eclipse.compare.ITypedElement element) Try and determine the resource of the given element.- Parameters:
element- The element for which we need anIResource.- Returns:
- The resource corresponding to the given
elementif we could find it,nullotherwise.
-
adaptAs
Tries and adapt the given object to an instance of the given class.- Type Parameters:
T- Type to which we need to adapt object.- Parameters:
object- The object we need to coerce to a givenClass.clazz- Class to which we are to adapt object.- Returns:
- object cast to type T if possible,
nullif not.
-