Class Work

java.lang.Object
com.eco.bio7.collection.Work

public class Work extends Object
This class offers some methods for the control of the views, perspectives and the editor area of the Bio7 application.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Activates the view with the specified id.
    static void
    Closes the current perspective.
    static boolean
    Closes an open perspective of the active workbench window, e.g., closePerspective("com.eco.bio7.perspective_3d") or closePerspective("3d").
    static void
    Closes the view with the specified id.
    static void
    Execute an registered command.
    static org.eclipse.jface.preference.IPreferenceStore
    A method to get the preferences store for different custom Bio7 editors.
    static org.eclipse.jface.preference.IPreferenceStore
    getStore(String storePref)
    A method to get the main preferences store for Bio7.
    static boolean
    Returns true if the Bio7 window is displayed in fullscreen mode.
    static boolean
    Returns true if the main toolbar of the Bio7 window is visible.
    static void
    moveViewToPanel(CustomView customView, String viewId, String panelLocation, String newTitle)
    Moves an Eclipse workbench view into a custom Bio7 panel by reparenting its SWT widget tree.
    static void
    Opens the specified view and maximizes it.
    static void
    Opens the perspective with the specified id.
    static void
     
    static void
    Opens the view with the specified id.
    static void
    Refreshes all workspaces.
    static void
    renamePanelTab(org.eclipse.swt.widgets.Composite panelComposite, String newTitle)
    Changes the tab title of the CustomView panel that contains the given composite.
    static void
    setEditorAreaVisible(boolean visible)
    Show or hides the editor area according to a boolean value.
    static void
    setFullscreen(boolean fullscreen)
    Displays the Bio7 window in fullscreen mode or returns to the normal mode.
    static void
    setMainToolbarVisible(boolean visible)
    Shows or hides the main toolbar of the Bio7 window (the actions and the perspective switcher).
    static void
    Shows or hides the editor area.
    static void
    Displays the Bio7 window in fullscreen mode or returns to the normal mode.
    static void
    Shows the main toolbar of the Bio7 window if it is hidden, otherwise hides it.

    Methods inherited from class Object

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

    • Work

      public Work()
  • Method Details

    • openView

      public static void openView(String id)
      Opens the view with the specified id.
      Parameters:
      id - the id as a string value.
    • moveViewToPanel

      public static void moveViewToPanel(CustomView customView, String viewId, String panelLocation, String newTitle)
      Moves an Eclipse workbench view into a custom Bio7 panel by reparenting its SWT widget tree.

      The view is first opened the regular way in the Eclipse workbench (openView(String)). Asynchronously on the UI thread, the method then retrieves the view's e4 part model (MPart) from the part site and takes its widget — the composite the workbench passed to createPartControl(). All children of that composite (i.e. the view's actual UI) are reparented into the target Bio7 panel, a layout pass is forced, and the now-empty original view tab is hidden in the workbench.

      Note: Reparenting relies on Control.setParent(Composite), which requires platform support for reparenting. Requires a dependency on the e4 workbench model bundle (org.eclipse.e4.ui.model.workbench).

      Parameters:
      customView - the Bio7 CustomView providing the target panels; if null, the method returns without effect
      viewId - the Eclipse view ID of the view to embed (e.g. "org.eclipse.ui.console.ConsoleView"); must not be null
      panelLocation - the identifier of the target panel inside the CustomView; must not be null
      newTitle - the new title for the panel's tab; may be null to leave the tab title unchanged
    • renamePanelTab

      public static void renamePanelTab(org.eclipse.swt.widgets.Composite panelComposite, String newTitle)
      Changes the tab title of the CustomView panel that contains the given composite.

      The method climbs up the SWT widget tree starting from the given panel composite until it finds the enclosing tab container. Both CTabFolder (used by the Bio7 CustomView) and the classic TabFolder are supported. Within the folder, the tab item whose control is the panel composite itself — or an ancestor wrapper of it — is located and its text is updated.

      If the tab items report no control (i.e. getControl() returns null), the currently selected tab of the folder is renamed as a fallback. If no tab container is found at all, an error message is printed and the title remains unchanged.

      Note: This method must be called from the SWT UI thread, since it accesses and modifies widgets.

      Parameters:
      panelComposite - the composite of the CustomView panel whose tab should be renamed (as returned by CustomView.getComposite(String)); if null or disposed, the method returns without effect
      newTitle - the new text for the tab; if null, the method returns without effect and the title remains unchanged
    • activateView

      public static void activateView(String id)
      Activates the view with the specified id.
      Parameters:
      id - the id as a string value.
    • openPerspective

      public static void openPerspective(String id)
      Opens the perspective with the specified id.
      Parameters:
      id - the id as a string value.
    • openPerspectiveEditorInJob

      public static void openPerspectiveEditorInJob(String id)
    • openMaxView

      public static void openMaxView(String id)
      Opens the specified view and maximizes it.
      Parameters:
      id - the id as a string value.
    • setEditorAreaVisible

      public static void setEditorAreaVisible(boolean visible)
      Show or hides the editor area according to a boolean value.
      Parameters:
      visible - the boolean value
    • setMainToolbarVisible

      public static void setMainToolbarVisible(boolean visible)
      Shows or hides the main toolbar of the Bio7 window (the actions and the perspective switcher). Can be called from any thread.
      Parameters:
      visible - true to show the main toolbar.
    • isMainToolbarVisible

      public static boolean isMainToolbarVisible()
      Returns true if the main toolbar of the Bio7 window is visible.
      Returns:
      the visibility of the main toolbar.
    • toggleMainToolbar

      public static void toggleMainToolbar()
      Shows the main toolbar of the Bio7 window if it is hidden, otherwise hides it.
    • setFullscreen

      public static void setFullscreen(boolean fullscreen)
      Displays the Bio7 window in fullscreen mode or returns to the normal mode. Can be called from any thread.
      Parameters:
      fullscreen - true for the fullscreen mode.
    • isFullscreen

      public static boolean isFullscreen()
      Returns true if the Bio7 window is displayed in fullscreen mode.
      Returns:
      the fullscreen mode.
    • toggleFullscreen

      public static void toggleFullscreen()
      Displays the Bio7 window in fullscreen mode or returns to the normal mode.
    • showHide

      public static void showHide()
      Shows or hides the editor area.
    • closeView

      public static void closeView(String id)
      Closes the view with the specified id.
      Parameters:
      id - the id as a string value.
    • closeCurrentPerspective

      public static void closeCurrentPerspective()
      Closes the current perspective.
    • closePerspective

      public static boolean closePerspective(String idOrName)
      Closes an open perspective of the active workbench window, e.g., closePerspective("com.eco.bio7.perspective_3d") or closePerspective("3d").
      Parameters:
      idOrName - the id of the perspective or its name (the label in the perspective bar, case is ignored).
      Returns:
      true if the perspective was open and has been closed.
    • refreshAllWorkspaces

      public static void refreshAllWorkspaces()
      Refreshes all workspaces.
    • getEditorStore

      public static org.eclipse.jface.preference.IPreferenceStore getEditorStore(String editor)
      A method to get the preferences store for different custom Bio7 editors.
      Parameters:
      editor - A string value to get the store (value options = r, groovy, ijmacro, python, markdown).
      Returns:
      the preference store of the given editor.
    • getStore

      public static org.eclipse.jface.preference.IPreferenceStore getStore(String storePref)
      A method to get the main preferences store for Bio7.
      Parameters:
      editor - A string value to get the store (value options = bio7plugin).
      Returns:
      the preference store of the given editor.
    • executeCommand

      public static void executeCommand(String commandID)
      Execute an registered command.
      Parameters:
      commandID - the command identifier as String.