X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Faction%2FDefaultActions.java;fp=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Faction%2FDefaultActions.java;h=12995f177faa88e3c408d482ace38451af1b9678;hb=19d630e8a8d2265c5b6784b85ea1009c662559e8;hp=9f5bba95dea73c8ee01621365f8e3f05d9e29334;hpb=60652a89994f8050111b5c243323f6ed703c929a;p=simantics%2Fplatform.git 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 9f5bba95d..12995f177 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,5 +1,6 @@ package org.simantics.ui.workbench.action; +import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -62,4 +63,15 @@ public final class DefaultActions { session.asyncRequest(new ChooseActionRequest(shell, null, input, WorkbenchUtils.getCurrentPerspectiveId(), 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 control the control contained + */ + public static void performDefaultAction(Control control, Object input) { + new PerformDefaultAction("Perform Default Action", control, input).run(); + } + }