Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2015-06-09 15:28:06 +0000
committerCamille Letavernier2015-06-10 11:09:37 +0000
commit0a784e5f27942aa469f757a89c6a6aa56e9b92d5 (patch)
tree721e053768722e7245d65ad7136841865c75041c
parent09fa3cfa80be3b89e150d132dd1453de2ada0746 (diff)
downloadorg.eclipse.papyrus-0a784e5f27942aa469f757a89c6a6aa56e9b92d5.tar.gz
org.eclipse.papyrus-0a784e5f27942aa469f757a89c6a6aa56e9b92d5.tar.xz
org.eclipse.papyrus-0a784e5f27942aa469f757a89c6a6aa56e9b92d5.zip
Some fix and some change on master for advance Appearance property View.
-PapyrusRoundedEditPartHelper => to avoid bad display if radius width xor radius height = 0 and some fix -MaskManagedFloatingLabelEditPolicy => fix, the mask label must be defined at the label level -RoundedCompartmentFigure => set shadow color must allow Integer Color from Draw2D -LabelCustomizationMaskProvide r=> add case of FloatingLabel Mask manager -GridData => change some properties from protected to public to acced to the width of the property view: necessary for papyrusRowLayout. Change-Id: I887ebb42abd0bd4332d0f956e8e882a7b7b0d5e7 Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net> Reviewed-on: https://git.eclipse.org/r/49808 Tested-by: Hudson CI Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/MaskManagedFloatingLabelEditPolicy.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java247
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/layout/GridData.java35
5 files changed, 174 insertions, 158 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java
index f3f1194391e..d2a463b7c6e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/PapyrusRoundedEditPartHelper.java
@@ -57,7 +57,10 @@ public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperti
// convert the string style name in integer
if (borderValueStyle instanceof StringValueStyle) {
String str = ((StringValueStyle) borderValueStyle).getStringValue();
- borderStyle = LineStyleEnum.getByLiteral(str).getLineStyle();
+ final LineStyleEnum lineStyle = LineStyleEnum.getByLiteral(str);
+ if (lineStyle != null) {
+ borderStyle = lineStyle.getLineStyle();
+ }
}
}
}
@@ -169,7 +172,7 @@ public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperti
int shadowWidth = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), SHADOW_WIDTH, defaultShadowWidthValue);
// Set isOval
- roundedRectangleFigure.setShadowWidth(shadowWidth);
+ roundedRectangleFigure.setShadowWidth(shadowWidth >= 0 ? shadowWidth : defaultShadowWidthValue);
}
}
}
@@ -196,13 +199,13 @@ public abstract class PapyrusRoundedEditPartHelper implements NamedStyleProperti
// get CSS the value of radius Height
int height = NotationUtils.getIntValue((View) ((GraphicalEditPart) editpart).getModel(), RADIUS_HEIGHT, defaultCornerHeight);
- // Set the corner dimension
roundedRectangleFigure.setCornerDimensions(new Dimension(width, height));
}
}
}
+
/**
* Refresh has header.
*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/MaskManagedFloatingLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/MaskManagedFloatingLabelEditPolicy.java
index d8e4ecaaab8..8f6ab1c4d2b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/MaskManagedFloatingLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/MaskManagedFloatingLabelEditPolicy.java
@@ -169,11 +169,8 @@ public class MaskManagedFloatingLabelEditPolicy extends AbstractMaskManagedEditP
Object hostView = host.getModel();
if (hostView instanceof View) {
- Object parentView = ((View) hostView).eContainer();
- if (parentView instanceof View) {
- return (View) parentView;
- }
- return null;
+ // The mask have to be applied on the label and not on the parent
+ return (View) hostView;
}
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
index dc881898550..3efa83e122f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/RoundedCompartmentFigure.java
@@ -35,6 +35,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IRoundedRectangleFig
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SVGNodePlateFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SlidableRoundedRectangleAnchor;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.FigureUtils;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.graphics.RGB;
@@ -451,17 +452,30 @@ public class RoundedCompartmentFigure extends NodeNamedElementFigure implements
*/
private void setShadowBackgroundColor(Graphics graphics) {
- if (shadowColor != null) {
+ Color color = null;
+ if (shadowColor != null && !"-1".equals(shadowColor)) {
// get the the RGBColor from string
RGBColor rgbColor = CSS2ColorHelper.getRGBColor(shadowColor);
+ if (rgbColor != null) {
+ // extract RGB
+ int red = Integer.parseInt(rgbColor.getRed().toString());
+ int green = Integer.parseInt(rgbColor.getGreen().toString());
+ int blue = Integer.parseInt(rgbColor.getBlue().toString());
+
+ // get the the Color from RGB
+ color = new Color(Display.getCurrent(), new RGB(red, green, blue));
+ }
- // extract RGB
- int red = Integer.parseInt(rgbColor.getRed().toString());
- int green = Integer.parseInt(rgbColor.getGreen().toString());
- int blue = Integer.parseInt(rgbColor.getBlue().toString());
+ if (color == null) {
+ try {
+ color = ColorRegistry.getInstance().getColor(Integer.valueOf(shadowColor));
+ } catch (NumberFormatException e) {
+ Activator.log.error("Shadow Color not well set", e);
+ }
+ }
+ }
- // get the the Color from RGB
- Color color = new Color(Display.getCurrent(), new RGB(red, green, blue));
+ if (color != null) {
graphics.setBackgroundColor(color);
} else {
graphics.setBackgroundColor(getForegroundColor());
@@ -548,7 +562,11 @@ public class RoundedCompartmentFigure extends NodeNamedElementFigure implements
*/
@Override
public void setCornerDimensions(Dimension cornerDimension) {
- this.cornerDimension = cornerDimension;
+ if (cornerDimension.width == 0 || cornerDimension.height == 0) {
+ this.cornerDimension = new Dimension();
+ } else {
+ this.cornerDimension = cornerDimension;
+ }
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java
index 5591e972e6a..ad6e3190836 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java
@@ -1,119 +1,128 @@
-/*****************************************************************************
- * Copyright (c) 2011 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.properties.widgets;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.properties.modelelement.UMLNotationModelElement;
-import org.eclipse.papyrus.views.properties.modelelement.CompositeModelElement;
-import org.eclipse.papyrus.views.properties.modelelement.DataSource;
-import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
-import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
-import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
-
-
-/**
- * A MaskProvider for the labelCustomization property
- *
- * @author Camille Letavernier
- */
-public class LabelCustomizationMaskProvider implements XWTCompliantMaskProvider {
-
- private IMaskManagedLabelEditPolicy editPolicy;
-
- private DataSource input;
-
- private String propertyPath;
-
- private final Set<XWTCompliantMaskProviderListener> listeners = new HashSet<XWTCompliantMaskProviderListener>();
-
- public LabelCustomizationMaskProvider() {
- }
-
- public Map<String, String> getMasks() {
- return editPolicy.getMasks();
- }
-
- public void setProperty(String propertyPath) {
- this.propertyPath = propertyPath;
- checkInput();
- }
-
- public String getProperty() {
- return propertyPath;
- }
-
- public void setInput(DataSource input) {
- this.input = input;
- checkInput();
- }
-
- public DataSource getInput() {
- return input;
- }
-
- protected void checkInput() {
- if (input != null && propertyPath != null) {
- ModelElement element = input.getModelElement(propertyPath);
- if (element instanceof UMLNotationModelElement) {
- UMLNotationModelElement modelElement = (UMLNotationModelElement) element;
- editPolicy = (IMaskManagedLabelEditPolicy) modelElement.getEditPart().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (editPolicy != null) {
- notifyListeners();
- }
- } else if (element instanceof CompositeModelElement) {
- editPolicy = null;
- IMaskManagedLabelEditPolicy currentEditPolicy = null;
- // Check that all elements have the same edit policy
- for (ModelElement subElement : ((CompositeModelElement) element).getSubElements()) {
- if (subElement instanceof UMLNotationModelElement) {
- UMLNotationModelElement modelElement = (UMLNotationModelElement) subElement;
- currentEditPolicy = (IMaskManagedLabelEditPolicy) modelElement.getEditPart().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (currentEditPolicy == null) {
- editPolicy = null;
- break;
- }
- if (editPolicy != null && !editPolicy.getMasks().equals(currentEditPolicy.getMasks())) {
- editPolicy = null;
- break;
- }
- if (editPolicy == null) {
- editPolicy = currentEditPolicy;
- continue;
- }
- }
- }
- if (editPolicy != null) {
- notifyListeners();
- }
- }
- }
- }
-
- private void notifyListeners() {
- for (XWTCompliantMaskProviderListener listener : listeners) {
- listener.notifyReady(this);
- }
- }
-
- public void addMaskProviderListener(XWTCompliantMaskProviderListener listener) {
- listeners.add(listener);
- }
-
- public void removeMaskProviderListener(XWTCompliantMaskProviderListener listener) {
- listeners.remove(listener);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.properties.widgets;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart;
+import org.eclipse.papyrus.uml.properties.modelelement.UMLNotationModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.CompositeModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.DataSource;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
+
+
+/**
+ * A MaskProvider for the labelCustomization property
+ *
+ * @author Camille Letavernier
+ */
+public class LabelCustomizationMaskProvider implements XWTCompliantMaskProvider {
+
+ private IMaskManagedLabelEditPolicy editPolicy;
+
+ private DataSource input;
+
+ private String propertyPath;
+
+ private final Set<XWTCompliantMaskProviderListener> listeners = new HashSet<XWTCompliantMaskProviderListener>();
+
+ public LabelCustomizationMaskProvider() {
+ }
+
+ public Map<String, String> getMasks() {
+ return editPolicy.getMasks();
+ }
+
+ public void setProperty(String propertyPath) {
+ this.propertyPath = propertyPath;
+ checkInput();
+ }
+
+ public String getProperty() {
+ return propertyPath;
+ }
+
+ public void setInput(DataSource input) {
+ this.input = input;
+ checkInput();
+ }
+
+ public DataSource getInput() {
+ return input;
+ }
+
+ protected void checkInput() {
+ if (input != null && propertyPath != null) {
+ ModelElement element = input.getModelElement(propertyPath);
+ if (element instanceof UMLNotationModelElement) {
+ UMLNotationModelElement modelElement = (UMLNotationModelElement) element;
+ editPolicy = (IMaskManagedLabelEditPolicy) modelElement.getEditPart().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (editPolicy != null) {
+ notifyListeners();
+ }
+ } else if (input.getSelection().getFirstElement() instanceof FloatingLabelEditPart) {
+ EditPart editpart = (EditPart) input.getSelection().getFirstElement();
+ editPolicy = (IMaskManagedLabelEditPolicy) editpart.getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
+ if (editPolicy != null) {
+ notifyListeners();
+ }
+ } else if (element instanceof CompositeModelElement) {
+ editPolicy = null;
+ IMaskManagedLabelEditPolicy currentEditPolicy = null;
+ // Check that all elements have the same edit policy
+ for (ModelElement subElement : ((CompositeModelElement) element).getSubElements()) {
+ if (subElement instanceof UMLNotationModelElement) {
+ UMLNotationModelElement modelElement = (UMLNotationModelElement) subElement;
+ currentEditPolicy = (IMaskManagedLabelEditPolicy) modelElement.getEditPart().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if (currentEditPolicy == null) {
+ editPolicy = null;
+ break;
+ }
+ if (editPolicy != null && !editPolicy.getMasks().equals(currentEditPolicy.getMasks())) {
+ editPolicy = null;
+ break;
+ }
+ if (editPolicy == null) {
+ editPolicy = currentEditPolicy;
+ continue;
+ }
+ }
+ }
+ if (editPolicy != null) {
+ notifyListeners();
+ }
+ }
+ }
+ }
+
+ private void notifyListeners() {
+ for (XWTCompliantMaskProviderListener listener : listeners) {
+ listener.notifyReady(this);
+ }
+ }
+
+ public void addMaskProviderListener(XWTCompliantMaskProviderListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeMaskProviderListener(XWTCompliantMaskProviderListener listener) {
+ listeners.remove(listener);
+ }
+
+}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/layout/GridData.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/layout/GridData.java
index 2ae001772fe..4957028b37e 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/layout/GridData.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/layout/GridData.java
@@ -360,7 +360,7 @@ public final class GridData {
protected int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
- protected int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
+ public int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
/**
* Constructs a new instance of GridData using
@@ -610,49 +610,38 @@ public final class GridData {
}
String string = getName() + " {"; //$NON-NLS-1$
string += "horizontalAlignment=" + hAlign + " "; //$NON-NLS-1$ //$NON-NLS-2$
- if (horizontalIndent != 0)
- {
+ if (horizontalIndent != 0) {
string += "horizontalIndent=" + horizontalIndent + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (horizontalSpan != 1)
- {
+ if (horizontalSpan != 1) {
string += "horizontalSpan=" + horizontalSpan + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (grabExcessHorizontalSpace)
- {
+ if (grabExcessHorizontalSpace) {
string += "grabExcessHorizontalSpace=" + grabExcessHorizontalSpace + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (widthHint != SWT.DEFAULT)
- {
+ if (widthHint != SWT.DEFAULT) {
string += "widthHint=" + widthHint + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (minimumWidth != 0)
- {
+ if (minimumWidth != 0) {
string += "minimumWidth=" + minimumWidth + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
string += "verticalAlignment=" + vAlign + " "; //$NON-NLS-1$ //$NON-NLS-2$
- if (verticalIndent != 0)
- {
+ if (verticalIndent != 0) {
string += "verticalIndent=" + verticalIndent + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (verticalSpan != 1)
- {
+ if (verticalSpan != 1) {
string += "verticalSpan=" + verticalSpan + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (grabExcessVerticalSpace)
- {
+ if (grabExcessVerticalSpace) {
string += "grabExcessVerticalSpace=" + grabExcessVerticalSpace + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (heightHint != SWT.DEFAULT)
- {
+ if (heightHint != SWT.DEFAULT) {
string += "heightHint=" + heightHint + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (minimumHeight != 0)
- {
+ if (minimumHeight != 0) {
string += "minimumHeight=" + minimumHeight + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
- if (exclude)
- {
+ if (exclude) {
string += "exclude=" + exclude + " "; //$NON-NLS-1$ //$NON-NLS-2$
}
string = string.trim();

Back to the top