Methods invoking code interfering with the UI thread.
Method | Description |
---|---|
clearConsole() | Clear the script console. |
closeView() | Close a dedicated view. |
convertSelection() | Converts selection to a consumable form. |
executeUI() | Run code in UI thread. |
exitApplication() | Close the application. |
getActiveEditor() | Get the active editor instance. |
getActiveView() | Get the active view instance. |
getClipboard() | Get text data from the clipboard. |
getSelection() | Get the current selection. |
getShell() | Get the workbench shell instance. |
isUIThread() | Returns true when executed in the UI thread. |
maximizeView() | Maximize a dedicated view. |
minimizeView() | Minimize a dedicated view. |
openDialog() | Show a generic dialog. |
openEditor() | Alias for showEditor. |
openView() | Alias for showView. |
setClipboard() | Write text data to the clipboard. |
showConfirmDialog() | Displays a confirmation dialog. |
showEditor() | Opens a file in an editor. |
showErrorDialog() | Displays an error dialog. |
showInfoDialog() | Displays an info dialog. |
showInputDialog() | Displays an input dialog. |
showMessageDialog() | Alias for showInfoDialog. |
showQuestionDialog() | Displays a question dialog. |
showView() | Shows a view in this page with the given id and secondary id. |
showWarningDialog() | Displays a warning dialog. |
shutdown() |
void closeView(java.lang.String name, [java.lang.String secondaryID])
Close a dedicated view.
Parameter | Type | Description |
---|---|---|
name | java.lang.String | visible name or id of view to close |
secondaryID | java.lang.String | secondary ID of view to close Optional: defaults to <null>. |
java.lang.Object convertSelection(org.eclipse.jface.viewers.ISelection selection)
Converts selection to a consumable form. Table/Tree selections are transformed into Object[], Text selections into the selected String.
Parameter | Type | Description |
---|---|---|
selection | org.eclipse.jface.viewers.ISelection | selection to convert |
Returns:java.lang.Object ... converted elements
java.lang.Object executeUI(java.lang.Object code)
Run code in UI thread. Needed to interact with SWT elements. Might not be supported by some engines. Might be disabled by the user. Code will be executed synchronously and stall UI updates while executed.
Parameter | Type | Description |
---|---|---|
code | java.lang.Object | code/object to execute |
Returns:java.lang.Object ... execution result
void exitApplication()
Close the application. On unsaved editors user will be asked to save before closing.
org.eclipse.ui.IEditorPart getActiveEditor()
Get the active editor instance.
Returns:org.eclipse.ui.IEditorPart ... active editor
org.eclipse.ui.IWorkbenchPart getActiveView()
Get the active view instance.
Returns:org.eclipse.ui.IWorkbenchPart ... active view
java.lang.Object getClipboard()
Get text data from the clipboard.
Returns:java.lang.Object ... clipboard text
org.eclipse.jface.viewers.ISelection getSelection([java.lang.String name])
Get the current selection. If partID is provided, the selection of the given part is returned. Otherwise the selection of the current active part is returned.
Parameter | Type | Description |
---|---|---|
name | java.lang.String | name or ID of part to get selection from Optional: defaults to <null>. |
Returns:org.eclipse.jface.viewers.ISelection ... current selection
org.eclipse.swt.widgets.Shell getShell()
Get the workbench shell instance.
Returns:org.eclipse.swt.widgets.Shell ... shell
boolean isUIThread()
Returns true
when executed in the UI thread.
Returns:boolean ... true
in UI thread
void maximizeView(java.lang.String name)
Maximize a dedicated view. If the view is not opened yet, it will be opened by this call. A second call will restore the original size of the view.
Parameter | Type | Description |
---|---|---|
name | java.lang.String | visible name or id of view to maximize |
void minimizeView(java.lang.String name)
Minimize a dedicated view. If the view is not opened yet, it will be opened by this call. A second call will restore view on a floating dock.
Parameter | Type | Description |
---|---|---|
name | java.lang.String | name or id of view to minimize |
int openDialog(org.eclipse.jface.window.Window dialog)
Show a generic dialog.
Parameter | Type | Description |
---|---|---|
dialog | org.eclipse.jface.window.Window | dialog to display |
Returns:int ... result of dialog.open() method
void setClipboard(java.lang.String data)
Write text data to the clipboard.
Parameter | Type | Description |
---|---|---|
data | java.lang.String | data to write to the clipboard |
boolean showConfirmDialog(java.lang.String message, [java.lang.String title])
Displays a confirmation dialog.
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
title | java.lang.String | dialog title Optional: defaults to <"Confirmation">. |
Returns:boolean ... true
when accepted
org.eclipse.ui.IEditorPart showEditor(java.lang.Object location)
Opens a file in an editor.
Alias: openEditor()
Parameter | Type | Description |
---|---|---|
location | java.lang.Object | file location to open, either IFile or workspace file location |
Returns:org.eclipse.ui.IEditorPart ... editor instance or null
void showErrorDialog(java.lang.String message, [java.lang.String title])
Displays an error dialog.
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
title | java.lang.String | dialog title Optional: defaults to <"Error">. |
void showInfoDialog(java.lang.String message, [java.lang.String title])
Displays an info dialog. Needs UI to be available.
Alias: showMessageDialog()
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
title | java.lang.String | dialog title Optional: defaults to <"Info">. |
java.lang.String showInputDialog(java.lang.String message, [java.lang.String initialValue], [java.lang.String title])
Displays an input dialog. Needs UI to be available.
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
initialValue | java.lang.String | default value used to populate input box Optional: defaults to <"">. |
title | java.lang.String | dialog title Optional: defaults to <"Information request">. |
Returns:java.lang.String ... true
when 'yes' was pressed, false
otherwise
boolean showQuestionDialog(java.lang.String message, [java.lang.String title])
Displays a question dialog. Contains yes/no buttons. Needs UI to be available.
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
title | java.lang.String | dialog title Optional: defaults to <"Question">. |
Returns:boolean ... true
when 'yes' was pressed, false
otherwise
org.eclipse.ui.IViewPart showView(java.lang.String name, [java.lang.String secondaryId], [int mode])
Shows a view in this page with the given id and secondary id. The Behavior of this method varies based on the supplied mode. If
VIEW_ACTIVATE
is supplied, the view is given focus. If VIEW_VISIBLE
is supplied, then it is made visible but not given focus.
Finally, if VIEW_CREATE
is supplied the view is created and will only be made visible if it is not created in a folder that already contains
visible views.
This allows multiple instances of a particular view to be created. They are disambiguated using the secondary id. If a secondary id is given, the view must allow multiple instances by having specified allowMultiple="true" in its extension.
Alias: openView()
Parameter | Type | Description |
---|---|---|
name | java.lang.String | either the id of the view extension to use or the visible name of the view (tab title) |
secondaryId | java.lang.String | the secondary id to use, or null for no secondary idOptional: defaults to <null>. |
mode | int | the activation mode. Must be VIEW_ACTIVATE, VIEW_VISIBLE or VIEW_CREATE, Default is VIEW_ACTIVATE Optional: defaults to <1>. |
Returns:org.eclipse.ui.IViewPart ... a view
void showWarningDialog(java.lang.String message, [java.lang.String title])
Displays a warning dialog.
Parameter | Type | Description |
---|---|---|
message | java.lang.String | dialog message |
title | java.lang.String | dialog title Optional: defaults to <"Warning">. |
void shutdown()