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 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 an IResource.
      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 given Class.
      clazz - Class to which we are to adapt object.
      Returns:
      object cast to type T if possible, null if not.