X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Faction%2FDefaultActions.java;h=9f5bba95dea73c8ee01621365f8e3f05d9e29334;hp=e715055dedca7435fcb91a24328f9a9abd3b475d;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/DefaultActions.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/DefaultActions.java index e715055de..9f5bba95d 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/DefaultActions.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/action/DefaultActions.java @@ -1,65 +1,65 @@ -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)); - } - -} +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)); + } + +}