Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2014-12-03 10:12:59 +0000
committerVincent Lorenzo2014-12-03 10:12:59 +0000
commit9da1bd9d557ba0b9b98ba256e35e636db6eb7ee8 (patch)
tree72b6b8760991092478cac3f64353874663486b3e
parent6496c4a9957ce56d90334e4fcb2367047251a15d (diff)
downloadorg.eclipse.papyrus-9da1bd9d557ba0b9b98ba256e35e636db6eb7ee8.tar.gz
org.eclipse.papyrus-9da1bd9d557ba0b9b98ba256e35e636db6eb7ee8.tar.xz
org.eclipse.papyrus-9da1bd9d557ba0b9b98ba256e35e636db6eb7ee8.zip
453975: [Diagram] In IBD and BDD, label for Port and FlowPort are centered on the port by default
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java22
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java17
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java8
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java18
4 files changed, 44 insertions, 21 deletions
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 7ce1087c4d8..1a8324940d6 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
@@ -51,34 +51,34 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
/**
* CSS Integer property to define the horizontal Label Margin
*/
- public static final String TOP_MARGIN_PROPERTY = "topMarginLabel"; // $NON-NLS$
+ public static final String TOP_MARGIN_PROPERTY = "topMarginLabel"; //$NON-NLS-1$
/**
* CSS Integer property to define the vertical Label Margin
*/
- public static final String LEFT_MARGIN_PROPERTY = "leftMarginLabel"; // $NON-NLS$
+ public static final String LEFT_MARGIN_PROPERTY = "leftMarginLabel"; //$NON-NLS-1$
/**
* CSS Integer property to define the horizontal Label Margin
*/
- public static final String BOTTOM_MARGIN_PROPERTY = "bottomMarginLabel"; // $NON-NLS$
+ public static final String BOTTOM_MARGIN_PROPERTY = "bottomMarginLabel"; //$NON-NLS-1$
/**
* CSS Integer property to define the vertical Label Margin
*/
- public static final String RIGHT_MARGIN_PROPERTY = "rightMarginLabel"; // $NON-NLS$
+ public static final String RIGHT_MARGIN_PROPERTY = "rightMarginLabel"; //$NON-NLS-1$
/** The Constant TEXT_ALIGNMENT. */
- public static final String TEXT_ALIGNMENT = "textAlignment"; // $NON-NLS$
+ public static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS-1$
/** The Constant LABEL_OFFSET_Y. */
- public static final String LABEL_OFFSET_Y = "labelOffsetY"; // $NON-NLS$
+ public static final String LABEL_OFFSET_Y = "labelOffsetY"; //$NON-NLS-1$
/** The Constant LABEL_OFFSET_X. */
- public static final String LABEL_OFFSET_X = "labelOffsetX"; // $NON-NLS$
+ public static final String LABEL_OFFSET_X = "labelOffsetX"; //$NON-NLS-1$
/** The Constant LABEL_CONSTRAINED. */
- public static final String LABEL_CONSTRAINED = "labelConstrained"; // $NON-NLS$
+ public static final String LABEL_CONSTRAINED = "labelConstrained"; //$NON-NLS-1$
/** The external label locator. */
protected PapyrusLabelLocator papyrusLabelLocator = null;
@@ -207,13 +207,13 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
int textAlignment = 0;
if (labelAlignment != null) {
- if ("left".equals(labelAlignment.getStringValue())) {
+ if ("left".equals(labelAlignment.getStringValue())) { //$NON-NLS-1$
textAlignment = PositionConstants.LEFT;
}
- if ("right".equals(labelAlignment.getStringValue())) {
+ if ("right".equals(labelAlignment.getStringValue())) {//$NON-NLS-1$
textAlignment = PositionConstants.RIGHT;
}
- if ("center".equals(labelAlignment.getStringValue())) {
+ if ("center".equals(labelAlignment.getStringValue())) {//$NON-NLS-1$
textAlignment = PositionConstants.CENTER;
}
} else {
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
index e2f0b91bdbf..eb927fc474b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java
@@ -16,15 +16,16 @@ package org.eclipse.papyrus.sysml.diagram.common.edit.part;
import java.util.List;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.sysml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
import org.eclipse.swt.graphics.Image;
@@ -74,7 +75,7 @@ public class FlowPortAffixedLabelNameEditPart extends AbstractElementLabelEditPa
List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
for (View view : views) {
- if (NameLabelIconHelper.showLabelIcon(view)) {
+ if (AppearanceHelper.showElementIcon(view)) {
return labelProvider.getImage(parserElement);
}
}
@@ -96,6 +97,16 @@ public class FlowPortAffixedLabelNameEditPart extends AbstractElementLabelEditPa
return new PapyrusWrappingLabel();
}
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart#getDefaultTextAlignment()
+ *
+ * @return
+ */
+ @Override
+ protected int getDefaultTextAlignment() {
+ return PositionConstants.LEFT;
+ }
/**
* {@inheritDoc}
*/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
index 92531bcadb2..9f8e4f94b33 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
@@ -382,7 +382,7 @@ public abstract class AbstractElementLabelEditPart extends PapyrusLabelEditPart
if (Window.OK == dialog.open()) {
TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$
@Override
protected void doExecute() {
@@ -564,7 +564,7 @@ public abstract class AbstractElementLabelEditPart extends PapyrusLabelEditPart
protected void initExtendedEditorConfiguration() {
if (configuration == null) {
final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
+ if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else {
configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
@@ -577,7 +577,7 @@ public abstract class AbstractElementLabelEditPart extends PapyrusLabelEditPart
*/
protected void updateExtendedEditorConfiguration() {
String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
+ if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { //$NON-NLS-1$
configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
} else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
configuration = null;
@@ -669,7 +669,7 @@ public abstract class AbstractElementLabelEditPart extends PapyrusLabelEditPart
String diagramType = getNotationView().getDiagram().getType();
String parentType = ViewUtil.getViewContainer(getNotationView()).getType();
String labelType = getNotationView().getType();
- return diagramType + "_" + parentType + "-" + labelType;
+ return diagramType + "_" + parentType + "-" + labelType; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
index 73576ba8c9a..b9b1f6ea3c8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java
@@ -16,15 +16,17 @@ package org.eclipse.papyrus.uml.diagram.common.edit.part;
import java.util.List;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.sysml.diagram.common.Activator;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
+import org.eclipse.papyrus.sysml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Port;
/**
* This class implements a {@link Port} affixed label edit part.
@@ -45,6 +47,16 @@ public class PortAffixedLabelNameEditPart extends AbstractElementLabelEditPart i
super.createDefaultEditPolicies();
}
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart#getDefaultTextAlignment()
+ *
+ * @return
+ */
+ @Override
+ protected int getDefaultTextAlignment() {
+ return PositionConstants.LEFT;
+ }
+
@Override
public IBorderItemLocator getBorderItemLocator() {
IFigure parentFigure = getFigure().getParent();
@@ -67,7 +79,7 @@ public class PortAffixedLabelNameEditPart extends AbstractElementLabelEditPart i
List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
for (View view : views) {
- if (NameLabelIconHelper.showLabelIcon(view)) {
+ if (AppearanceHelper.showElementIcon(view)) {
return Activator.getInstance().getLabelProvider().getImage(parserElement);
}
}

Back to the top