Class Work
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidactivateView(String id) Activates the view with the specified id.static voidCloses the current perspective.static booleanclosePerspective(String idOrName) Closes an open perspective of the active workbench window, e.g., closePerspective("com.eco.bio7.perspective_3d") or closePerspective("3d").static voidCloses the view with the specified id.static voidexecuteCommand(String commandID) Execute an registered command.static org.eclipse.jface.preference.IPreferenceStoregetEditorStore(String editor) A method to get the preferences store for different custom Bio7 editors.static org.eclipse.jface.preference.IPreferenceStoreA method to get the main preferences store for Bio7.static booleanReturns true if the Bio7 window is displayed in fullscreen mode.static booleanReturns true if the main toolbar of the Bio7 window is visible.static voidmoveViewToPanel(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 voidopenMaxView(String id) Opens the specified view and maximizes it.static voidOpens the perspective with the specified id.static voidstatic voidOpens the view with the specified id.static voidRefreshes all workspaces.static voidrenamePanelTab(org.eclipse.swt.widgets.Composite panelComposite, String newTitle) Changes the tab title of the CustomView panel that contains the given composite.static voidsetEditorAreaVisible(boolean visible) Show or hides the editor area according to a boolean value.static voidsetFullscreen(boolean fullscreen) Displays the Bio7 window in fullscreen mode or returns to the normal mode.static voidsetMainToolbarVisible(boolean visible) Shows or hides the main toolbar of the Bio7 window (the actions and the perspective switcher).static voidshowHide()Shows or hides the editor area.static voidDisplays the Bio7 window in fullscreen mode or returns to the normal mode.static voidShows the main toolbar of the Bio7 window if it is hidden, otherwise hides it.
-
Constructor Details
-
Work
public Work()
-
-
Method Details
-
openView
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 tocreatePartControl(). 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 Bio7CustomViewproviding the target panels; ifnull, the method returns without effectviewId- the Eclipse view ID of the view to embed (e.g."org.eclipse.ui.console.ConsoleView"); must not benullpanelLocation- the identifier of the target panel inside the CustomView; must not benullnewTitle- the new title for the panel's tab; may benullto 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 classicTabFolderare 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()returnsnull), 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 byCustomView.getComposite(String)); ifnullor disposed, the method returns without effectnewTitle- the new text for the tab; ifnull, the method returns without effect and the title remains unchanged
-
activateView
Activates the view with the specified id.- Parameters:
id- the id as a string value.
-
openPerspective
Opens the perspective with the specified id.- Parameters:
id- the id as a string value.
-
openPerspectiveEditorInJob
-
openMaxView
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
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
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
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
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
Execute an registered command.- Parameters:
commandID- the command identifier as String.
-