Class DtHandlerUtil


  • public final class DtHandlerUtil
    extends Object
    Extension for HandlerUtil.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.emf.ecore.EStructuralFeature featureFromString​(String featureAsString)
      Try to get EStructuralFeature from given feature string representation.
      static String featureToString​(org.eclipse.emf.ecore.EStructuralFeature feature)
      Convert given EStructuralFeature to string representation.
      static <T extends org.eclipse.ui.IEditorPart>
      T
      getActiveEditor​(Object ctx, Class<T> editorClass_)
      Return the active editor taking into account pages of MultiPageEditorParts.
      static <T extends org.eclipse.ui.IEditorPart>
      T
      getActiveEditor​(org.eclipse.core.commands.ExecutionEvent event, Class<T> editorClass_)
      Return the active editor taking into account pages of MultiPageEditorParts.
      static Optional<org.eclipse.ui.IWorkbenchPartSite> getActivePartSite()
      Finds and returns active IWorkbenchPartSite.
      static <T extends org.eclipse.ui.IEditorPart>
      T
      getActiveWorkbenchEditor​(Class<T> editorClass_)
      Return the active workbench editor taking into account pages of MultiPageEditorParts.
      static <T extends org.eclipse.ui.IEditorPart>
      T
      getActualEditor​(Object editor, Class<T> editorClass_)  
      static boolean getToggleCommandState​(org.eclipse.core.commands.Command command)
      Gets the state of the given toggle command.
      static void setToggleCommandState​(org.eclipse.core.commands.Command command, boolean value)
      Sets the state of the toggle command.
    • Method Detail

      • getToggleCommandState

        public static boolean getToggleCommandState​(org.eclipse.core.commands.Command command)
        Gets the state of the given toggle command.
        Parameters:
        command - command to check.
        Returns:
        the state of the command.
      • setToggleCommandState

        public static void setToggleCommandState​(org.eclipse.core.commands.Command command,
                                                 boolean value)
        Sets the state of the toggle command.
        Parameters:
        command - command to set the state of.
        value - new state.
      • getActiveEditor

        public static <T extends org.eclipse.ui.IEditorPart> T getActiveEditor​(org.eclipse.core.commands.ExecutionEvent event,
                                                                               Class<T> editorClass_)
        Return the active editor taking into account pages of MultiPageEditorParts.
        Parameters:
        event - The execution event that contains the application context
        editorClass_ - target editor class.
        Returns:
        the active editor, or null.
      • getActiveEditor

        public static <T extends org.eclipse.ui.IEditorPart> T getActiveEditor​(Object ctx,
                                                                               Class<T> editorClass_)
        Return the active editor taking into account pages of MultiPageEditorParts.
        Parameters:
        ctx - The IEvaluationContext or null
        editorClass_ - target editor class.
        Returns:
        the active editor, or null.
      • getActiveWorkbenchEditor

        public static <T extends org.eclipse.ui.IEditorPart> T getActiveWorkbenchEditor​(Class<T> editorClass_)
        Return the active workbench editor taking into account pages of MultiPageEditorParts.
        Parameters:
        editorClass_ - target editor class.
        Returns:
        the active editor, or null.
      • getActivePartSite

        public static Optional<org.eclipse.ui.IWorkbenchPartSite> getActivePartSite()
        Finds and returns active IWorkbenchPartSite.
        Returns:
        IWorkbenchPartSite or Optional.empty() if not found
      • getActualEditor

        public static <T extends org.eclipse.ui.IEditorPart> T getActualEditor​(Object editor,
                                                                               Class<T> editorClass_)
      • featureToString

        public static String featureToString​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Convert given EStructuralFeature to string representation.
        Parameters:
        EStructuralFeature - the EStructuralFeature instance, cannot be null
        Returns:
        string representation, cannot be null
      • featureFromString

        public static org.eclipse.emf.ecore.EStructuralFeature featureFromString​(String featureAsString)
        Try to get EStructuralFeature from given feature string representation.
        Parameters:
        featureAsString - the string representation of EStructuralFeature, cannot be null
        Returns:
        instance of EStructuralFeature, or null if cannot find feature by given string representation