Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java')
-rw-r--r--experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java
index 383c030c5..e5d4359a5 100644
--- a/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java
+++ b/experimental/swt/org.eclipse.fx.runtime.swt.e4/src/org/eclipse/fx/runtime/swt/e4/internal/FXToSWTAdapterFunction.java
@@ -10,16 +10,32 @@
*******************************************************************************/
package org.eclipse.fx.runtime.swt.e4.internal;
+import javafx.scene.Group;
+import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
+import javafx.scene.layout.HBox;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.swt.widgets.FX_SWT;
public class FXToSWTAdapterFunction extends ContextFunction {
+
@Override
public Object compute(IEclipseContext context) {
- BorderPane p = context.get(BorderPane.class);
- return FX_SWT.new_Composite(p);
+ BorderPane borderPane = context.get(BorderPane.class);
+ if (borderPane != null)
+ return FX_SWT.new_Composite(borderPane);
+ AnchorPane anchorPane = context.get(AnchorPane.class);
+ if (anchorPane != null)
+ return FX_SWT.new_Composite(anchorPane);
+ Group group = context.get(Group.class);
+ if (group != null)
+ return FX_SWT.new_Composite(group);
+ HBox hbox = context.get(HBox.class);
+ if (hbox != null)
+ return FX_SWT.new_Composite(hbox);
+ throw new NullPointerException("Could not create SWT Composite wrapper");
}
+
}

Back to the top