Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2014-09-23 12:00:00 +0000
committerCéline Janssens2014-09-25 14:10:05 +0000
commitae5529b97d58d304e1b2b6a1f88dfbb4e4be6366 (patch)
tree870f314b0517d0a5cff196516bb21a77d4b990ae /plugins/infra
parent3d8a37d4c55ba794588e8f17d5abc89aa9a8fcb4 (diff)
downloadorg.eclipse.papyrus-ae5529b97d58d304e1b2b6a1f88dfbb4e4be6366.tar.gz
org.eclipse.papyrus-ae5529b97d58d304e1b2b6a1f88dfbb4e4be6366.tar.xz
org.eclipse.papyrus-ae5529b97d58d304e1b2b6a1f88dfbb4e4be6366.zip
440230: [All Diagrams] Add Margins to the Labels
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440230 - Generation of Component Diagram in order to make the PortNameEditPart a PapyrusWrappingLabel instead of WrappingLabel - Application of new Formatter and Clean up of Component Diagram sources - Change default value of Margin to 0 pixel - Switch horizontal/vertical to be aligned with the margin direction - add NON-NLS tag - fix some Cast Exception Change-Id: I6e222e5d8eb39ca5525e6747e7c0b18bd1089302 Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java15
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java20
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java2
3 files changed, 22 insertions, 15 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java
index 3c91af3e1f9..df00838d2fb 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.properties/src/org/eclipse/papyrus/infra/gmfdiag/css/properties/modelelement/CSSModelElement.java
@@ -8,7 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Mickal Adam (ALL4TEC) mickael.adam@all4tec.net - bug 429642
+ * Micka�l Adam (ALL4TEC) mickael.adam@all4tec.net - bug 429642
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.properties.modelelement;
@@ -70,7 +70,9 @@ public class CSSModelElement extends CustomStyleModelElement {
@Override
public IObservable doGetObservable(String propertyPath) {
if (CSSStyles.CSS_DIAGRAM_STYLESHEETS_KEY.equals(propertyPath)) {
- return new DiagramStyleSheetObservableList((View) source, domain, propertyPath);
+ if (source instanceof View){
+ return new DiagramStyleSheetObservableList((View) source, domain, propertyPath);
+ }
}
if (CSSStyles.CSS_MODEL_STYLESHEETS_KEY.equals(propertyPath)) {
// Get the resource
@@ -96,9 +98,12 @@ public class CSSModelElement extends CustomStyleModelElement {
Activator.log.error(e);
}
// Initialize the adapter of the engine to listen model styleSheet
- ExtendedCSSEngine engine = ((CSSNotationResource) notationResource).getModelEngine();
- if (engine instanceof ModelCSSEngine) {
- ((ModelCSSEngine) engine).initAdapter();
+ if (notationResource instanceof CSSNotationResource ){
+ ExtendedCSSEngine engine = ((CSSNotationResource) notationResource).getModelEngine();
+
+ if (engine instanceof ModelCSSEngine) {
+ ((ModelCSSEngine) engine).initAdapter();
+ }
}
}
return new ModelStyleSheetObservableList(notationResource, modelStyleSheetsSource.getStylesheets(), domain, modelStyleSheetsSource, StylesheetsPackage.Literals.MODEL_STYLE_SHEETS__STYLESHEETS);
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 bfb924e4a7b..208b2876c81 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
@@ -47,29 +47,29 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
/**
* Default Margin when not present in CSS
*/
- static final int DEFAULT_MARGIN = 1;
+ static final int DEFAULT_MARGIN = 0;
/**
* CSS Integer property to define the horizontal Label Margin
*/
- static final String X_MARGIN_PROPERTY = "xMarginLabel";
+ static final String X_MARGIN_PROPERTY = "xMarginLabel"; //$NON-NLS$
/**
* CSS Integer property to define the vertical Label Margin
*/
- static final String Y_MARGIN_PROPERTY = "yMarginLabel";
+ static final String Y_MARGIN_PROPERTY = "yMarginLabel"; //$NON-NLS$
/** The Constant TEXT_ALIGNMENT. */
- private static final String TEXT_ALIGNMENT = "textAlignment";
+ private static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS$
/** The Constant LABEL_OFFSET_Y. */
- private static final String LABEL_OFFSET_Y = "labelOffsetY";
+ private static final String LABEL_OFFSET_Y = "labelOffsetY"; //$NON-NLS$
/** The Constant LABEL_OFFSET_X. */
- private static final String LABEL_OFFSET_X = "labelOffsetX";
+ private static final String LABEL_OFFSET_X = "labelOffsetX"; //$NON-NLS$
/** The Constant LABEL_CONSTRAINED. */
- private static final String LABEL_CONSTRAINED = "labelConstrained";
+ private static final String LABEL_CONSTRAINED = "labelConstrained"; //$NON-NLS$
/** The label locator. */
protected PapyrusLabelLocator labelLocator;
@@ -363,14 +363,14 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
if (model instanceof View) {
- horizontalMargin = NotationUtils.getIntValue((View) model, X_MARGIN_PROPERTY, DEFAULT_MARGIN);
- verticalMargin = NotationUtils.getIntValue((View) model, Y_MARGIN_PROPERTY, DEFAULT_MARGIN);
+ horizontalMargin = NotationUtils.getIntValue((View) model, Y_MARGIN_PROPERTY, DEFAULT_MARGIN);
+ verticalMargin = NotationUtils.getIntValue((View) model, X_MARGIN_PROPERTY, DEFAULT_MARGIN);
}
figure = ((GraphicalEditPart) this).getFigure();
if (figure instanceof IPapyrusWrappingLabel) {
- ((IPapyrusWrappingLabel) figure).setMarginLabel(horizontalMargin, verticalMargin);
+ ((IPapyrusWrappingLabel) figure).setMarginLabel(verticalMargin,horizontalMargin);
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java
index 52b4b352ba3..d583195b9b2 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/PapyrusWrappingLabel.java
@@ -59,6 +59,8 @@ public class PapyrusWrappingLabel extends WrappingLabel implements IPapyrusWrapp
MarginBorder mb = new MarginBorder(xMargin, yMargin, xMargin, yMargin);
this.setBorder(mb);
+ repaint();
+ revalidate();

Back to the top