Class PlatformElementUtil
- java.lang.Object
-
- org.eclipse.emf.compare.ide.ui.internal.util.PlatformElementUtil
-
public class PlatformElementUtil extends Object
This provides access to commonly used functions for platform elements, such as adaptation or file lookup.
-
-
Constructor Summary
Constructors Constructor Description PlatformElementUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
adaptAs(Object object, Class<T> clazz)
Tries and adapt the given object to an instance of the given class.static org.eclipse.core.resources.IFile
findFile(org.eclipse.compare.ITypedElement element)
Try and determine the resource of the given element.
-
-
-
Method Detail
-
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
element
if we could find it,null
otherwise.
-
adaptAs
public static <T> T adaptAs(Object object, Class<T> clazz)
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,
null
if not.
-
-