Module UI

Function Overview

executeUI 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.
isUIThread Returns true when executed in the UI thread.
showInfoDialog Displays an info dialog. Needs UI to be available.
showQuestionDialog Displays a question dialog. Contains yes/no buttons. Needs UI to be available.
showInputDialog Displays an input dialog. Contains yes/no buttons. Needs UI to be available.
showConfirmDialog Displays a confirmation dialog.
showWarningDialog Displays a warning dialog.
showErrorDialog Displays an error dialog.
exitApplication Close the application. On unsaved editors user will be asked to save before closing.
showView Opens a view by given Name or id. When name does not match any known view id we try to match it with a view title. When found the view is opened. If the view is already visible it will be given focus.
showEditor Opens a file in an editor.
getSelection 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.
convertSelection Converts selection to a consumable form. Table/Tree selections are transformed into Object[], Text selections into the selected String.
openDialog Show a generic dialog.
getShell

Functions

executeUI

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

java.lang.Object ...

isUIThread

boolean isUIThread()

Returns true when executed in the UI thread.

boolean ...

showInfoDialog

void showInfoDialog(java.lang.String title, java.lang.String message)

Displays an info dialog. Needs UI to be available.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message

showQuestionDialog

boolean showQuestionDialog(java.lang.String title, java.lang.String message)

Displays a question dialog. Contains yes/no buttons. Needs UI to be available.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message

boolean ...

showInputDialog

java.lang.String showInputDialog(java.lang.String title, java.lang.String message, java.lang.String initialValue)

Displays an input dialog. Contains yes/no buttons. Needs UI to be available.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message
initialValue java.lang.String

java.lang.String ...

showConfirmDialog

boolean showConfirmDialog(java.lang.String title, java.lang.String message)

Displays a confirmation dialog.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message

boolean ...

showWarningDialog

void showWarningDialog(java.lang.String title, java.lang.String message)

Displays a warning dialog.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message

showErrorDialog

void showErrorDialog(java.lang.String title, java.lang.String message)

Displays an error dialog.

Parameter Type Description
title java.lang.String dialog title
message java.lang.String dialog message

exitApplication

void exitApplication()

Close the application. On unsaved editors user will be asked to save before closing.

showView

org.eclipse.ui.IViewPart showView(java.lang.String name)

Opens a view by given Name or id. When name does not match any known view id we try to match it with a view title. When found the view is opened. If the view is already visible it will be given focus.

"openView"

Parameter Type Description
name java.lang.String name or id of viw to open

org.eclipse.ui.IViewPart ...

showEditor

org.eclipse.ui.IEditorPart showEditor(org.eclipse.core.resources.IFile file)

Opens a file in an editor.

"openEditor"

Parameter Type Description
file org.eclipse.core.resources.IFile workspace file to open

org.eclipse.ui.IEditorPart ...

getSelection

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

org.eclipse.jface.viewers.ISelection ...

convertSelection

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

java.lang.Object ...

openDialog

int openDialog(org.eclipse.jface.window.Window dialog)

Show a generic dialog.

Parameter Type Description
dialog org.eclipse.jface.window.Window dialog to display

int ...

getShell

org.eclipse.swt.widgets.Shell getShell()

org.eclipse.swt.widgets.Shell ...