Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'experimental')
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/META-INF/MANIFEST.MF7
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtdisplay.xml2
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtfunction.xml2
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/swtactiveshell.xml8
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/SWTServiceConstants.java8
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java (renamed from experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTAdapterFunction.java)2
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTDisplayFunction.java (renamed from experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTDisplayFunction.java)2
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java31
8 files changed, 56 insertions, 6 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 6ea1b06eb..71cb0fac5 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
@@ -5,7 +5,10 @@ Bundle-SymbolicName: org.eclipse.fx.runtime.swt.e4
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.fx.runtime.swt;bundle-version="1.0.0",
+ org.eclipse.e4.ui.services
Service-Component: OSGI-INF/services/fxtoswtfunction.xml,
- OSGI-INF/services/fxtoswtdisplay.xml
+ OSGI-INF/services/fxtoswtdisplay.xml,
+ OSGI-INF/services/swtactiveshell.xml
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.fx.runtime.swt.e4
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtdisplay.xml b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtdisplay.xml
index e7940b94e..cdb7b010d 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtdisplay.xml
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtdisplay.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.runtime.swt.e4.fxtoswtdisplay">
- <implementation class="org.eclipse.fx.runtime.swt.e4.FXToSWTDisplayFunction"/>
+ <implementation class="org.eclipse.fx.runtime.swt.e4.internal.FXToSWTDisplayFunction"/>
<service>
<provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
</service>
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtfunction.xml b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtfunction.xml
index 40e5256f0..5bb802b5a 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtfunction.xml
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/fxtoswtfunction.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.runtime.swt.e4.fxtoswtfunction">
- <implementation class="org.eclipse.fx.runtime.swt.e4.FXToSWTAdapterFunction"/>
+ <implementation class="org.eclipse.fx.runtime.swt.e4.internal.FXToSWTAdapterFunction"/>
<service>
<provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
</service>
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/swtactiveshell.xml b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/swtactiveshell.xml
new file mode 100644
index 000000000..345357eb3
--- /dev/null
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/OSGI-INF/services/swtactiveshell.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.runtime.swt.e4.swtactiveshell">
+ <implementation class="org.eclipse.fx.runtime.swt.e4.internal.SWTActiveShellFunction"/>
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+ <property name="service.context.key" type="String" value="activeSWTShell"/>
+</scr:component>
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/SWTServiceConstants.java b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/SWTServiceConstants.java
new file mode 100644
index 000000000..e0b48d2f6
--- /dev/null
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/SWTServiceConstants.java
@@ -0,0 +1,8 @@
+package org.eclipse.fx.runtime.swt.e4;
+
+public interface SWTServiceConstants {
+ /**
+ * The currently active SWT Shell.
+ */
+ public static final String ACTIVE_SHELL = "activeSWTShell"; //$NON-NLS-1$
+}
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTAdapterFunction.java b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java
index e731cc52b..383c030c5 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTAdapterFunction.java
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java
@@ -8,7 +8,7 @@
* Contributors:
* Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
*******************************************************************************/
-package org.eclipse.fx.runtime.swt.e4;
+package org.eclipse.fx.runtime.swt.e4.internal;
import javafx.scene.layout.BorderPane;
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTDisplayFunction.java b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTDisplayFunction.java
index ef0179e2c..776f5335f 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/FXToSWTDisplayFunction.java
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTDisplayFunction.java
@@ -9,7 +9,7 @@
* Christoph Keimel <c.keimel@emsw.de> - initial API and implementation
*******************************************************************************/
-package org.eclipse.fx.runtime.swt.e4;
+package org.eclipse.fx.runtime.swt.e4.internal;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
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
new file mode 100644
index 000000000..3684388fc
--- /dev/null
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/SWTActiveShellFunction.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EM-SOFTWARE and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christoph Keimel <c.keimel@emsw.de> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.fx.runtime.swt.e4.internal;
+
+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.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+public class SWTActiveShellFunction extends ContextFunction {
+ @Override
+ public Object compute(IEclipseContext context) {
+ Object active = context.get(IServiceConstants.ACTIVE_SHELL);
+ if (active != null && active instanceof Stage) {
+ return new Shell((Stage)active);
+ }
+ return Display.getCurrent().getActiveShell();
+ }
+}

Back to the top