Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2015-11-26 12:22:46 +0000
committerTom Schindl2015-11-26 12:22:46 +0000
commit710e03f2730953df07134ea865100ac8732f8cf6 (patch)
tree143efc32643b1194238560b8ee19423d46f22629
parente59dba6a1cd21e1fcb881986278acf6589dbf7dd (diff)
downloadorg.eclipse.efxclipse-710e03f2730953df07134ea865100ac8732f8cf6.tar.gz
org.eclipse.efxclipse-710e03f2730953df07134ea865100ac8732f8cf6.tar.xz
org.eclipse.efxclipse-710e03f2730953df07134ea865100ac8732f8cf6.zip
Bug 409340 - [e4] Add support for min/max
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.project5
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.settings/ca.ecliptical.pde.ds.prefs5
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/META-INF/MANIFEST.MF3
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction.xml8
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/build.properties3
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/MinMaxAddon.java176
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/MaximizationServiceContextFunction.java (renamed from bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/MaximizationServiceContextFunction.java)15
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/PerspectiveMaximizationServiceImpl.java (renamed from bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/PerspectiveMaximizationServiceImpl.java)2
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/widget/WMinMaxableWidget.java17
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/META-INF/MANIFEST.MF3
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/OSGI-INF/perspectivemaximizationfunction.xml8
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefStackRenderer.java20
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/MinMaxGroup.java162
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/StyleableMinMaxGroup.java89
14 files changed, 128 insertions, 388 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.project b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.project
index b3fdd94e2..fa0906ca2 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.project
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.settings/ca.ecliptical.pde.ds.prefs b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.settings/ca.ecliptical.pde.ds.prefs
new file mode 100644
index 000000000..3c38f2952
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/.settings/ca.ecliptical.pde.ds.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+enabled=true
+path=OSGI-INF/services
+validationErrorLevel=error
+validationErrorLevel.missingImplicitUnbindMethod=error
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/META-INF/MANIFEST.MF
index e30ab960b..fdc068d9c 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/META-INF/MANIFEST.MF
@@ -27,6 +27,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.fx.ui.workbench.base.rendering;version="2.2.0",
org.eclipse.fx.ui.workbench.services;version="2.2.0",
org.eclipse.fx.ui.workbench.services.lifecycle.annotation;version="2.2.0",
+ org.osgi.service.component.annotations;version="1.2.0";resolution:=optional,
org.osgi.service.event;version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.fx.ui.workbench.renderers.base;version="2.2.0";x-friends:="org.eclipse.fx.ui.workbench.renderers.fx",
@@ -34,3 +35,5 @@ Export-Package: org.eclipse.fx.ui.workbench.renderers.base;version="2.2.0";x-fri
org.eclipse.fx.ui.workbench.renderers.base.services;version="2.2.0";x-friends:="org.eclipse.fx.ui.workbench.renderers.fx",
org.eclipse.fx.ui.workbench.renderers.base.widget;version="2.2.0";x-friends:="org.eclipse.fx.ui.workbench.renderers.fx"
Bundle-Vendor: Eclipse.org
+Service-Component: OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction.xml
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction.xml b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction.xml
new file mode 100644
index 000000000..4e42aa289
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction.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.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction">
+ <property name="service.context.key" value="org.eclipse.fx.ui.workbench.renderers.base.services.MaximizationService"/>
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+ <implementation class="org.eclipse.fx.ui.workbench.renderers.base.internal.MaximizationServiceContextFunction"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/build.properties b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/build.properties
index 17daa5b49..b8bb95d7f 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/build.properties
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/build.properties
@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- about.html
+ about.html,\
+ OSGI-INF/
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/MinMaxAddon.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/MinMaxAddon.java
index ca672b7c4..9c6fe0f33 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/MinMaxAddon.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/MinMaxAddon.java
@@ -10,142 +10,114 @@
*******************************************************************************/
package org.eclipse.fx.ui.workbench.renderers.base.addons;
-import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
-import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
-import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.UIEvents.EventTags;
-import org.eclipse.fx.ui.workbench.renderers.base.widget.WCallback;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.fx.ui.workbench.renderers.base.services.MaximizationService;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WMinMaxableWidget;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WMinMaxableWidget.WMinMaxState;
+import org.eclipse.fx.ui.workbench.renderers.base.widget.WWidget.WidgetState;
+import org.eclipse.jdt.annotation.NonNull;
import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
/**
* Addon for a MinMax support
*/
public class MinMaxAddon {
- @Inject
- IEventBroker eventBroker;
-
static String MINIMIZED = IPresentationEngine.MINIMIZED;
static String MAXIMIZED = IPresentationEngine.MAXIMIZED;
- private EventHandler widgetListener = new EventHandler() {
-
- @Override
- public void handleEvent(Event event) {
- final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ private final EModelService modelService;
- if (!(changedElement instanceof MPartStack) && !(changedElement instanceof MArea))
- return;
-
- WMinMaxableWidget widget = getWidget(changedElement);
+ @Inject
+ MinMaxAddon(IEventBroker eventBroker, EModelService modelService) {
+ this.modelService = modelService;
+ eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, this::handleWidget);
+ eventBroker.subscribe(UIEvents.ElementContainer.TOPIC_CHILDREN, this::handleChildrenChanged);
+ eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, this::handleVisibleChildrenChanged);
+ eventBroker.subscribe(UIEvents.UIElement.TOPIC_VISIBLE, this::handleVisibleChildrenChanged);
+ }
- if (widget == null) {
- return;
+ void handleChildrenChanged(Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if( changedElement instanceof MElementContainer<?> ) {
+ // TODO we also need to check for visiblity!!!!
+ if( this.modelService.toBeRenderedCount((MElementContainer<?>) changedElement) == 0 ) {
+ handleMinMaxCallback(WMinMaxState.RESTORE, changedElement);
}
+ }
+ }
- adjustState(changedElement, widget);
- widget.setMinMaxCallback(new WCallback<WMinMaxableWidget.WMinMaxState, Void>() {
-
- @Override
- public Void call(WMinMaxState param) {
- return null;
- }
- });
+ void handleVisibleChildrenChanged(Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if( ! changedElement.isToBeRendered() || ! changedElement.isVisible() ) {
+ handleMinMaxCallback(WMinMaxState.RESTORE, changedElement);
}
- private void adjustState(MUIElement changedElement, WMinMaxableWidget widget) {
- if (changedElement.getTags().contains(MAXIMIZED)) {
- widget.setMinMaxState(WMinMaxState.MAXIMIZED);
- } else if (changedElement.getTags().contains(MINIMIZED)) {
- widget.setMinMaxState(WMinMaxState.MINIMIZED);
- } else {
- widget.setMinMaxState(WMinMaxState.RESTORED);
+ if( changedElement.getParent() != null ) {
+ // TODO we also need to check for visiblity!!!!
+ if( this.modelService.toBeRenderedCount((MElementContainer<?>) changedElement.getParent()) == 0 ) {
+ handleMinMaxCallback(WMinMaxState.RESTORE, changedElement.getParent());
}
}
+ }
- // private void
- // adjustState(MUIElement
- // element) {
- // if (!(element instanceof
- // MPartStack) && !(element
- // instanceof MPlaceholder))
- // return;
- //
- // WMinMaxableWidget ctf =
- // getWidget(element);
- // if (ctf == null)
- // return;
- //
- // if (element instanceof
- // MPlaceholder) {
- // setCTFButtons(ctf, element,
- // false);
- // } else {
- // MArea area =
- // getAreaFor((MPartStack)
- // element);
- // if (area == null) {
- // setCTFButtons(ctf, element,
- // false);
- // }
- // }
- // }
- //
- // private void
- // setCTFButtons(WMinMaxableWidget
- // ctf, MUIElement stateElement,
- // boolean hideButtons) {
- // if (hideButtons) {
- // ctf.setMinMaxState();
- // ctf.setMinimizeVisible(false);
- // ctf.setMaximizeVisible(false);
- // } else {
- // if
- // (stateElement.getTags().contains(MINIMIZED))
- // {
- // ctf.setMinimizeVisible(false);
- // ctf.setMaximizeVisible(true);
- // ctf.setMaximized(true);
- // } else if
- // (stateElement.getTags().contains(MAXIMIZED))
- // {
- // ctf.setMinimizeVisible(true);
- // ctf.setMaximizeVisible(true);
- // ctf.setMaximized(true);
- // } else {
- // ctf.setMinimizeVisible(true);
- // ctf.setMaximizeVisible(true);
- // ctf.setMinimized(false);
- // ctf.setMaximized(false);
- // ctf.layout();
- // }
- // }
- // }
+ void handleWidget(Event event) {
+ final MUIElement changedElement = (MUIElement) event.getProperty(EventTags.ELEMENT);
+ if( changedElement != null ) {
+ WMinMaxableWidget widget = getTargetWidget(changedElement);
- private WMinMaxableWidget getWidget(MUIElement changedElement) {
- if (changedElement instanceof MPlaceholder) {
- return getWidget(((MPlaceholder) changedElement).getRef());
+ if( widget != null ) {
+ widget.setMinMaxCallback( s -> handleMinMaxCallback(s, changedElement) );
}
+ }
+ }
+
+ Void handleMinMaxCallback( WMinMaxState state, @NonNull MUIElement changedElement ) {
+ IEclipseContext context;
+ if( changedElement instanceof MContext ) {
+ context = ((MContext)changedElement).getContext();
+ } else {
+ context = this.modelService.getContainingContext(changedElement);
+ }
- if (changedElement.getWidget() instanceof WMinMaxableWidget) {
- return (WMinMaxableWidget) changedElement.getWidget();
+ MaximizationService maximizationService = context.get(MaximizationService.class);
+ if( state == WMinMaxState.TOGGLE ) {
+ if( maximizationService.isMaximized(changedElement) ) {
+ maximizationService.restore();
+ } else {
+ maximizationService.maximize(changedElement);
+ }
+ } else if( state == WMinMaxState.MAXIMIZE ) {
+ if( ! maximizationService.isMaximized(changedElement) ) {
+ maximizationService.maximize(changedElement);
+ }
+ } else {
+ if( maximizationService.isMaximized(changedElement) ) {
+ maximizationService.restore();
}
- return null;
}
- };
+ return null;
+ }
- @PostConstruct
- void hookListeners() {
- this.eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, this.widgetListener);
+ private WMinMaxableWidget getTargetWidget(MUIElement changedElement) {
+ if (changedElement instanceof MPlaceholder) {
+ return getTargetWidget(((MPlaceholder) changedElement).getRef());
+ }
+
+ if (changedElement.getWidget() instanceof WMinMaxableWidget) {
+ return (WMinMaxableWidget) changedElement.getWidget();
+ }
+ return null;
}
}
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/MaximizationServiceContextFunction.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/MaximizationServiceContextFunction.java
index 494f1268a..c36bd19cd 100644
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/MaximizationServiceContextFunction.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/MaximizationServiceContextFunction.java
@@ -8,32 +8,35 @@
* Contributors:
* Sun Volland<sun.volland@free.fr>
*******************************************************************************/
-package org.eclipse.fx.ui.workbench.renderers.fx.internal;
+package org.eclipse.fx.ui.workbench.renderers.base.internal;
+import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.osgi.service.component.annotations.Component;
/**
* Context function to resolve the maximization service for the current perspective.
*/
-public class MaximizationServiceContextFunction implements IContextFunction {
+@Component(service=IContextFunction.class,property="service.context.key=org.eclipse.fx.ui.workbench.renderers.base.services.MaximizationService")
+public class MaximizationServiceContextFunction extends ContextFunction {
@Override
public Object compute(IEclipseContext context, String contextKey) {
-
+
// find MPerspective
- MPerspective perspective = findPerspective(context);
+ MPerspective perspective = findPerspective(context);
if(perspective == null) {
MApplication mApp = context.get(MApplication.class);
if(mApp != null) {
perspective = findPerspective(mApp.getContext().getActiveLeaf());
}
}
-
+
PerspectiveMaximizationServiceImpl service = null;
if (perspective != null) {
IEclipseContext perspectiveContext = perspective.getContext();
@@ -45,7 +48,7 @@ public class MaximizationServiceContextFunction implements IContextFunction {
}
return service;
}
-
+
/**
* Returns the context's perspective, if any.
* @param context Context
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/PerspectiveMaximizationServiceImpl.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/PerspectiveMaximizationServiceImpl.java
index a4aea5f26..a5de632c6 100644
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/internal/PerspectiveMaximizationServiceImpl.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/internal/PerspectiveMaximizationServiceImpl.java
@@ -8,7 +8,7 @@
* Contributors:
* Sun Volland<sun.volland@free.fr>
*******************************************************************************/
-package org.eclipse.fx.ui.workbench.renderers.fx.internal;
+package org.eclipse.fx.ui.workbench.renderers.base.internal;
import javax.inject.Inject;
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/widget/WMinMaxableWidget.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/widget/WMinMaxableWidget.java
index d27817d74..fd6914f6b 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/widget/WMinMaxableWidget.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/widget/WMinMaxableWidget.java
@@ -20,34 +20,27 @@ public interface WMinMaxableWidget {
* The current state
*/
public enum WMinMaxState {
- /**
- * no min/max
- */
- NONE,
- /**
- * Minimized
- */
- MINIMIZED,
+ TOGGLE,
/**
* Maximized
*/
- MAXIMIZED,
+ MAXIMIZE,
/**
* Restored
*/
- RESTORED
+ RESTORE
}
/**
* Set callback to be invoked when the state changes
- *
+ *
* @param minMaxCallback
* the callback
*/
public void setMinMaxCallback(@NonNull WCallback<WMinMaxState, Void> minMaxCallback);
/**
- *
+ *
* @param state
*/
public void setMinMaxState(@NonNull WMinMaxState state);
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/META-INF/MANIFEST.MF
index 745d5eb6a..66110cb18 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/META-INF/MANIFEST.MF
@@ -44,8 +44,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.fx.ui.workbench.services;version="2.2.0"
Service-Component: OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.fx.internal.FXDialogServiceFunction.xml,
OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.fx.internal.DefaultDnDFeedback.xml,
- OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.fx.internal.PartPopupMenuServiceFunction.xml,
- OSGI-INF/perspectivemaximizationfunction.xml
+ OSGI-INF/services/org.eclipse.fx.ui.workbench.renderers.fx.internal.PartPopupMenuServiceFunction.xml
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.fx.ui.workbench.renderers.fx,
org.eclipse.fx.ui.workbench.renderers.fx.internal;x-internal:=true,
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/OSGI-INF/perspectivemaximizationfunction.xml b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/OSGI-INF/perspectivemaximizationfunction.xml
deleted file mode 100644
index c8c467986..000000000
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/OSGI-INF/perspectivemaximizationfunction.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.ui.workbench.renderers.fx.perspectivemaximization">
- <implementation class="org.eclipse.fx.ui.workbench.renderers.fx.internal.MaximizationServiceContextFunction"/>
- <service>
- <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
- </service>
- <property name="service.context.key" type="String" value="org.eclipse.fx.ui.workbench.renderers.base.services.MaximizationService"/>
-</scr:component>
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefStackRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefStackRenderer.java
index 84fa33490..056c1569f 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefStackRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefStackRenderer.java
@@ -45,6 +45,8 @@ import com.google.common.base.Strings;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
+import javafx.collections.ListChangeListener;
+import javafx.collections.ListChangeListener.Change;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.Node;
@@ -78,7 +80,7 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
WCallback<WStackItem<Object, Node>, Void> keySelectedItemCallback;
WCallback<@NonNull DragData, @NonNull Boolean> dragStartCallback;
- // private WCallback<WMinMaxState, Void> minMaxCallback;
+ private WCallback<WMinMaxState, Void> minMaxCallback;
// private MinMaxGroup minMaxGroup;
boolean inKeyTraversal;
@@ -88,7 +90,7 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
@Inject
@NonNull
DnDFeedbackService dndFeedback;
-
+
@Inject
@Optional
@Nullable
@@ -97,7 +99,7 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
@NonNull
@Inject
ModelService modelService;
-
+
@NonNull
private final MPartStack domainElement;
@@ -146,7 +148,7 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
@Override
public void setMinMaxCallback(WCallback<WMinMaxState, Void> minMaxCallback) {
- // this.minMaxCallback = minMaxCallback;
+ this.minMaxCallback = minMaxCallback;
}
@Override
@@ -169,7 +171,7 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
// }
}
- @Override
+ @Override
protected TabPane createWidget() {
DnDSupport dnd = new DnDSupport(
(param) -> this.dragStartCallback,
@@ -185,6 +187,14 @@ public class DefStackRenderer extends BaseStackRenderer<Node, Object, Node> {
s.setClipboardDataFunction(dnd::clipboardDataFunction);
});
+ p.setOnMouseClicked( e -> {
+ if( e.getClickCount() > 1 ) {
+ if( this.minMaxCallback != null ) {
+ this.minMaxCallback.call(WMinMaxState.TOGGLE);
+ }
+ }
+ });
+
if (this.domainElement.getTags().contains(WStack.TAG_TAB_CLOSING_POLICY_ALL_TABS)) {
p.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
}
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/MinMaxGroup.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/MinMaxGroup.java
deleted file mode 100644
index ca4a2f717..000000000
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/MinMaxGroup.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * 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.ui.workbench.renderers.fx.widget;
-
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleObjectProperty;
-import javafx.scene.Group;
-import javafx.scene.Node;
-import javafx.scene.layout.HBox;
-import javafx.scene.paint.Color;
-import javafx.scene.shape.Rectangle;
-
-import org.eclipse.fx.ui.workbench.renderers.base.widget.WMinMaxableWidget.WMinMaxState;
-
-/**
- * A min-max group implementation
- */
-public class MinMaxGroup extends HBox {
-
- /**
- * maximize graphic
- */
- protected ObjectProperty<Node> maximizeGraphic = new SimpleObjectProperty<>(this, "maximizeGraphic"); //$NON-NLS-1$
- /**
- * minimize graphic
- */
- protected ObjectProperty<Node> minimizeGraphic = new SimpleObjectProperty<>(this, "minimizeGraphic"); //$NON-NLS-1$
- /**
- * restore graphic
- */
- protected ObjectProperty<Node> restoreGraphic = new SimpleObjectProperty<>(this, "restoreGraphic"); //$NON-NLS-1$
-
- // private static Logger LOGGER =
- // LoggerCreator.createLogger(MinMaxGroup.class);
-
- /**
- *
- */
- public MinMaxGroup() {
- this.maximizeGraphic.set(createMaxIcon());
- this.minimizeGraphic.set(createMinIcon());
- this.restoreGraphic.set(createRestoreIcon());
-
- getChildren().setAll(this.minimizeGraphic.get(), this.maximizeGraphic.get());
-
- }
-
- private static Node createMaxIcon() {
- Group g = new Group();
-
- Rectangle r = new Rectangle(10, 10, Color.WHITE);
- r.setStrokeWidth(1.0);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- r = new Rectangle(10, 2, Color.WHITE);
- r.setStrokeWidth(1.0);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- return g;
- }
-
- private static Node createMinIcon() {
- Rectangle r = new Rectangle(10, 3, Color.WHITE);
- r.setStrokeWidth(1.0);
- r.setStroke(Color.BLACK);
- return r;
- }
-
- private static Node createRestoreIcon() {
- Group g = new Group();
-
- Rectangle r = new Rectangle(5, 0, 5, 5);
- r.setFill(Color.WHITE);
- r.setStrokeWidth(1.0);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- r = new Rectangle(5, 0, 5, 1);
- r.setFill(Color.BLACK);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- r = new Rectangle(3, 3, 5, 5);
- r.setFill(Color.WHITE);
- r.setStrokeWidth(1.0);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- r = new Rectangle(3, 3, 5, 1);
- r.setFill(Color.BLACK);
- r.setStroke(Color.BLACK);
- g.getChildren().add(r);
-
- return g;
- }
-
- // private static final Node getImageView(String iconName) {
- // String path = "/icons/"+iconName+".png";
- // try(InputStream in = MinMaxGroup.class.getResourceAsStream(path)) {
- // return new ImageView(new Image(in));
- // } catch (IOException e) {
- // LOGGER.error("Unable to load '"+path+"'", e);
- // }
- // return null;
- // }
-
- /**
- * @return maximize property
- */
- public ObjectProperty<Node> maximizeGraphicProperty() {
- return this.maximizeGraphic;
- }
-
- /**
- * @return minimize property
- */
- public ObjectProperty<Node> minimizeGraphicProperty() {
- return this.minimizeGraphic;
- }
-
- /**
- * @return restore properts
- */
- public ObjectProperty<Node> restoreGraphicProperty() {
- return this.restoreGraphic;
- }
-
- /**
- * Update the state
- *
- * @param state
- * the new state
- */
- public void setState(WMinMaxState state) {
- switch (state) {
- case NONE:
- getChildren().clear();
- break;
- case MAXIMIZED:
- getChildren().setAll(this.minimizeGraphic.get(), this.restoreGraphic.get());
- break;
- case MINIMIZED:
- getChildren().setAll(this.restoreGraphic.get());
- break;
- case RESTORED:
- getChildren().setAll(this.minimizeGraphic.get(), this.maximizeGraphic.get());
- break;
- default:
- break;
- }
- }
-}
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/StyleableMinMaxGroup.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/StyleableMinMaxGroup.java
deleted file mode 100644
index c908f8293..000000000
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/widget/StyleableMinMaxGroup.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * 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.ui.workbench.renderers.fx.widget;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javafx.beans.property.StringProperty;
-import javafx.beans.value.WritableValue;
-import javafx.css.CssMetaData;
-import javafx.css.StyleConverter;
-import javafx.css.Styleable;
-import javafx.css.StyleableProperty;
-import javafx.css.StyleableStringProperty;
-import javafx.scene.layout.StackPane;
-
-/**
- * A min-max group implementation
- */
-public class StyleableMinMaxGroup extends MinMaxGroup {
- private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
-
- static final CssMetaData<StyleableMinMaxGroup, String> MAXIMIZE_GRAPHIC = new CssMetaData<StyleableMinMaxGroup, String>("-fx-graphic", //$NON-NLS-1$
- StringConverter.INSTANCE) {
-
- @Override
- public boolean isSettable(StyleableMinMaxGroup n) {
- // Note that we care about the graphic, not imageUrl
- return n.maximizeGraphic == null || !n.maximizeGraphic.isBound();
- }
-
- @Override
- public StyleableProperty<String> getStyleableProperty(StyleableMinMaxGroup n) {
- return (StyleableProperty<String>) (WritableValue<String>) n.maximizeUrlProperty();
- }
- };
-
- static {
- final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<CssMetaData<? extends Styleable, ?>>(StackPane.getClassCssMetaData());
- STYLEABLES = Collections.unmodifiableList(styleables);
- }
-
- @Override
- public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
- return STYLEABLES;
- }
-
- private StringProperty maximizeUrl;
-
- /**
- * @return url to maximize icon property
- */
- public StringProperty maximizeUrlProperty() {
- if (this.maximizeUrl == null) {
- this.maximizeUrl = new StyleableStringProperty() {
-
- @Override
- public CssMetaData<? extends Styleable, String> getCssMetaData() {
- return MAXIMIZE_GRAPHIC;
- }
-
- @Override
- public Object getBean() {
- return StyleableMinMaxGroup.this;
- }
-
- @Override
- public String getName() {
- return "maximizeUrl"; //$NON-NLS-1$
- }
-
- };
- }
- return this.maximizeUrl;
- }
-
- static class StringConverter extends StyleConverter<String, String> {
- final static StringConverter INSTANCE = new StringConverter();
- }
-}

Back to the top