summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2013-07-01 17:02:28 -0400
committerTom Schindl2013-07-01 17:02:28 -0400
commite2a4ef5bffc8da3b1e44fc4777b82bfb77311b0f (patch)
treeccb0be42b4de68af166198f0657c71245349b2b2
parent393d4eb56493c5ce0317467136f5c30a089311fb (diff)
downloadorg.eclipse.efxclipse-e2a4ef5bffc8da3b1e44fc4777b82bfb77311b0f.zip
org.eclipse.efxclipse-e2a4ef5bffc8da3b1e44fc4777b82bfb77311b0f.tar.gz
org.eclipse.efxclipse-e2a4ef5bffc8da3b1e44fc4777b82bfb77311b0f.tar.xz
Bug 408419 - Add FXML to Java Translator
-rwxr-xr-xbundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF36
-rw-r--r--bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/ExtendedFXMLLoader.java32
-rw-r--r--bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/FXMLDocument.java17
3 files changed, 84 insertions, 1 deletions
diff --git a/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
index 79e797d..6ab24ec 100755
--- a/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
@@ -4,8 +4,42 @@ Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.fx.core
Bundle-Version: 0.8.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Import-Package: javax.inject;version="1.0.0"
+Import-Package: javafx.animation;version="2.2.0",
+ javafx.application;version="2.2.0",
+ javafx.beans;version="2.2.0",
+ javafx.beans.binding;version="2.2.0",
+ javafx.beans.property;version="2.2.0",
+ javafx.beans.property.adapter;version="2.2.0",
+ javafx.beans.value;version="2.2.0",
+ javafx.collections;version="2.2.0",
+ javafx.concurrent;version="2.2.0",
+ javafx.css;version="8.0.0",
+ javafx.embed.swing;version="2.2.0",
+ javafx.embed.swt;version="2.2.0",
+ javafx.event;version="2.2.0",
+ javafx.fxml;version="2.2.0",
+ javafx.geometry;version="2.2.0",
+ javafx.scene;version="2.2.0",
+ javafx.scene.canvas;version="2.2.0",
+ javafx.scene.chart;version="2.2.0",
+ javafx.scene.control;version="2.2.0",
+ javafx.scene.control.cell;version="2.2.0",
+ javafx.scene.effect;version="2.2.0",
+ javafx.scene.image;version="2.2.0",
+ javafx.scene.input;version="2.2.0",
+ javafx.scene.layout;version="2.2.0",
+ javafx.scene.media;version="2.2.0",
+ javafx.scene.paint;version="2.2.0",
+ javafx.scene.shape;version="2.2.0",
+ javafx.scene.text;version="2.2.0",
+ javafx.scene.transform;version="2.2.0",
+ javafx.scene.web;version="2.2.0",
+ javafx.stage;version="2.2.0",
+ javafx.util;version="2.2.0",
+ javafx.util.converter;version="2.2.0",
+ javax.inject;version="1.0.0"
Export-Package: org.eclipse.fx.core,
+ org.eclipse.fx.core.fxml,
org.eclipse.fx.core.log,
org.eclipse.fx.core.update
Bundle-Vendor: %Bundle-Vendor
diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/ExtendedFXMLLoader.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/ExtendedFXMLLoader.java
new file mode 100644
index 0000000..835bc78
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/ExtendedFXMLLoader.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BestSolution.at 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:
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.core.fxml;
+
+import java.io.IOException;
+
+import javafx.fxml.FXMLLoader;
+
+
+public class ExtendedFXMLLoader {
+ public <T> T load(ClassLoader cl, String path) throws IOException {
+ try {
+ Class<?> clazz = cl.loadClass(path.replace('/', '.'));
+ FXMLDocument<T> d = (FXMLDocument<T>) clazz.newInstance();
+ return d.load(null);
+ } catch (ClassNotFoundException e) {
+ return FXMLLoader.load(cl.getResource(path));
+ } catch (InstantiationException e) {
+ throw new IOException(e);
+ } catch (IllegalAccessException e) {
+ throw new IOException(e);
+ }
+ }
+}
diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/FXMLDocument.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/FXMLDocument.java
new file mode 100644
index 0000000..5c11234
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/fxml/FXMLDocument.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BestSolution.at 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:
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.core.fxml;
+
+import java.util.ResourceBundle;
+
+public abstract class FXMLDocument<T> {
+ public abstract T load(ResourceBundle bundle);
+}