Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2015-04-27 15:11:05 -0400
committerTom Schindl2015-04-27 15:11:05 -0400
commitdb48fb33c5d61b95d1e18b1db56036715c925a42 (patch)
tree48130b3a32bb75cfde1d28e64e3174937b4a0fa9 /testcases
parent1a5bc4e56aaa5d9deca46cb34b46812c3e5ee28e (diff)
downloadorg.eclipse.efxclipse-db48fb33c5d61b95d1e18b1db56036715c925a42.tar.gz
org.eclipse.efxclipse-db48fb33c5d61b95d1e18b1db56036715c925a42.tar.xz
org.eclipse.efxclipse-db48fb33c5d61b95d1e18b1db56036715c925a42.zip
prepare custom rendering setup
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF4
-rwxr-xr-xtestcases/org.eclipse.fx.testcases.e4/plugin.xml4
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/CustomRendererFactory.java19
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/renderer/MyDefMenuRenderer.java167
4 files changed, 193 insertions, 1 deletions
diff --git a/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF b/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF
index 9fbb1ca16..a59fd47fe 100755
--- a/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF
+++ b/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF
@@ -37,7 +37,9 @@ Require-Bundle: org.eclipse.e4.ui.model.workbench;bundle-version="0.10.1",
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional,
org.eclipse.fx.ui.workbench.services;bundle-version="1.0.0",
org.eclipse.fx.ui.controls,
- org.eclipse.fx.ui.panes
+ org.eclipse.fx.ui.panes,
+ org.eclipse.fx.ui.workbench.renderers.fx,
+ org.eclipse.emf.ecore;bundle-version="2.11.0"
Bundle-ActivationPolicy: lazy
Import-Package: javafx.animation;version="2.0.0",
javafx.application;version="2.0.0",
diff --git a/testcases/org.eclipse.fx.testcases.e4/plugin.xml b/testcases/org.eclipse.fx.testcases.e4/plugin.xml
index 7709e6814..16174bcb1 100755
--- a/testcases/org.eclipse.fx.testcases.e4/plugin.xml
+++ b/testcases/org.eclipse.fx.testcases.e4/plugin.xml
@@ -27,6 +27,10 @@
name="efx_TOOLITEM_TIMER_dummy"
value="400">
</property>
+ <property
+ name="rendererFactoryUri"
+ value="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.CustomRendererFactory">
+ </property>
</product>
</extension>
<extension
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/CustomRendererFactory.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/CustomRendererFactory.java
new file mode 100644
index 000000000..44566573d
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/CustomRendererFactory.java
@@ -0,0 +1,19 @@
+package org.eclipse.fx.testcases.e4;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.fx.ui.workbench.renderers.fx.DefWorkbenchRendererFactory;
+import org.eclipse.jdt.annotation.NonNull;
+
+public class CustomRendererFactory extends DefWorkbenchRendererFactory {
+ @Inject
+ public CustomRendererFactory(@NonNull IEclipseContext context) {
+ super(context);
+ }
+
+// @Override
+// protected Class<? extends BaseMenuRenderer<?>> getMenuRendererClass() {
+// return MyDefMenuRenderer.class;
+// }
+}
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/renderer/MyDefMenuRenderer.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/renderer/MyDefMenuRenderer.java
new file mode 100644
index 000000000..e7fd1f168
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/renderer/MyDefMenuRenderer.java
@@ -0,0 +1,167 @@
+//package org.eclipse.fx.testcases.e4.renderer;
+//
+//import java.util.List;
+//
+//import javax.inject.Inject;
+//import javax.inject.Named;
+//
+//import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+//import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+//import org.eclipse.e4.ui.workbench.UIEvents;
+//import org.eclipse.fx.ui.workbench.renderers.base.widget.WMenu;
+//import org.eclipse.fx.ui.workbench.renderers.base.widget.WMenuElement;
+//import org.eclipse.fx.ui.workbench.renderers.fx.DefMenuRenderer;
+//import org.eclipse.fx.ui.workbench.renderers.fx.widget.WWidgetImpl;
+//
+//import javafx.application.Platform;
+//import javafx.event.Event;
+//import javafx.event.EventHandler;
+//import javafx.scene.control.Menu;
+//import javafx.scene.control.MenuItem;
+//import javafx.scene.control.Toggle;
+//import javafx.scene.control.ToggleGroup;
+//
+//public class MyDefMenuRenderer extends DefMenuRenderer {
+// @Override
+// protected Class<? extends WMenu<Menu>> getWidgetClass(MMenu menu) {
+// return MenuImpl.class;
+// }
+//
+// static class MenuImpl extends WWidgetImpl<Menu, MMenu> implements WMenu<Menu> {
+// private ToggleGroup group;
+// Runnable showingCallback;
+// Runnable hidingCallback;
+// MenuItem item;
+//
+// @Override
+// protected Menu createWidget() {
+// final Menu m = new Menu();
+// this.item = new MenuItem("<empty>"); //$NON-NLS-1$
+// this.item.setDisable(true);
+// m.getItems().add(this.item);
+// m.setMnemonicParsing(true);
+// m.setOnShowing(new EventHandler<Event>() {
+//
+// @Override
+// public void handle(Event event) {
+// // TODO Work around for JIRA 24505
+// if (!m.isShowing()) {
+// if (MenuImpl.this.showingCallback != null) {
+// MenuImpl.this.showingCallback.run();
+// }
+// }
+// if (getWidget().getItems().size() > 1) {
+// getWidget().getItems().remove(MenuImpl.this.item);
+// }
+// }
+// });
+// m.setOnHiding(new EventHandler<Event>() {
+//
+// @Override
+// public void handle(Event arg0) {
+// // Delay the callback so that the action can be execute
+// // before the hiding happens see Bug 451127
+// Platform.runLater(() -> {
+// if (MenuImpl.this.hidingCallback != null)
+// MenuImpl.this.hidingCallback.run();
+//
+// if (getWidget().getItems().isEmpty()) {
+// getWidget().getItems().add(MenuImpl.this.item);
+// }
+// });
+// }
+// });
+// return m;
+// }
+//
+// @Override
+// public void setShowingCallback(Runnable showingCallback) {
+// this.showingCallback = showingCallback;
+// }
+//
+// @Override
+// public void addStyleClasses(List<String> classnames) {
+// getWidget().getStyleClass().addAll(classnames);
+// }
+//
+// @Override
+// public void addStyleClasses(String... classnames) {
+// getWidget().getStyleClass().addAll(classnames);
+// }
+//
+// @Override
+// public void removeStyleClasses(List<String> classnames) {
+// getWidget().getStyleClass().removeAll(classnames);
+// }
+//
+// @Override
+// public void removeStyleClasses(String... classnames) {
+// getWidget().getStyleClass().removeAll(classnames);
+// }
+//
+// @Override
+// public void setStyleId(String id) {
+// getWidget().setId(id);
+// }
+//
+// @Inject
+// public void setLabel(@Named(UIEvents.UILabel.LOCALIZED_LABEL) String label) {
+// getWidget().setText(label);
+// }
+//
+// @Override
+// public void addElement(WMenuElement<MMenuElement> widget) {
+// if (getWidget().getItems().size() == 1) {
+// getWidget().getItems().remove(this.item);
+// }
+//
+// if (widget.getWidget() instanceof Toggle) {
+// if (this.group == null) {
+// this.group = new ToggleGroup();
+// }
+// // see http://javafx-jira.kenai.com/browse/RT-24256
+// // group.getToggles().add((Toggle) widget.getWidget());
+// ((Toggle) widget.getWidget()).setToggleGroup(this.group);
+// }
+// getWidget().getItems().add((MenuItem) widget.getWidget());
+// }
+//
+// @Override
+// public void addElement(int idx, WMenuElement<MMenuElement> widget) {
+// if (getWidget().getItems().size() == 1) {
+// getWidget().getItems().remove(this.item);
+// }
+//
+// if (widget.getWidget() instanceof Toggle) {
+// if (this.group == null) {
+// this.group = new ToggleGroup();
+// }
+// // see http://javafx-jira.kenai.com/browse/RT-24256
+// // group.getToggles().add((Toggle) widget.getWidget());
+// ((Toggle) widget.getWidget()).setToggleGroup(this.group);
+// }
+// getWidget().getItems().add(idx, (MenuItem) widget.getWidget());
+// }
+//
+// @Override
+// public void removeElement(WMenuElement<MMenuElement> widget) {
+// if (widget.getWidget() instanceof Toggle) {
+// ((Toggle) widget.getWidget()).setToggleGroup(null);
+// }
+// getWidget().getItems().remove(widget.getWidget());
+// if (getWidget().getItems().isEmpty()) {
+// getWidget().getItems().add(this.item);
+// }
+// }
+//
+// @Override
+// protected void setUserData(WWidgetImpl<Menu, MMenu> widget) {
+// getWidget().setUserData(widget);
+// }
+//
+// @Override
+// public void setHidingCallback(Runnable hidingCallback) {
+// this.hidingCallback = hidingCallback;
+// }
+// }
+//}

Back to the top