Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Keimel2015-03-30 10:18:48 +0000
committerChristoph Keimel2015-03-30 10:18:48 +0000
commit41208cee91e6e1e7fcac5de47ccc7b27b3b18b8d (patch)
tree5f289fff79db341dd1f23d5d274a344d18f3ed60 /experimental
parente007adc483e5108ae72386ccf00193e30a37db14 (diff)
downloadorg.eclipse.efxclipse-41208cee91e6e1e7fcac5de47ccc7b27b3b18b8d.tar.gz
org.eclipse.efxclipse-41208cee91e6e1e7fcac5de47ccc7b27b3b18b8d.tar.xz
org.eclipse.efxclipse-41208cee91e6e1e7fcac5de47ccc7b27b3b18b8d.zip
Bug 463428 - [swtonjavafx] enable SWTActiveShellFunction to be called
outside of the ui thread Signed-off-by: Christoph Keimel <c.keimel@emsw.de>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF4
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java7
2 files changed, 9 insertions, 2 deletions
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF b/experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF
index 71cb0fac5..6c78712b2 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.e4.core.contexts,
org.eclipse.fx.runtime.swt;bundle-version="1.0.0",
- org.eclipse.e4.ui.services
+ org.eclipse.e4.ui.services,
+ org.eclipse.fx.ui.services,
+ org.eclipse.e4.ui.di
Service-Component: OSGI-INF/services/fxtoswtfunction.xml,
OSGI-INF/services/fxtoswtdisplay.xml,
OSGI-INF/services/swtactiveshell.xml
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java
index 3684388fc..dad706628 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java
@@ -16,6 +16,7 @@ import javafx.stage.Stage;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.fx.ui.services.sync.UISynchronize;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -24,7 +25,11 @@ public class SWTActiveShellFunction extends ContextFunction {
public Object compute(IEclipseContext context) {
Object active = context.get(IServiceConstants.ACTIVE_SHELL);
if (active != null && active instanceof Stage) {
- return new Shell((Stage)active);
+ UISynchronize uiSynchronize = context.get(UISynchronize.class);
+ Shell result = uiSynchronize.syncExec(() -> {
+ return new Shell((Stage)active);
+ }, null);
+ return result;
}
return Display.getCurrent().getActiveShell();
}

Back to the top