Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-10-25 08:52:39 -0400
committerCamille Letavernier2013-10-25 08:52:39 -0400
commitae9a77366a9e91072aaa82b95c616d4c2ae1bfb2 (patch)
treea7f8b2e026da7a863343fe84692123298404a10c /plugins
parentaecf191656a393812cfef4db500e474d25f6211f (diff)
downloadorg.eclipse.papyrus-ae9a77366a9e91072aaa82b95c616d4c2ae1bfb2.tar.gz
org.eclipse.papyrus-ae9a77366a9e91072aaa82b95c616d4c2ae1bfb2.tar.xz
org.eclipse.papyrus-ae9a77366a9e91072aaa82b95c616d4c2ae1bfb2.zip
419965: Display of the name must be optional
https://bugs.eclipse.org/bugs/show_bug.cgi?id=419965
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/NodeEditPart.java11
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusCompartmentEditPart.java8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java7
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ResizeableListCompartmentEditPart.java8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ShapeDisplayCompartmentEditPart.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java156
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/MaintainSymbolRatioEditPolicy.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NameDisplayEditPolicy.java83
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java23
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/BorderDisplayEditPolicy.java182
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/NameDisplayEditPolicy.java136
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ConstraintFigure.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/IPapyrusNodeNamedElementFigure.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/QualifiedNameWrappingLabelFigure.java10
16 files changed, 347 insertions, 335 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/NodeEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/NodeEditPart.java
index 238d9987870..f6389cb3bd4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/NodeEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/NodeEditPart.java
@@ -21,7 +21,8 @@ import org.eclipse.gmf.runtime.notation.FillStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.papyrus.infra.emf.appearance.helper.ShadowFigureHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.swt.graphics.Color;
@@ -169,6 +170,12 @@ public abstract class NodeEditPart extends AbstractBorderedShapeEditPart impleme
* Refresh the shadow of the figure
*/
protected final void refreshShadow() {
- getPrimaryShape().setShadow(ShadowFigureHelper.getShadowFigureValue((View)getModel()));
+ getPrimaryShape().setShadow(AppearanceHelper.showShadow((View)getModel()));
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusCompartmentEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusCompartmentEditPart.java
index 725c5945883..d33246ef1a1 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusCompartmentEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusCompartmentEditPart.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.infra.gmfdiag.common.editpart;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
public abstract class PapyrusCompartmentEditPart extends CompartmentEditPart {
@@ -26,4 +27,11 @@ public abstract class PapyrusCompartmentEditPart extends CompartmentEditPart {
return false;
}
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
+
+ }
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
index e2d6cca2167..170e5e4b174 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.infra.gmfdiag.common.editpart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
public abstract class PapyrusLabelEditPart extends LabelEditPart {
@@ -21,4 +22,10 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
super(view);
}
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+
+ installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ResizeableListCompartmentEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ResizeableListCompartmentEditPart.java
index 99a3a617d58..eeec5ecb6ae 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ResizeableListCompartmentEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ResizeableListCompartmentEditPart.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
public abstract class ResizeableListCompartmentEditPart extends ListCompartmentEditPart {
@@ -69,4 +70,11 @@ public abstract class ResizeableListCompartmentEditPart extends ListCompartmentE
return false;
}
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+
+ installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
+ }
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ShapeDisplayCompartmentEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ShapeDisplayCompartmentEditPart.java
index 2115cb36863..0768199a0c6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ShapeDisplayCompartmentEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/ShapeDisplayCompartmentEditPart.java
@@ -38,6 +38,7 @@ import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.BorderDisplayEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.MaintainSymbolRatioEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.BorderedScalableImageFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.ScalableCompartmentFigure;
@@ -90,6 +91,7 @@ public class ShapeDisplayCompartmentEditPart extends ResizableCompartmentEditPar
// Start of user code custom edit policies
installEditPolicy(ShapeRefreshEditPolicy.SHAPE_REFRESH_EDIT_POLICY_ROLE, new ShapeRefreshEditPolicy());
installEditPolicy(MaintainSymbolRatioEditPolicy.MAINTAIN_SYMBOL_RATIO_EDITPOLICY, new MaintainSymbolRatioEditPolicy());
+ installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
// End of user code
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java
new file mode 100644
index 00000000000..4ccdeb1d9f2
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/BorderDisplayEditPolicy.java
@@ -0,0 +1,156 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.draw2d.Border;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.OneLineBorder;
+import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomBooleanStyleObservableValue;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
+
+/**
+ * this edit policy has in charge to display the border of node NodeNamedElement
+ * associated figure has to be a {@link NodeNamedElementFigure}
+ */
+public class BorderDisplayEditPolicy extends GraphicalEditPolicyEx implements IChangeListener {
+
+ public static final String DISPLAY_BORDER = "displayBorder";
+
+ /** key for this edit policy */
+ public final static String BORDER_DISPLAY_EDITPOLICY = "BORDER_DISPLAY_EDITPOLICY";
+
+ protected IObservableValue styleObservable;
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void activate() {
+ // retrieve the view and the element managed by the edit part
+ View view = (View)getHost().getModel();
+ if(view == null) {
+ return;
+ }
+
+ styleObservable = new CustomBooleanStyleObservableValue(view, EMFHelper.resolveEditingDomain(view), DISPLAY_BORDER);
+ styleObservable.addChangeListener(this);
+
+ getHost().refresh();
+ }
+
+
+ /**
+ *
+ * @param currentView
+ * @return the current Style that reperesent the boder
+ */
+ protected BooleanValueStyle getMaintainSymbolRatioStyle(View currentView) {
+ return (BooleanValueStyle)currentView.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_BORDER);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void deactivate() {
+ if(styleObservable != null) {
+ styleObservable.removeChangeListener(this);
+ styleObservable.dispose();
+ styleObservable = null;
+ }
+ }
+
+ @Override
+ public void handleChange(ChangeEvent event) {
+ getHost().refresh();
+ }
+
+ @Override
+ public void refresh() {
+ refreshBorderDisplay();
+ }
+
+ protected IFigure getPrimaryShape() {
+ EditPart host = getHost();
+ if(host instanceof IPapyrusEditPart) {
+ IPapyrusEditPart graphicalHost = (IPapyrusEditPart)host;
+ return graphicalHost.getPrimaryShape();
+ }
+
+ return getHostFigure();
+ }
+
+ protected View getNotationView() {
+ EditPart host = getHost();
+ if(host instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) {
+ return ((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart)host).getNotationView();
+ }
+
+ View view = (View)host.getAdapter(View.class);
+ return view;
+ }
+
+ protected Border defaultBorder;
+
+ protected void refreshBorderDisplay() {
+ View view = getNotationView();
+ if(view == null) {
+ return;
+ }
+
+ BooleanValueStyle displayBorderStyle = (BooleanValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), BorderDisplayEditPolicy.DISPLAY_BORDER);
+
+ if(displayBorderStyle != null && !displayBorderStyle.isBooleanValue()) {
+ if(defaultBorder == null) {
+ defaultBorder = getPrimaryShape().getBorder();
+ }
+ getPrimaryShape().setBorder(null);
+
+ for(Object currentEditPart : getHost().getChildren()) {
+ if(currentEditPart instanceof ResizableCompartmentEditPart) {
+ ((ResizableCompartmentEditPart)currentEditPart).getFigure().setBorder(null);
+ }
+
+ }
+
+
+ } else {
+ if(defaultBorder != null) {
+ getPrimaryShape().setBorder(defaultBorder);
+ }
+ defaultBorder = null;
+
+ for(Object currentEditPart : getHost().getChildren()) {
+ if(currentEditPart instanceof ResizableCompartmentEditPart) {
+ ((ResizableCompartmentEditPart)currentEditPart).getFigure().setBorder(new OneLineBorder());
+ }
+ }
+
+
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/MaintainSymbolRatioEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/MaintainSymbolRatioEditPolicy.java
index 2c060340437..1c51907504a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/MaintainSymbolRatioEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/MaintainSymbolRatioEditPolicy.java
@@ -36,10 +36,6 @@ public class MaintainSymbolRatioEditPolicy extends GraphicalEditPolicy implement
protected IObservableValue styleObservable;
- public MaintainSymbolRatioEditPolicy() {
- super();
- }
-
/**
*
* {@inheritDoc}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NameDisplayEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NameDisplayEditPolicy.java
new file mode 100644
index 00000000000..c16d4b69f7a
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NameDisplayEditPolicy.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomBooleanStyleObservableValue;
+
+/**
+ * this edit policy has in charge to display the name of node NodeNamedElement
+ * associated figure has to be a {@link NodeNamedElementFigure}
+ */
+public class NameDisplayEditPolicy extends GraphicalEditPolicy implements IChangeListener {
+
+ public static final String DISPLAY_NAME = "displayName";
+
+ /** key for this edit policy */
+ public final static String NAME_DISPLAY_EDITPOLICY = "NAME_DISPLAY_EDITPOLICY";
+
+ protected IObservableValue styleObservable;
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void activate() {
+ // retrieve the view and the element managed by the edit part
+ View view = (View)getHost().getModel();
+ if(view == null) {
+ return;
+ }
+
+ styleObservable = new CustomBooleanStyleObservableValue(view, EMFHelper.resolveEditingDomain(view), DISPLAY_NAME);
+ styleObservable.addChangeListener(this);
+ }
+
+
+ /**
+ *
+ * @param currentView
+ * @return the current Style that reperesent the boder
+ */
+ protected BooleanValueStyle getMaintainSymbolRatioStyle(View currentView) {
+ return (BooleanValueStyle)currentView.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_NAME);
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void deactivate() {
+ if(styleObservable != null) {
+ styleObservable.removeChangeListener(this);
+ styleObservable.dispose();
+ styleObservable = null;
+ }
+ }
+
+ @Override
+ public void handleChange(ChangeEvent event) {
+ getHost().refresh();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
index 40249ea5899..09dfaa19cb1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
@@ -92,7 +92,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
org.w3c.dom.svg,
org.apache.batik.css,
org.apache.batik.util,
- org.apache.batik.dom
+ org.apache.batik.dom,
+ org.eclipse.core.databinding;bundle-version="1.4.1"
Bundle-Vendor: %providerName
Ant-Version: Apache Ant 1.7.0
Bundle-Version: 0.10.1.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
index 34921ccf8fd..0e1e1937a78 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/NamedElementEditPart.java
@@ -14,10 +14,11 @@
package org.eclipse.papyrus.uml.diagram.common.editparts;
import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderDisplayEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.NameDisplayEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.NameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -66,6 +67,23 @@ public abstract class NamedElementEditPart extends UMLNodeEditPart implements IU
if(getNodeNamedElementFigure() != null && resolveSemanticElement() != null) {
refreshIconNamedLabel();
refreshFontColor();
+ refreshLabelDisplay();
+ }
+ }
+
+ @Override
+ public void activate() {
+ super.activate();
+ }
+
+
+ protected void refreshLabelDisplay() {
+ View view = getNotationView();
+ BooleanValueStyle displayNameStyle = (BooleanValueStyle)view.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), NameDisplayEditPolicy.DISPLAY_NAME);
+ if(displayNameStyle != null && !displayNameStyle.isBooleanValue()) {
+ getNodeNamedElementFigure().removeNameLabel();
+ } else {
+ getNodeNamedElementFigure().restoreNameLabel();
}
}
@@ -115,7 +133,6 @@ public abstract class NamedElementEditPart extends UMLNodeEditPart implements IU
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
installEditPolicy(NameDisplayEditPolicy.NAME_DISPLAY_EDITPOLICY, new NameDisplayEditPolicy());
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/BorderDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/BorderDisplayEditPolicy.java
deleted file mode 100644
index 45efd4385c7..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/BorderDisplayEditPolicy.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.editpolicies;
-
-import java.util.List;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.OneLineBorder;
-import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * this edit policy has in charge to display tthe border of node NodeNamedElement
- * associated figure has to be a {@link NodeNamedElementFigure}
- */
-public class BorderDisplayEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
-
- public static final String DISPLAY_BORDER = "displayBorder";
-
- /** key for this edit policy */
- public final static String BORDER_DISPLAY_EDITPOLICY = "BORDER_DISPLAY_EDITPOLICY";
-
- /** host semantic element */
- protected NamedElement hostSemanticNamedElement;
-
- /**
- * The parent listeners list
- */
- protected List<Object> parentListeners;
-
- private Border defaultBorder;
-
- /**
- * Creates a new QualifiedNameDisplayEditPolicy
- */
- public BorderDisplayEditPolicy() {
- super();
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void activate() {
- // retrieve the view and the element managed by the edit part
- View view = (View)getHost().getModel();
- if(view == null) {
- return;
- }
-
- // adds a listener on the view and the element controlled by the
- // editpart
- getDiagramEventBroker().addNotificationListener(view, this);
-
- EObject semanticElement = EMFHelper.getEObject(getHost());
- if(semanticElement instanceof NamedElement) {
- hostSemanticNamedElement = (NamedElement)semanticElement;
- }
-
- if(hostSemanticNamedElement == null) {
- return;
- }
- getDiagramEventBroker().addNotificationListener(hostSemanticNamedElement, this);
- if(getHost() instanceof NamedElementEditPart) {
- NamedElementEditPart namedElementEditPart = (NamedElementEditPart)getHost();
- defaultBorder = namedElementEditPart.getPrimaryShape().getBorder();
-
- }
- refreshBorder();
- }
-
- /**
- * refresh the qualified name
- */
- protected void refreshBorder() {
- if(getHost() instanceof NamedElementEditPart) {
- NamedElementEditPart namedElementEditPart = (NamedElementEditPart)getHost();
- BooleanValueStyle boderStyle = getBorderStyle(namedElementEditPart.getNotationView());
- if(boderStyle != null && boderStyle.isBooleanValue() == false) {
- namedElementEditPart.getPrimaryShape().setBorder(null);
- for(Object currentEditPart : namedElementEditPart.getChildren()) {
- if(currentEditPart instanceof ResizableCompartmentEditPart) {
- ((ResizableCompartmentEditPart)currentEditPart).getFigure().setBorder(null);
- }
-
- }
-
- } else {
- namedElementEditPart.getPrimaryShape().setBorder(defaultBorder);
- for(Object currentEditPart : namedElementEditPart.getChildren()) {
- if(currentEditPart instanceof ResizableCompartmentEditPart) {
- ((ResizableCompartmentEditPart)currentEditPart).getFigure().setBorder(new OneLineBorder());
- }
-
- }
- }
- }
- }
-
- /**
- *
- * @param currentView
- * @return the current Style that repersent the boder
- */
- protected BooleanValueStyle getBorderStyle(View currentView) {
- return (BooleanValueStyle)currentView.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_BORDER);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void deactivate() {
- // retrieve the view and the element managed by the edit part
- View view = (View)getHost().getModel();
- if(view == null) {
- return;
- }
- // remove notification on element and view
- getDiagramEventBroker().removeNotificationListener(view, this);
-
- }
-
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(theEditingDomain != null) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public void notifyChanged(Notification notification) {
- refreshBorder();
- }
-
-
- /**
- * Remove all parents listeners
- */
- public void removeParentListeners() {
- for(Object listener : parentListeners) {
- getDiagramEventBroker().removeNotificationListener((EObject)listener, this);
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/NameDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/NameDisplayEditPolicy.java
deleted file mode 100644
index 2b4983fc353..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/NameDisplayEditPolicy.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * 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:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.editpolicies;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
-
-/**
- * this edit policy has in charge to display the name of node NodeNamedElement
- * associated figure has to be a {@link NodeNamedElementFigure}
- */
-public class NameDisplayEditPolicy extends GraphicalEditPolicy implements NotificationListener, IPapyrusListener {
-
- public static final String DISPLAY_NAME = "displayName";
-
- /** key for this edit policy */
- public final static String NAME_DISPLAY_EDITPOLICY = "NAME_DISPLAY_EDITPOLICY";
-
- /**
- * Creates a new QualifiedNameDisplayEditPolicy
- */
- public NameDisplayEditPolicy() {
- super();
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void activate() {
- // retrieve the view and the element managed by the edit part
- View view = (View)getHost().getModel();
- if(view == null) {
- return;
- }
-
- // adds a listener on the view and the element controlled by the
- // editpart
- getDiagramEventBroker().addNotificationListener(view, this);
-
- refreshNameDisplay();
- }
-
- /**
- * refresh the qualified name
- */
- protected void refreshNameDisplay() {
- if(getHost() instanceof NamedElementEditPart) {
- NamedElementEditPart namedElementEditPart = (NamedElementEditPart)getHost();
-
- IFigure primaryShape = namedElementEditPart.getPrimaryShape();
- if(primaryShape instanceof NodeNamedElementFigure) {
-
- BooleanValueStyle nameStyle = getDisplayNameStyle(namedElementEditPart.getNotationView());
- if(nameStyle != null && nameStyle.isBooleanValue() == false) {
-
- ((NodeNamedElementFigure)primaryShape).removeNameLabel();
- } else {
- ((NodeNamedElementFigure)primaryShape).restoreNameLabel();
- }
- }
- }
- }
-
- /**
- *
- * @param currentView
- * @return the current Style that repersent the boder
- */
- protected BooleanValueStyle getDisplayNameStyle(View currentView) {
- return (BooleanValueStyle)currentView.getNamedStyle(NotationPackage.eINSTANCE.getBooleanValueStyle(), DISPLAY_NAME);
- }
-
- /**
- *
- * {@inheritDoc}
- */
- @Override
- public void deactivate() {
- // retrieve the view and the element managed by the edit part
- View view = (View)getHost().getModel();
- if(view == null) {
- return;
- }
- // remove notification on element and view
- getDiagramEventBroker().removeNotificationListener(view, this);
-
- }
-
-
- /**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(theEditingDomain != null) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
- /**
- *
- * {@inheritDoc}
- */
- public void notifyChanged(Notification notification) {
- refreshNameDisplay();
- }
-
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ConstraintFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ConstraintFigure.java
index 09c2efa5f70..646a062ed63 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ConstraintFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/ConstraintFigure.java
@@ -30,7 +30,9 @@ import org.eclipse.swt.graphics.Image;
public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNamedElementFigure, ILabelFigure, IMultilineEditableFigure {
private static final String CHEVRON = String.valueOf("\u00AB") + String.valueOf("\u00BB");
+
protected static final String LEFT_BRACE = "{";
+
private Label taggedLabel;
protected static final String RIGHT_BRACE = "}";
@@ -125,12 +127,13 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
return null;
}
- public ConstraintFigure( ) {
+ public ConstraintFigure() {
this(null);
}
- public ConstraintFigure( String tagLabel) {
+
+ public ConstraintFigure(String tagLabel) {
super();
-
+
nameLabel = new WrappingLabel();
nameLabel.setOpaque(false);
@@ -175,6 +178,7 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
this.add(taggedLabel, null, 0);
}
}
+
/**
*
* @see org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure#setDepth(int)
@@ -283,8 +287,7 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
* @param icon
*/
public void setIcon(Image icon) {
- // TODO Auto-generated method stub
-
+ //Nothing
}
/**
@@ -294,7 +297,6 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
* @return
*/
public Image getIcon() {
- // TODO Auto-generated method stub
return null;
}
@@ -304,8 +306,8 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
*
*
*/
+ @Override
public Dimension getMinimumSize(int wHint, int hHint) {
- // TODO Auto-generated method stub
return new Dimension(20, 20);
}
@@ -318,4 +320,20 @@ public class ConstraintFigure extends CornerBentFigure implements IPapyrusNodeNa
return page.getLocation();
}
+ /**
+ * Create a label that contains the name of the element.
+ */
+ public void restoreNameLabel() {
+ // nameLabel.setOpaque(false);
+ // nameLabel.setAlignment(PositionConstants.MIDDLE);
+ // getNameLabelContainer().add(nameLabel, getNameLabelConstraint(), getNameLabelPosition());
+ }
+
+ public void removeNameLabel() {
+ // if(getNameLabelContainer().getChildren().contains(nameLabel)) {
+ // getNameLabelContainer().remove(nameLabel);
+ // }
+ }
+
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
index 8482eb3de1f..f08fa696d1f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/CornerBentFigure.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.common.figure.node;
import java.util.StringTokenizer;
import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.RectangleFigure;
@@ -333,4 +334,12 @@ public class CornerBentFigure extends NoteFigure implements IPapyrusNodeUMLEleme
revalidate();
repaint();
}
+
+ @Override
+ protected void paintBorder(Graphics g) {
+ if(getBorder() == null) {
+ return;
+ }
+ super.paintBorder(g);
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/IPapyrusNodeNamedElementFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/IPapyrusNodeNamedElementFigure.java
index bfbdd12385b..de6fffa4a83 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/IPapyrusNodeNamedElementFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/IPapyrusNodeNamedElementFigure.java
@@ -63,4 +63,12 @@ public interface IPapyrusNodeNamedElementFigure extends IPapyrusNodeUMLElementFi
public void setNameLabelIcon(boolean displayNameLabelIcon);
+ /**
+ * Create a label that contains the name of the element.
+ */
+ public void restoreNameLabel();
+
+
+ public void removeNameLabel();
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/QualifiedNameWrappingLabelFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/QualifiedNameWrappingLabelFigure.java
index 90b0fa9bedc..5f31950661b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/QualifiedNameWrappingLabelFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/QualifiedNameWrappingLabelFigure.java
@@ -102,5 +102,15 @@ public class QualifiedNameWrappingLabelFigure extends PapyrusWrappingLabel imple
public void setStereotypeDisplay(String stereotypes, Image image) {}
public void setNameLabelIcon(boolean displayNameLabelIcon) {}
public WrappingLabel getNameLabel() {return null;}
+
+
+ public void restoreNameLabel() {
+ // TODO Auto-generated method stub
+
+ }
+ public void removeNameLabel() {
+ // TODO Auto-generated method stub
+
+ }
}

Back to the top