Class WorkbenchUtils


  • public final class WorkbenchUtils
    extends Object
    Various utilities related to IWorkbench
    • Method Detail

      • getActiveWorkbenchWindow

        public static org.eclipse.ui.IWorkbenchWindow getActiveWorkbenchWindow()
        Returns:
        The active workbench window; null can be returned.
      • selectAndReveal

        public static void selectAndReveal​(Object objects,
                                           org.eclipse.ui.IWorkbenchWindow workbenchWindow)
        Attempts to select and reveal the specified objects in all parts within the given workbench window's active page. Checks all parts in the active page to see if they implement ISetSelectionTarget, either directly or as an adapter. If so, tells the part to select and reveal the specified objects.
        NOTE: the 'select and reveal' operation is performed in asynchronous way withing Display.asyncExec(Runnable).
        Parameters:
        objects - a sinle object or an iterable/array of objects to select, if null or empty iterable/array nothing will happen.
        workbenchWindow - the window to select and reveal the objects, cannot be null.
        See Also:
        BasicNewResourceWizard.selectAndReveal(org.eclipse.core.resources.IResource)
      • selectAndReveal

        public static void selectAndReveal​(ISelection selection,
                                           org.eclipse.ui.IWorkbenchWindow workbenchWindow)
        Attempts to select and reveal the specified selection in all parts within the given workbench window's active page. Checks all parts in the active page to see if they implement ISetSelectionTarget, either directly or as an adapter. If so, tells the part to select and reveal the specified objects.
        NOTE: the 'select and reveal' operation is performed in asynchronous way withing Display.asyncExec(Runnable).
        Parameters:
        selection - a selection, cannot be null.
        workbenchWindow - the window to select and reveal the objects, cannot be null.
        See Also:
        BasicNewResourceWizard.selectAndReveal(org.eclipse.core.resources.IResource)
      • setPropertiesViewDefaultFocus

        public static void setPropertiesViewDefaultFocus​(org.eclipse.ui.IWorkbenchWindow workbenchWindow)
        Sets default focus for properties view, usually the focus is set to first editing control.
        Parameters:
        workbenchWindow - IWorkbenchWindow to which target properties view belong.