-package org.simantics.ui.workbench.action;\r
-\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.IWorkbenchWindow;\r
-import org.eclipse.ui.PlatformUI;\r
-import org.simantics.db.Session;\r
-import org.simantics.utils.ui.SWTUtils;\r
-import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public final class DefaultActions {\r
-\r
- /**\r
- * Perform a default workbench action on the specified input object using\r
- * {@link ChooseActionRequest} from any thread asynchronously.\r
- * \r
- * @param session\r
- * @param input\r
- * @param rememberAction\r
- * @param alwaysAsk\r
- * @param neverPromptForAction true to never prompt/run an action if the\r
- * action selection is ambiguous\r
- */\r
- public static void asyncPerformDefaultAction(\r
- final Session session,\r
- final Object input,\r
- final boolean rememberAction,\r
- final boolean alwaysAsk,\r
- final boolean neverPromptForAction)\r
- {\r
- SWTUtils.asyncExec(PlatformUI.getWorkbench().getDisplay(), new Runnable() {\r
- @Override\r
- public void run() {\r
- performDefaultAction(session, input, rememberAction, alwaysAsk, neverPromptForAction);\r
- }\r
- });\r
- }\r
-\r
- /**\r
- * Perform a default workbench action on the specified input object using\r
- * {@link ChooseActionRequest} from the current thread. The current thread\r
- * must be the SWT UI thread.\r
- * \r
- * @param session\r
- * @param input\r
- * @param rememberAction\r
- * @param alwaysAsk\r
- * @param neverPromptForAction true to never prompt/run an action if the\r
- * action selection is ambiguous\r
- */\r
- public static void performDefaultAction(\r
- final Session session,\r
- final Object input,\r
- boolean rememberAction,\r
- boolean alwaysAsk,\r
- boolean neverPromptForAction)\r
- {\r
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();\r
- Shell shell = window != null ? window.getShell() : null;\r
- session.asyncRequest(new ChooseActionRequest(shell, null, input, WorkbenchUtils.getCurrentPerspectiveId(), rememberAction, alwaysAsk, neverPromptForAction));\r
- }\r
-\r
-}\r
+package org.simantics.ui.workbench.action;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.simantics.db.Session;
+import org.simantics.utils.ui.SWTUtils;
+import org.simantics.utils.ui.workbench.WorkbenchUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public final class DefaultActions {
+
+ /**
+ * Perform a default workbench action on the specified input object using
+ * {@link ChooseActionRequest} from any thread asynchronously.
+ *
+ * @param session
+ * @param input
+ * @param rememberAction
+ * @param alwaysAsk
+ * @param neverPromptForAction true to never prompt/run an action if the
+ * action selection is ambiguous
+ */
+ public static void asyncPerformDefaultAction(
+ final Session session,
+ final Object input,
+ final boolean rememberAction,
+ final boolean alwaysAsk,
+ final boolean neverPromptForAction)
+ {
+ SWTUtils.asyncExec(PlatformUI.getWorkbench().getDisplay(), new Runnable() {
+ @Override
+ public void run() {
+ performDefaultAction(session, input, rememberAction, alwaysAsk, neverPromptForAction);
+ }
+ });
+ }
+
+ /**
+ * Perform a default workbench action on the specified input object using
+ * {@link ChooseActionRequest} from the current thread. The current thread
+ * must be the SWT UI thread.
+ *
+ * @param session
+ * @param input
+ * @param rememberAction
+ * @param alwaysAsk
+ * @param neverPromptForAction true to never prompt/run an action if the
+ * action selection is ambiguous
+ */
+ public static void performDefaultAction(
+ final Session session,
+ final Object input,
+ boolean rememberAction,
+ boolean alwaysAsk,
+ boolean neverPromptForAction)
+ {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ Shell shell = window != null ? window.getShell() : null;
+ session.asyncRequest(new ChooseActionRequest(shell, null, input, WorkbenchUtils.getCurrentPerspectiveId(), rememberAction, alwaysAsk, neverPromptForAction));
+ }
+
+}