Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-05-12 10:44:08 -0400
committerTom Schindl2014-05-12 10:44:08 -0400
commit5768f363b6401d97e48e6b064f1ccbfabe49d3a2 (patch)
treed16d15d8fd8fc53a748ed7f3d6ce59db8a6041ff
parentac779f17c6a67937c6c6ff85685b7b9cf33a2007 (diff)
downloadorg.eclipse.efxclipse-5768f363b6401d97e48e6b064f1ccbfabe49d3a2.tar.gz
org.eclipse.efxclipse-5768f363b6401d97e48e6b064f1ccbfabe49d3a2.tar.xz
org.eclipse.efxclipse-5768f363b6401d97e48e6b064f1ccbfabe49d3a2.zip
Bug 434228 - [e4] Add support for DnD of Parts
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/DnDAddon.java25
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/css/efx-default.css6
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefPartRenderer.java4
3 files changed, 27 insertions, 8 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/DnDAddon.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/DnDAddon.java
index ca481e211..9e86c50a3 100644
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/DnDAddon.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/addons/DnDAddon.java
@@ -1,11 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.base.addons;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
-import javafx.application.Platform;
-
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@@ -15,7 +23,6 @@ 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.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.UIEvents.EventTags;
@@ -29,7 +36,12 @@ import org.eclipse.fx.ui.workbench.renderers.base.widget.WMinMaxableWidget;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WStack;
import org.osgi.service.event.Event;
+/**
+ * Addon who enables drag for {@link MPartStack}
+ */
public class DnDAddon {
+ private static String CSS_CLASS_STACK_MOVE = "stack-move"; //$NON-NLS-1$
+
@Inject
IEventBroker eventBroker;
@@ -42,6 +54,9 @@ public class DnDAddon {
//FIXME This is workaround because of TabFolder problems
private Timer timer;
+ /**
+ * Create an instance
+ */
public DnDAddon() {
this.timer = new Timer(true);
}
@@ -92,7 +107,7 @@ public class DnDAddon {
if( sourceContainer == targetContainer ) {
try {
- targetContainer.getTags().add("tabPaneMove");
+ targetContainer.getTags().add(CSS_CLASS_STACK_MOVE);
d.sourceElement.getTransientData().put(BaseStackRenderer.MAP_MOVE, Boolean.TRUE);
List<MUIElement> children = targetContainer.getChildren();
children.remove(d.sourceElement);
@@ -109,7 +124,7 @@ public class DnDAddon {
}
} finally {
d.sourceElement.getTransientData().put(BaseStackRenderer.MAP_MOVE, Boolean.TRUE);
- targetContainer.getTags().remove("tabPaneMove");
+ targetContainer.getTags().remove(CSS_CLASS_STACK_MOVE);
}
} else {
int idx = targetContainer.getChildren().indexOf(d.reference);
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/css/efx-default.css b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/css/efx-default.css
index fda017837..c0845d7b2 100644
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/css/efx-default.css
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/css/efx-default.css
@@ -1,3 +1,7 @@
-.tabPaneMove {
+.stack-move {
-fx-close-tab-animation: NONE
+}
+
+.part-expand-group {
+ -fx-background-color: gray
} \ No newline at end of file
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefPartRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefPartRenderer.java
index 32d9af7eb..093845ce8 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefPartRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefPartRenderer.java
@@ -51,6 +51,7 @@ public class DefPartRenderer extends BasePartRenderer<Pane, Node, Node> {
private static final String CSS_CLASS_PART_CONTENT = "part-content"; //$NON-NLS-1$
private static final String CSS_CLASS_VIEW_TOOLBAR_CONTAINER = "view-toolbar-container"; //$NON-NLS-1$
private static final String CSS_CLASS_VIEW_TOOLBAR = "view-toolbar"; //$NON-NLS-1$
+ private static final String CSS_CLASS_PART_EXPAND_GROUNP = "part-expand-group"; //$NON-NLS-1$
@Override
protected Class<? extends WPart<Pane, Node, Node>> getWidgetClass(MPart part) {
@@ -155,8 +156,7 @@ public class DefPartRenderer extends BasePartRenderer<Pane, Node, Node> {
this.menuGroup.setManaged(false);
this.expandGroup = new StackPane();
- // FIXME This should be moved to css
- this.expandGroup.setStyle("-fx-background-color: gray");
+ this.expandGroup.getStyleClass().add(CSS_CLASS_PART_EXPAND_GROUNP);
this.expandGroup.setOpacity(0.5);
Node handler = new HandleGroup();// new ImageView(new
// Image(getClass().getClassLoader().getResourceAsStream("/icons/format-line-spacing-normal.png")));

Back to the top