Class SelectionContextObject


  • public final class SelectionContextObject
    extends Object
    Utility method to retrieve context object from the given selection.
    Restriction:
    This class is not intended to be sub-classed by clients.
    • Method Detail

      • getContextObject

        public static org.eclipse.emf.ecore.EObject getContextObject​(org.eclipse.ui.IWorkbenchPage page)
        Retrieve current workbench page context object. Can return null, if cannot retrieve.
        Parameters:
        page - the workbench page to retrieve object from, cannot be null
        Returns:
        current workbench page context object or null if cannot retrieve
      • getContextObject

        public static org.eclipse.emf.ecore.EObject getContextObject​(ISelection selection)
        Retrieve current selection context object. Can return null, if cannot retrieve.
        Parameters:
        selection - the selection to retrieve object from, if given selection is null, method will return null
        Returns:
        current selection context object or null if cannot retrieve
      • getContextObject

        public static org.eclipse.emf.ecore.EObject getContextObject​(org.eclipse.ui.IEditorPart editorpart)
        Retrieve current editor part context object. Can return null if cannot retrieve.
        Parameters:
        editorpart - the editor part to retrieve object from, cannot be null
        Returns:
        current editor context object or null if cannot retrieve
      • getContextApplication

        public static IApplication getContextApplication​(ISelection selection)
        Retrieve current selection context application. Can return null, if cannot retrieve.
        Parameters:
        selection - the selection to retrieve application from, if given selection is null, method will return null
        Returns:
        current selection context application or null if cannot retrieve