Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/org.eclipse.fx.testcases.e4/Application.e4xmi7
-rwxr-xr-xtestcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF9
-rwxr-xr-xtestcases/org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.product1
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/contributions/DMContribution.java22
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/ClosePerspectiveHandler.java49
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/RegisterDynamicLifecycle.java16
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/LifeCycle.java31
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/MenuLifecycle.java34
-rw-r--r--testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/SecondLifeCycle.java20
9 files changed, 188 insertions, 1 deletions
diff --git a/testcases/org.eclipse.fx.testcases.e4/Application.e4xmi b/testcases/org.eclipse.fx.testcases.e4/Application.e4xmi
index c067a0598..33018943f 100755
--- a/testcases/org.eclipse.fx.testcases.e4/Application.e4xmi
+++ b/testcases/org.eclipse.fx.testcases.e4/Application.e4xmi
@@ -5,6 +5,7 @@
<persistedState key="efx.window.fullscreen" value="false"/>
<children xsi:type="advanced:PerspectiveStack" xmi:id="_mK1iIO6wEeG4lfn-YKJbJw" elementId="org.eclipse.fx.testcases.e4.perspectivestack.0">
<children xsi:type="advanced:Perspective" xmi:id="_m-PVAO6wEeG4lfn-YKJbJw" elementId="org.eclipse.fx.testcases.e4.perspective.0" label="P 0">
+ <tags>EFX_LC:bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.lifecycle.LifeCycle</tags>
<children xsi:type="basic:PartSashContainer" xmi:id="_A7Q9oOL-EeGP-5z69KadAQ" horizontal="true">
<children xsi:type="basic:Part" xmi:id="_A7Q9oeL-EeGP-5z69KadAQ" containerData="10" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.parts.ControlPanel" label="Control Stack" iconURI="">
<tags>Part-Toolbar-FullSpan</tags>
@@ -22,6 +23,7 @@
<children xsi:type="basic:Part" xmi:id="_ZHcNwOL-EeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.part.0" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.parts.ContentPanel" label="C0" iconURI="platform:/plugin/org.eclipse.fx.testcases.e4/icons/folder.png" closeable="true">
<tags>Part-ToolBarMenu-Floating</tags>
<tags>Part-Toolbar-FullSpan</tags>
+ <tags>EFX_LC:bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.lifecycle.LifeCycle</tags>
<menus xmi:id="_dsz2oIEQEeKxavJ0U4_mHQ" elementId="org.eclipse.fx.testcases.e4.menu.4">
<tags>ViewMenu</tags>
<children xsi:type="menu:DirectMenuItem" xmi:id="_h8rwYIEQEeKxavJ0U4_mHQ" elementId="org.eclipse.fx.testcases.e4.directmenuitem.5" label="View Menu 1" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.DiHandler2"/>
@@ -92,6 +94,7 @@
</children>
<mainMenu xmi:id="_W8hHoORZEeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.menu.0">
<children xsi:type="menu:Menu" xmi:id="_Xwuy0ORZEeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.menu.1" label="M1">
+ <tags>EFX_LC:bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.lifecycle.MenuLifecycle</tags>
<children xsi:type="menu:HandledMenuItem" xmi:id="_f6s64ORqEeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.handledmenuitem.0" label="Push - HI 0" command="_FEZr8OUcEeGP-5z69KadAQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_lb8V4ORqEeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.handledmenuitem.1" label="Check - HI 1" type="Check" command="_3PQSEOqiEeGrz8mV_3Gr5A"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_pBaAsORqEeGP-5z69KadAQ" elementId="org.eclipse.fx.testcases.e4.handledmenuitem.2" label="Radio - HI 2" type="Radio" command="_FEZr8OUcEeGP-5z69KadAQ"/>
@@ -106,6 +109,8 @@
<children xsi:type="menu:DirectMenuItem" xmi:id="_N4FhcIfmEeKsYN0U3N_L9Q" elementId="org.eclipse.fx.testcases.e4.directmenuitem.7" label="Exit" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.ExitHandler"/>
<children xsi:type="menu:DirectMenuItem" xmi:id="_3n7coIfmEeKsYN0U3N_L9Q" elementId="org.eclipse.fx.testcases.e4.directmenuitem.8" label="Restart" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.RestartHandler"/>
<children xsi:type="menu:DirectMenuItem" xmi:id="_Y2UZcMg4EeKo1rUjbZCXsQ" elementId="org.eclipse.fx.testcases.e4.directmenuitem.11" label="Dynamic Window" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.DynamicWinHandler"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_yP8EsOHBEeKlH9jWGqiIew" elementId="org.eclipse.fx.testcases.e4.dynamicmenucontribution.0" label="Test" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.contributions.DMContribution"/>
+ <children xsi:type="menu:DirectMenuItem" xmi:id="_uPNeUOJ-EeKZGIZ9VF1S7Q" elementId="org.eclipse.fx.testcases.e4.directmenuitem.13" label="Register dynamic lifecycle" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.RegisterDynamicLifecycle"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_d-oDwO6yEeG4lfn-YKJbJw" elementId="org.eclipse.fx.testcases.e4.menu.3" label="Switch">
<children xsi:type="menu:HandledMenuItem" xmi:id="_jYdPMO6yEeG4lfn-YKJbJw" elementId="org.eclipse.fx.testcases.e4.handledmenuitem.4" label="Perspective 0" command="_kCbZQO6yEeG4lfn-YKJbJw">
@@ -130,6 +135,7 @@
<children xsi:type="menu:Menu" xmi:id="_xS050MayEeKo1rUjbZCXsQ" elementId="org.eclipse.fx.testcases.e4.menu.6" label="Multiple close">
<children xsi:type="menu:DirectMenuItem" xmi:id="_yhjWwMayEeKo1rUjbZCXsQ" elementId="org.eclipse.fx.testcases.e4.directmenuitem.9" label="Close all" iconURI="platform:/plugin/org.eclipse.fx.testcases.e4/css/images/window-close-over.png" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.BatchRemoveHandler"/>
<children xsi:type="menu:DirectMenuItem" xmi:id="_2R3msMayEeKo1rUjbZCXsQ" elementId="org.eclipse.fx.testcases.e4.directmenuitem.10" label="Close others" iconURI="platform:/plugin/org.eclipse.fx.testcases.e4/css/images/window-close-over.png" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.CloseOthersHandler"/>
+ <children xsi:type="menu:DirectMenuItem" xmi:id="_HrhKkOHEEeKlH9jWGqiIew" elementId="org.eclipse.fx.testcases.e4.directmenuitem.12" label="Close perspective" iconURI="platform:/plugin/org.eclipse.fx.testcases.e4/css/images/window-close-over.png" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.handlers.ClosePerspectiveHandler"/>
</children>
</mainMenu>
<sharedElements xsi:type="basic:Part" xmi:id="_T4J0kPW5EeG7tr8qKhf17Q" elementId="org.eclipse.fx.testcases.e4.part.7" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.parts.ContentPanel" label="C7"/>
@@ -186,4 +192,5 @@
<addons xmi:id="_A7QWmOL-EeGP-5z69KadAQ" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_tQtNQOUbEeGP-5z69KadAQ" elementId="org.eclipse.fx.ui.keybindings.e4.model" contributionURI="bundleclass://org.eclipse.fx.ui.keybindings.e4/org.eclipse.fx.ui.keybindings.e4.BindingProcessingAddon"/>
<addons xmi:id="_3c-AUL89EeKIBMNbSVZPsw" elementId="org.eclipse.e4.ui.workbench.addons.HandlerProcessingAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
+ <addons xmi:id="_9h-HsOHDEeKlH9jWGqiIew" elementId="org.eclipse.fx.testcases.e4.addon.0" contributionURI="bundleclass://org.eclipse.fx.ui.lifecycle/org.eclipse.fx.ui.lifecycle.LifecycleAddon"/>
</application:Application>
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 476b5a413..5e6468e0e 100755
--- a/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF
+++ b/testcases/org.eclipse.fx.testcases.e4/META-INF/MANIFEST.MF
@@ -20,7 +20,13 @@ Require-Bundle: org.eclipse.e4.ui.model.workbench;bundle-version="0.10.1",
org.eclipse.equinox.common;bundle-version="3.6.0",
org.eclipse.e4.ui.services;bundle-version="0.10.1",
org.eclipse.fx.ui.services;bundle-version="0.8.1",
- org.eclipse.equinox.app;bundle-version="1.3.100"
+ org.eclipse.equinox.app;bundle-version="1.3.100",
+ org.eclipse.fx.javafx;bundle-version="2.2.0",
+ org.eclipse.osgi;bundle-version="3.9.0",
+ org.eclipse.fx.ui.workbench.renderers.base,
+ org.eclipse.fx.ui.dialogs,
+ org.eclipse.fx.ui.lifecycle,
+ org.eclipse.fx.ui.workbench.base
Bundle-ActivationPolicy: lazy
Import-Package: javafx.animation;version="2.0.0",
javafx.application;version="2.0.0",
@@ -52,5 +58,6 @@ Import-Package: javafx.animation;version="2.0.0",
javafx.util;version="2.0.0",
javax.annotation;version="1.1.0",
javax.inject;version="1.0.0",
+ org.eclipse.fx.ui.lifecycle,
org.osgi.framework;version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/testcases/org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.product b/testcases/org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.product
index 7a55bd169..dd43ef0d7 100755
--- a/testcases/org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.product
+++ b/testcases/org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.product
@@ -75,6 +75,7 @@
<plugin id="org.eclipse.fx.ui.keybindings"/>
<plugin id="org.eclipse.fx.ui.keybindings.e4"/>
<plugin id="org.eclipse.fx.ui.keybindings.generic"/>
+ <plugin id="org.eclipse.fx.ui.lifecycle"/>
<plugin id="org.eclipse.fx.ui.panes"/>
<plugin id="org.eclipse.fx.ui.services"/>
<plugin id="org.eclipse.fx.ui.theme"/>
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/contributions/DMContribution.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/contributions/DMContribution.java
new file mode 100644
index 000000000..ba688513c
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/contributions/DMContribution.java
@@ -0,0 +1,22 @@
+package org.eclipse.fx.testcases.e4.contributions;
+
+import org.eclipse.e4.ui.di.AboutToHide;
+import org.eclipse.e4.ui.di.AboutToShow;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+
+public class DMContribution {
+
+
+ @AboutToShow
+ public void ats(MMenu menu){
+// menu.getChildren().remove(0); <--works
+ System.err.println(menu);
+ System.err.println("ATSH");
+ }
+
+ @AboutToHide
+ public void ath(){
+ System.err.println("ATH");
+ }
+
+} \ No newline at end of file
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/ClosePerspectiveHandler.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/ClosePerspectiveHandler.java
new file mode 100644
index 000000000..fce75d0ac
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/ClosePerspectiveHandler.java
@@ -0,0 +1,49 @@
+package org.eclipse.fx.testcases.e4.handlers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.fx.ui.lifecycle.ELifecycleService;
+import org.eclipse.fx.ui.lifecycle.annotations.PreClose;
+import org.eclipse.fx.ui.workbench.base.rendering.AbstractRenderer;
+import org.eclipse.fx.ui.workbench.renderers.base.BaseRenderer;
+
+public class ClosePerspectiveHandler {
+
+ @Execute
+ public void closePerspective(MWindow window, EModelService modelService, EPartService partService, ELifecycleService lifecycleService) {
+
+ MPerspectiveStack activeStack = (MPerspectiveStack) window
+ .getSelectedElement();
+ if (activeStack == null)
+ return;
+
+ // find the next perspective to activate, and the selected one
+ MPerspective activePerspective = activeStack.getSelectedElement();
+ List<MPart> partsInActive = modelService.findElements(window, null, MPart.class, null,
+ EModelService.IN_ACTIVE_PERSPECTIVE);
+ List<MPart> allParts = modelService.findElements(window, null, MPart.class, null,
+ EModelService.IN_ANY_PERSPECTIVE);
+ List<MPart> partsToRemove = new ArrayList<MPart>();
+ for (MPart p : partsInActive) {
+ if (!allParts.contains(p)) partsToRemove.add(p);
+ }
+ for (MPart p : partsToRemove) {
+ partService.hidePart(p, true);//don't care about saving here
+ }
+// AbstractRenderer renderer = (AbstractRenderer) activePerspective.getRenderer();
+// if (renderer.validateLifecycleAnnotation(PreClose.class, null, renderer.getModelContext(activePerspective)
+// , activePerspective))
+ if (lifecycleService.validateAnnotation(PreClose.class, activePerspective, activePerspective.getContext()))
+ modelService.removePerspectiveModel(activePerspective, window);//this one includes selecting the next active
+
+ }
+
+} \ No newline at end of file
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/RegisterDynamicLifecycle.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/RegisterDynamicLifecycle.java
new file mode 100644
index 000000000..e7a0d9d11
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/handlers/RegisterDynamicLifecycle.java
@@ -0,0 +1,16 @@
+package org.eclipse.fx.testcases.e4.handlers;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.fx.ui.lifecycle.ELifecycleService;
+
+public class RegisterDynamicLifecycle {
+
+ @Execute
+ public void execute(ELifecycleService service, MPart part){
+ System.err.println(part.getLabel());
+ service.registerLifecycleURI(part, "bundleclass://org.eclipse.fx.testcases.e4/"+
+ "org.eclipse.fx.testcases.e4.lifecycle.SecondLifeCycle");
+ }
+
+} \ No newline at end of file
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/LifeCycle.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/LifeCycle.java
new file mode 100644
index 000000000..67bd19f53
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/LifeCycle.java
@@ -0,0 +1,31 @@
+package org.eclipse.fx.testcases.e4.lifecycle;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javafx.stage.Stage;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.MApplicationElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.fx.ui.dialogs.MessageDialog;
+import org.eclipse.fx.ui.lifecycle.LifecycleAddon;
+import org.eclipse.fx.ui.lifecycle.annotations.PreClose;
+import org.eclipse.fx.ui.workbench.renderers.base.widget.WWindow;
+
+public class LifeCycle {
+
+ @SuppressWarnings("rawtypes")
+ @PreClose
+ public boolean ph(MWindow win){
+ MessageDialog.openErrorDialog((Stage)((WWindow)win.getWidget()).getWidget(), "Sorry", "Sorry, no close.");
+ return false;
+ }
+
+ } \ No newline at end of file
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/MenuLifecycle.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/MenuLifecycle.java
new file mode 100644
index 000000000..98f6f2f62
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/MenuLifecycle.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.testcases.e4.lifecycle;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.fx.ui.lifecycle.annotations.PreClose;
+import org.eclipse.fx.ui.lifecycle.annotations.PreShow;
+
+public class MenuLifecycle {
+
+ private MDirectMenuItem ds;
+
+ @PreClose
+ void closeingMenu(MMenu m) {
+ ds.getParent().getChildren().remove(ds);
+ }
+
+ @PreShow
+ void openingMenu(MMenu m, EModelService ms) {
+ ds = ms.createModelElement(MDirectMenuItem.class);
+ ds.setLabel("Dynamic Item");
+ m.getChildren().add(0,ds);
+ }
+}
diff --git a/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/SecondLifeCycle.java b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/SecondLifeCycle.java
new file mode 100644
index 000000000..cbc4e618f
--- /dev/null
+++ b/testcases/org.eclipse.fx.testcases.e4/src/org/eclipse/fx/testcases/e4/lifecycle/SecondLifeCycle.java
@@ -0,0 +1,20 @@
+package org.eclipse.fx.testcases.e4.lifecycle;
+
+import javafx.stage.Stage;
+
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.fx.ui.dialogs.MessageDialog;
+import org.eclipse.fx.ui.lifecycle.annotations.PreClose;
+import org.eclipse.fx.ui.workbench.renderers.base.widget.WWindow;
+
+public class SecondLifeCycle {
+
+
+ @SuppressWarnings("rawtypes")
+ @PreClose
+ public boolean ph(MWindow win){
+ MessageDialog.openErrorDialog((Stage)((WWindow)win.getWidget()).getWidget(),
+ "Sorry again", "Sorry again, no close.");
+ return false;
+ }
+} \ No newline at end of file

Back to the top