Class ContentUtil

java.lang.Object
com._1c.g5.v8.dt.ui.util.ContentUtil

public final class ContentUtil extends Object
Utilities to work with content aspects of Navigator adapters.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EStructuralFeature,ISelection>
    createEditorContext(org.eclipse.emf.common.util.URI uri)
    Creates context for editor by any URI supported by DT.
    static IDtEditorInput<?>
    createGranularEditorInput(org.eclipse.core.resources.IFile file)
    Creates granular editor input by file in project.
    static IDtEditorInput<?>
    createGranularEditorInput(org.eclipse.emf.common.util.URI uri)
    Creates granular editor input by file URI.
    static <T extends org.eclipse.emf.ecore.EObject>
    T
    getActualObject(T object)
    Obtains the actual state of the given object from its engine.
    static Object[]
    Obtains children of a given element.
    static org.eclipse.emf.ecore.EStructuralFeature
    getFeature(Object element)
    Obtains model feature for a given element.
    static org.eclipse.emf.ecore.EObject
    getModel(Object element)
    Obtains model for a given element.
    static org.eclipse.ui.model.IWorkbenchAdapter
    Obtains Navigator adapter for a given element.
    static Object
    getParent(Object element)
    Obtains parent of a given element.
    static boolean
    isAliveObject(org.eclipse.emf.ecore.EObject object)
    Checks the specified object is alive.
    For IBmObject it means the object has running engine instance and the object obtained by the specified object id is not null.
    For native EObject it means the object is not proxy.
    For null reference passed as object it returns false.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getActualObject

      public static <T extends org.eclipse.emf.ecore.EObject> T getActualObject(T object)
      Obtains the actual state of the given object from its engine.

      The object itself will be returned if the given object is:

      • not the instance of IBmObject
      • not attached to engine, i.e. object is transient
      • attached to transaction
      Parameters:
      object - the object to obtain the actual state.
      Returns:
      the object with the actual state. Can be null in case if the corresponding BM model isn't available
    • isAliveObject

      public static boolean isAliveObject(org.eclipse.emf.ecore.EObject object)
      Checks the specified object is alive.
      For IBmObject it means the object has running engine instance and the object obtained by the specified object id is not null.
      For native EObject it means the object is not proxy.
      For null reference passed as object it returns false.
      Parameters:
      object - the instance or null.
      Returns:
      true if the specified obect is alive, false - otherwise.
    • getNavigatorAdapter

      public static org.eclipse.ui.model.IWorkbenchAdapter getNavigatorAdapter(Object element)
      Obtains Navigator adapter for a given element.
      Parameters:
      element - element to obtain adapter for.
      Returns:
      obtained adapter or null if there is no adapter.
    • getParent

      public static Object getParent(Object element)
      Obtains parent of a given element.
      Parameters:
      element - element to obtain parent of.
      Returns:
      obtained parent or null if element has no parent or parent couldn't be obtained.
    • getChildren

      public static Object[] getChildren(Object element)
      Obtains children of a given element.
      Parameters:
      element - element to obtain children of.
      Returns:
      obtained children or null if children couldn't be obtained.
    • getModel

      public static org.eclipse.emf.ecore.EObject getModel(Object element)
      Obtains model for a given element.
      Parameters:
      element - element to obtain model for.
      Returns:
      obtained model or null if model couldn't be obtained.
    • getFeature

      public static org.eclipse.emf.ecore.EStructuralFeature getFeature(Object element)
      Obtains model feature for a given element.
      Parameters:
      element - element to obtain feature for.
      Returns:
      obtained feature or null if feature couldn't be obtained.
    • createEditorContext

      public static org.eclipse.xtext.util.Triple<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EStructuralFeature,ISelection> createEditorContext(org.eclipse.emf.common.util.URI uri)
      Creates context for editor by any URI supported by DT. This context may be useful for editor input construction. Context consists of three parts:
      • Context object - determines editor type and content
      • Feature - determines what page in editor to open
      • Selection - selection to set
      Parameters:
      uri - the uri of the platform resource/DT object (not null)
      Returns:
      context as triple, never null. If any part of context (Context object, feature or selection) cannot be retrieved that part will be null in resulting triple.
    • createGranularEditorInput

      public static IDtEditorInput<?> createGranularEditorInput(org.eclipse.emf.common.util.URI uri)
      Creates granular editor input by file URI.
      Parameters:
      uri - the file URI in project (not null)
      Returns:
      granular editor input or null if editor cannot be created by given uri
      See Also:
    • createGranularEditorInput

      public static IDtEditorInput<?> createGranularEditorInput(org.eclipse.core.resources.IFile file)
      Creates granular editor input by file in project.
      Parameters:
      file - the file in project (not null)
      Returns:
      granular editor input or null if editor cannot be created by given file
      See Also: