Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-01-31 16:10:41 +0000
committerCamille Letavernier2014-01-31 16:10:41 +0000
commit87a380b7deb824c8f034a4ab2313a796374ef76d (patch)
tree5361e5ff0964602bc27608fe91f0eb9752c6f803
parent3d98d0203b66ab05bda7c24d2c032c83391023fd (diff)
downloadorg.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.tar.gz
org.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.tar.xz
org.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.zip
417396: [CSS] The CSS Engine shall support label visibility & mask
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417396 - Refactor the MaskManaged Label framework. Replace bitmask (integer) values with collections of String - Partial commit. Some diagrams don't compile (Preferences, LabelParser)
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java16
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java23
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AnnotationStyleProvider.java94
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AppearanceStyleProvider.java3
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.classpath4
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java9
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java9
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java9
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java23
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSViewDelegate.java15
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java15
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java24
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CustomStyle.java8
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleListValueCommand.java7
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/CustomStyleObservableList.java41
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/RemoveAllCustomStyleListValueCommand.java3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/IMaskManagedLabelEditPolicy.java41
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NoSemanticParserEditPolicy.java32
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/MaskLabelHelper.java73
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringMask.java211
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java8
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java34
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java27
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java67
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java21
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java59
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java29
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java26
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java37
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java41
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java16
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java37
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java45
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java33
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java21
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.classpath4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/InstanceSpecificationLabelHelper.java146
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java30
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationBranchEndMultiplicityEditPolicy.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndEditPolicy.java35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndSourceMultiplicityEditPolicy.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndTargetMultiplicityEditPolicy.java15
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationNameLabelEditPolicy.java50
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/OperationLabelEditPolicy.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/PropertyLabelEditPolicy.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/OperationPreferencePage.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/PropertyPreferencePage.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java76
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/InstanceSpecificationLabelMaskProviderAdapterFactory.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractMaskManagedEditPolicy.java51
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java73
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PortLabelHelper.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PropertyLabelHelper.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java22
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/OperationLabelMaskProviderAdapterFactory.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java56
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationUseLabelEditPolicy.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLabelEditPolicy.java33
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyLabelEditPolicy.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CollaborationUseLabelHelper.java31
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java44
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/PropertyPreferencePage.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CollaborationUseLabelMaskProviderAdapterFactory.java43
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ParameterLabelMaskProviderAdapterFactory.java43
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UMLNotation/ui/Label.xwt8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java39
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/MaskValueObservableList.java112
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/LabelCustomizationMaskProvider.java6
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java20
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ICustomAppearence.java99
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java30
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java47
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java51
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java39
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java53
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java24
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java41
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java71
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java6
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java114
89 files changed, 1354 insertions, 1734 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
index 1737ecb6715..a000cc27124 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/AppearanceHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -20,11 +20,11 @@ import org.eclipse.papyrus.infra.emf.appearance.style.AppearanceStyleProvider;
public class AppearanceHelper {
-
+
public static String EXTENSION_ID = Activator.PLUGIN_ID + ".styleProvider";
-
+
private static AppearanceStyleProvider styleProvider = findStyleProvider();
-
+
public static boolean showElementIcon(EModelElement modelElement) {
return styleProvider.showElementIcon(modelElement);
}
@@ -36,10 +36,6 @@ public class AppearanceHelper {
public static boolean showShadow(EModelElement modelElement) {
return styleProvider.showShadow(modelElement);
}
-
- public static int getLabelDisplay(EModelElement modelElement){
- return styleProvider.getLabelDisplay(modelElement);
- }
private static AppearanceStyleProvider findStyleProvider() {
//Default style provider
@@ -63,6 +59,6 @@ public class AppearanceHelper {
return provider;
}
-
-
+
+
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java
index 45d5747193f..c1689f84ff9 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/helper/VisualInformationPapyrusConstants.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -32,16 +32,33 @@ public interface VisualInformationPapyrusConstants {
public static String LAYOUTFIGURE_VALUE = "layoutFigure_value";
- /** key for the appearance of properties or other specific display */
+ /**
+ * key for the appearance of properties or other specific display
+ *
+ * @deprecated Use a StringListValueStyle instead. See {{@link #CUSTOM_MASK_LABEL}
+ */
+ @Deprecated
public static final String CUSTOM_APPEARENCE_ANNOTATION = "CustomAppearance_Annotation";
/**
+ * The name of the StringListValueStyle used for storing MaskLabels
+ *
+ * Replaces the former int-based EAnnotation ({@link #CUSTOM_APPEARENCE_ANNOTATION}, {@link #CUSTOM_APPEARANCE_MASK_VALUE})
+ */
+ public static final String CUSTOM_MASK_LABEL = "maskLabel";
+
+ /**
* this is a key of eAnnnotation that contains hypertext link or referenced document
**/
public static final String HYPERLINK_DIAGRAM = "PapyrusHyperLink_Diagram";
public static final String HYPERLINK_DIAGRAM_NAME = "diagram_name";
- /** key for the appearance of properties or other specific display */
+ /**
+ * key for the appearance of properties or other specific display
+ *
+ * @deprecated Use a StringListValueStyle instead. See {{@link #CUSTOM_MASK_LABEL}
+ */
+ @Deprecated
public static final String CUSTOM_APPEARANCE_MASK_VALUE = "CustomAppearance_MaskValue";
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AnnotationStyleProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AnnotationStyleProvider.java
index f9c250e9442..852ed8f885e 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AnnotationStyleProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AnnotationStyleProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -11,19 +11,11 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.appearance.style;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.emf.Activator;
-import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetNameLabelIconCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetQualifiedNameDepthCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetShadowFigureCommand;
@@ -142,89 +134,5 @@ public class AnnotationStyleProvider implements AppearanceStyleProvider {
return new SetShadowFigureCommand(domain, view, shadowFigureValue);
}
- public static RecordingCommand getSetLabelDisplayCommand(TransactionalEditingDomain domain, EModelElement view, String[] maskValue) {
- int value = convertMaskToInteger(maskValue, view);
- return new AddMaskManagedLabelDisplayCommand(domain, view, value);
- }
-
- public int getLabelDisplay(EModelElement modelElement) {
- EAnnotation labelDisplayAnnotation = modelElement.getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
-
- if(labelDisplayAnnotation != null) {
- EMap<String, String> entries = labelDisplayAnnotation.getDetails();
-
- if(entries != null) {
- String mask = entries.get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE);
- if(mask != null) {
- try {
- int integerMask = Integer.parseInt(mask);
- return integerMask;
- } catch (NumberFormatException ex) {
- // Invalid mask
- Activator.log.warn("Invalid label mask value");
- }
- }
- }
- }
-
- return getDefaultMaskValue(modelElement);
- }
-
- // protected static String[] convertMaskToString(int integerMask, Map<Integer, String> maskAssociations) {
- // Set<String> result = new HashSet<String>();
- // for(Map.Entry<Integer, String> entry : maskAssociations.entrySet()) {
- // int key = entry.getKey();
- // String value = entry.getValue();
- //
- // if((integerMask & key) != 0) {
- // result.add(value);
- // }
- // }
- // return result.toArray(new String[0]);
- // }
-
- public static int convertMaskToInteger(String[] maskValue, EModelElement view) {
- Map<Integer, String> maskAssociations = getLabelMasks(view);
-
- int result = 0;
-
- if(maskValue.length == 0 || maskAssociations.isEmpty()) {
- return result;
- }
-
- Set<String> maskValuesAsSet = new HashSet<String>();
- for(String stringValue : maskValue) {
- maskValuesAsSet.add(stringValue.toLowerCase());
- }
-
- for(Map.Entry<Integer, String> entry : maskAssociations.entrySet()) {
- int key = entry.getKey();
- String value = entry.getValue();
-
- if(maskValuesAsSet.contains(value.toLowerCase())) {
- result = result | key;
- }
- }
-
- return result;
- }
-
- public static ILabelMaskProvider getLabelMaskProvider(EModelElement view) {
- ILabelMaskProvider labelMaskProvider = (ILabelMaskProvider)Platform.getAdapterManager().getAdapter(view, ILabelMaskProvider.class);
- return labelMaskProvider;
- }
-
- protected static Map<Integer, String> getLabelMasks(EModelElement view) {
- ILabelMaskProvider labelMaskProvider = getLabelMaskProvider(view);
- if(labelMaskProvider != null) {
- return labelMaskProvider.getMasks();
- }
- return Collections.emptyMap();
- }
-
- public static int getDefaultMaskValue(EModelElement modelElement) {
- ILabelMaskProvider maskProvider = getLabelMaskProvider(modelElement);
- return maskProvider == null ? 0 : maskProvider.getDefaultValue();
- }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AppearanceStyleProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AppearanceStyleProvider.java
index a9a780e05c1..6004279ea4a 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AppearanceStyleProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.appearance/src/org/eclipse/papyrus/infra/emf/appearance/style/AppearanceStyleProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -22,5 +22,4 @@ public interface AppearanceStyleProvider {
public boolean showShadow(EModelElement modelElement);
- public int getLabelDisplay(EModelElement modelElement);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.classpath b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.classpath
index 9c0318f0fd2..486b1b8b096 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.classpath
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.settings/org.eclipse.jdt.core.prefs
index 44217f8c068..f287d53cf45 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
index fceb5e1cd38..c8f2154ede7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/META-INF/MANIFEST.MF
@@ -42,5 +42,5 @@ Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.css.Activator
Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.css;singleton:=
true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
index 8e5edad13da..fde99409d6b 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSDecorationNodeImpl.java
@@ -53,6 +53,7 @@ public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomS
return isCSSVisible();
}
+ @Override
public boolean isCSSVisible() {
boolean value = super.isVisible();
@@ -93,22 +94,21 @@ public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomS
// Implements the custom styles //
///////////////////////////////////
+ @Override
public boolean showElementIcon() {
return getCustomStyle().showElementIcon();
}
+ @Override
public int getQualifiedNameDepth() {
return getCustomStyle().getQualifiedNameDepth();
}
+ @Override
public boolean showShadow() {
return getCustomStyle().showShadow();
}
- public int getLabelDisplay() {
- return getCustomStyle().getLabelDisplay();
- }
-
//////////////////////////////////
// Implements the getNamedStyle //
//////////////////////////////////
@@ -118,6 +118,7 @@ public class CSSDecorationNodeImpl extends DecorationNodeImpl implements CustomS
return getCSSNamedStyle(eClass, name);
}
+ @Override
public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
NamedStyle userStyle = super.getNamedStyle(eClass, name);
if(userStyle != null) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
index fb2785eefef..560971b7245 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSEdgeImpl.java
@@ -58,6 +58,7 @@ public class CSSEdgeImpl extends EdgeImpl implements CSSView, CustomStyle {
return isCSSVisible();
}
+ @Override
public boolean isCSSVisible() {
boolean value = super.isVisible();
@@ -117,6 +118,7 @@ public class CSSEdgeImpl extends EdgeImpl implements CSSView, CustomStyle {
return getCSSNamedStyle(eClass, name);
}
+ @Override
public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
NamedStyle userStyle = super.getNamedStyle(eClass, name);
if(userStyle != null) {
@@ -130,20 +132,19 @@ public class CSSEdgeImpl extends EdgeImpl implements CSSView, CustomStyle {
// Implements the custom styles //
///////////////////////////////////
+ @Override
public boolean showElementIcon() {
return getCustomStyle().showElementIcon();
}
+ @Override
public int getQualifiedNameDepth() {
return getCustomStyle().getQualifiedNameDepth();
}
+ @Override
public boolean showShadow() {
return getCustomStyle().showShadow();
}
- public int getLabelDisplay() {
- return getCustomStyle().getLabelDisplay();
- }
-
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
index d51e8906195..d7f3fec7d62 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSNodeImpl.java
@@ -58,6 +58,7 @@ public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
return isCSSVisible();
}
+ @Override
public boolean isCSSVisible() {
boolean value = super.isVisible();
@@ -117,6 +118,7 @@ public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
return getCSSNamedStyle(eClass, name);
}
+ @Override
public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
NamedStyle userStyle = super.getNamedStyle(eClass, name);
if(userStyle != null) {
@@ -130,20 +132,19 @@ public class CSSNodeImpl extends NodeImpl implements CSSView, CustomStyle {
// Implements the custom styles //
///////////////////////////////////
+ @Override
public boolean showElementIcon() {
return getCustomStyle().showElementIcon();
}
+ @Override
public int getQualifiedNameDepth() {
return getCustomStyle().getQualifiedNameDepth();
}
+ @Override
public boolean showShadow() {
return getCustomStyle().showShadow();
}
- public int getLabelDisplay() {
- return getCustomStyle().getLabelDisplay();
- }
-
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
index cec41a5da5c..c4209102af2 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/CSSShapeImpl.java
@@ -69,6 +69,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
//////////////////////////////////////////
+ @Override
public int getCSSFontColor() {
int value = super.getFontColor();
@@ -79,6 +80,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public java.lang.String getCSSFontName() {
java.lang.String value = super.getFontName();
@@ -89,6 +91,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSFontHeight() {
int value = super.getFontHeight();
@@ -99,6 +102,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public boolean isCSSBold() {
boolean value = super.isBold();
@@ -109,6 +113,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public boolean isCSSItalic() {
boolean value = super.isItalic();
@@ -119,6 +124,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public boolean isCSSUnderline() {
boolean value = super.isUnderline();
@@ -129,6 +135,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public boolean isCSSStrikeThrough() {
boolean value = super.isStrikeThrough();
@@ -139,6 +146,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public boolean isCSSVisible() {
boolean value = super.isVisible();
@@ -149,6 +157,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public java.lang.String getCSSDescription() {
java.lang.String value = super.getDescription();
@@ -159,6 +168,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSFillColor() {
int value = super.getFillColor();
@@ -169,6 +179,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSTransparency() {
int value = super.getTransparency();
@@ -179,6 +190,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public org.eclipse.gmf.runtime.notation.datatype.GradientData getCSSGradient() {
org.eclipse.gmf.runtime.notation.datatype.GradientData value = super.getGradient();
@@ -189,6 +201,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSLineColor() {
int value = super.getLineColor();
@@ -199,6 +212,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSLineWidth() {
int value = super.getLineWidth();
@@ -209,6 +223,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
}
}
+ @Override
public int getCSSRoundedBendpointsRadius() {
int value = super.getRoundedBendpointsRadius();
@@ -468,22 +483,21 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
// Implements the custom styles //
///////////////////////////////////
+ @Override
public boolean showElementIcon() {
return getCustomStyle().showElementIcon();
}
+ @Override
public int getQualifiedNameDepth() {
return getCustomStyle().getQualifiedNameDepth();
}
+ @Override
public boolean showShadow() {
return getCustomStyle().showShadow();
}
- public int getLabelDisplay() {
- return getCustomStyle().getLabelDisplay();
- }
-
//////////////////////////////////
// Implements the getNamedStyle //
//////////////////////////////////
@@ -493,6 +507,7 @@ public class CSSShapeImpl extends ShapeImpl implements CSSShapeStyle, CustomStyl
return getCSSNamedStyle(eClass, name);
}
+ @Override
public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
NamedStyle userStyle = super.getNamedStyle(eClass, name);
if(userStyle != null) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSViewDelegate.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSViewDelegate.java
index 9474d2fc45e..c18f1824484 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSViewDelegate.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src-gen/org/eclipse/papyrus/infra/gmfdiag/css/style/impl/CSSViewDelegate.java
@@ -1,5 +1,7 @@
package org.eclipse.papyrus.infra.gmfdiag.css.style.impl;
+import java.util.Arrays;
+
import org.eclipse.emf.ecore.EClass;
import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
import org.eclipse.gmf.runtime.notation.DoubleValueStyle;
@@ -7,10 +9,12 @@ import org.eclipse.gmf.runtime.notation.IntValueStyle;
import org.eclipse.gmf.runtime.notation.NamedStyle;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.StringListValueStyle;
import org.eclipse.gmf.runtime.notation.StringValueStyle;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
+import org.eclipse.papyrus.infra.gmfdiag.css.helper.ParserHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSStyles;
import org.eclipse.papyrus.infra.gmfdiag.css.style.CSSView;
import org.w3c.dom.css.CSSValue;
@@ -26,6 +30,7 @@ public class CSSViewDelegate implements CSSView {
this.engine = engine;
}
+ @Override
public boolean isCSSVisible() {
CSSValue cssValue = engine.retrievePropertyValue(view, "visible");
if(cssValue == null) {
@@ -38,8 +43,10 @@ public class CSSViewDelegate implements CSSView {
private boolean lookupStyle = false;
+ @Override
public NamedStyle getCSSNamedStyle(EClass eClass, String name) {
+
if(!NotationPackage.eINSTANCE.getNamedStyle().isSuperTypeOf(eClass)) {
return null;
}
@@ -108,6 +115,14 @@ public class CSSViewDelegate implements CSSView {
doubleStyle.setDoubleValue(doubleValue);
return doubleStyle;
+ case NotationPackage.STRING_LIST_VALUE_STYLE:
+ String[] values = ParserHelper.parseValues(engine, cssValue);
+
+ StringListValueStyle stringListStyle = NotationFactory.eINSTANCE.createStringListValueStyle();
+ stringListStyle.setName(name);
+ stringListStyle.getStringListValue().addAll(Arrays.asList(values));
+
+ return stringListStyle;
default:
return null;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
index b00de1f84eb..65665b1fd15 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -17,9 +17,9 @@ import org.eclipse.papyrus.infra.emf.appearance.style.AnnotationStyleProvider;
/**
* An appearance provider based on CSS. It reuses the AnnotationStyleProvider:
* if a property is changed manually, a standard annotation will be used.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class CSSAppearanceProvider extends AnnotationStyleProvider {
@@ -47,13 +47,4 @@ public class CSSAppearanceProvider extends AnnotationStyleProvider {
return super.showShadow(modelElement);
}
- @Override
- public int getLabelDisplay(EModelElement modelElement){
- if(modelElement instanceof CustomStyle) {
- return ((CustomStyle)modelElement).getLabelDisplay();
- }
- return super.getLabelDisplay(modelElement);
- }
-
-
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
index fdfbfa81262..704da4abc99 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -17,14 +17,13 @@ import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusC
import org.eclipse.papyrus.infra.emf.appearance.style.AnnotationStyleProvider;
import org.eclipse.papyrus.infra.emf.appearance.style.AppearanceStyleProvider;
import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
-import org.eclipse.papyrus.infra.gmfdiag.css.helper.LabelDisplayHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.StringHelper;
import org.w3c.dom.Element;
import org.w3c.dom.css.CSSValue;
/**
* Standard implementation of Papyrus Custom Style, CSS-based
- *
+ *
* @author Camille Letavernier
*/
//FIXME: Use constants for the CSS Properties elementIcon, qualifiedNameDepth and shadow
@@ -49,7 +48,7 @@ public class CSSCustomStyleDelegate implements CustomStyle {
/**
* Constructor
- *
+ *
* @param view
* The GMF view on which the custom style is applied
* @param engine
@@ -118,21 +117,4 @@ public class CSSCustomStyleDelegate implements CustomStyle {
return (Boolean)engine.convert(cssValue, Boolean.class, null);
}
- public int getLabelDisplay() {
- EAnnotation labelAnnotation = view.getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION);
- if(labelAnnotation != null) {
- if(labelAnnotation.getDetails().containsKey(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE)) {
- return provider.getLabelDisplay(view);
- }
- }
-
- CSSValue cssValue = engine.retrievePropertyValue(element, "label");
- if(cssValue == null) {
- return AnnotationStyleProvider.getDefaultMaskValue(view);
- }
- String[] maskValue = LabelDisplayHelper.convertLabelDisplay(engine, cssValue);
- return AnnotationStyleProvider.convertMaskToInteger(maskValue, view);
- }
-
-
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CustomStyle.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CustomStyle.java
index 14e1aeae7b8..358cd09f90a 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CustomStyle.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CustomStyle.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -14,7 +14,7 @@ package org.eclipse.papyrus.infra.gmfdiag.css.provider;
/**
* An element which supports Papyrus custom styles (elementIcon,
* qualifiedNameDepth, shadow).
- *
+ *
* @author Camille Letavernier
*/
public interface CustomStyle {
@@ -24,7 +24,5 @@ public interface CustomStyle {
public int getQualifiedNameDepth();
public boolean showShadow();
-
- public int getLabelDisplay();
-
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleListValueCommand.java
index c3e30715a96..afc063b18a9 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleListValueCommand.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/AbstractCustomStyleListValueCommand.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -48,6 +48,7 @@ public abstract class AbstractCustomStyleListValueCommand extends AbstractComman
this.domain = domain;
}
+ @Override
public void execute() {
//FIXME: Related to CompoundCommand vs StrictCompoundCommand.
//Sometimes, canExecute() is not called, and the command is not prepared
@@ -62,6 +63,7 @@ public abstract class AbstractCustomStyleListValueCommand extends AbstractComman
command.execute();
}
+ @Override
public void redo() {
execute();
}
@@ -70,9 +72,12 @@ public abstract class AbstractCustomStyleListValueCommand extends AbstractComman
public boolean prepare() {
style = view.getNamedStyle(styleClass, styleName);
+ //The style may be volatile (generated by CSS). If it doesn't belong to the view, it will need to be attached.
if(needsCreate = (style == null)) {
style = (NamedStyle)NotationFactory.eINSTANCE.create(styleClass);
style.setName(styleName);
+ } else if(style.eResource() == null) {
+ needsCreate = true;
}
command = createCommand();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/CustomStyleObservableList.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/CustomStyleObservableList.java
index 45733017e9b..4e2dd06d77f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/CustomStyleObservableList.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/CustomStyleObservableList.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -12,6 +12,7 @@
package org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom;
import java.util.Collection;
+import java.util.List;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
@@ -23,6 +24,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.Style;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.databinding.EMFObservableList;
import org.eclipse.papyrus.infra.gmfdiag.common.listener.CustomStyleListener;
@@ -60,7 +62,7 @@ public class CustomStyleObservableList extends EMFObservableList implements ICha
this.view = view;
this.domain = domain;
observableConcreteList = (IObservableList)concreteList;
- styleExists = isStyleCreated();
+ styleExists = styleExists();
view.eAdapters().add(listener = new CustomStyleListener(view, feature, this, styleName));
}
@@ -72,8 +74,27 @@ public class CustomStyleObservableList extends EMFObservableList implements ICha
changing = false;
}
- private boolean isStyleCreated() {
- return view.getNamedStyle(eClass, styleName) != null;
+ protected boolean styleExists() {
+ //getNamedStyle may return a volatile result when CSS are available. We want a persistent element, so we should call directly view#getStyles()
+ //Call directly view.getStyles() instead of view.getNamedStyle()
+ for(Style style : (List<Style>)view.getStyles()) {
+ if(eClass.isInstance(style)) {
+ NamedStyle namedStyle = (NamedStyle)style;
+ if(styleName.equals(namedStyle.getName())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ protected boolean isStyleCreated() {
+ return getNamedStyle() != null;
+ }
+
+ protected NamedStyle getNamedStyle() {
+ return view.getNamedStyle(eClass, styleName);
}
private static IObservableList getWrappedList(View view, String styleName, EClass eClass, EStructuralFeature feature) {
@@ -83,7 +104,7 @@ public class CustomStyleObservableList extends EMFObservableList implements ICha
return EMFProperties.list(feature).observe(style);
}
- //The style doesn't exist yet, we need to simulate it
+ //The style doesn't exist yet, we need to simulate it
//(With an empty list)
return new WritableList();
}
@@ -123,12 +144,14 @@ public class CustomStyleObservableList extends EMFObservableList implements ICha
return new SetCustomStyleListValueCommand(domain, view, styleName, eClass, feature, index, value);
}
+ @Override
public void handleChange(ChangeEvent event) {
//If the ListValueStyle has been created or removed, we need to resync
//the concrete list with it
- if(styleExists != (styleExists = isStyleCreated())) {
+ if(styleExists != (styleExists = styleExists())) {
observableConcreteList.dispose();
- concreteList = observableConcreteList = getWrappedList(view, styleName, eClass, feature);
+ concreteList = observableConcreteList = getConcreteList();
+ observableConcreteList.addChangeListener(this);
}
//If this observable is not the source of the change, the wrapped
@@ -138,6 +161,10 @@ public class CustomStyleObservableList extends EMFObservableList implements ICha
}
}
+ protected IObservableList getConcreteList() {
+ return getWrappedList(view, styleName, eClass, feature);
+ }
+
@Override
public void dispose() {
view.eAdapters().remove(listener);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/RemoveAllCustomStyleListValueCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/RemoveAllCustomStyleListValueCommand.java
index 80e969c05bb..d98dbe6aae8 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/RemoveAllCustomStyleListValueCommand.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/databinding/custom/RemoveAllCustomStyleListValueCommand.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -35,5 +35,4 @@ public class RemoveAllCustomStyleListValueCommand extends AbstractCustomStyleLis
return RemoveCommand.create(domain, style, styleFeature, values);
}
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/IMaskManagedLabelEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/IMaskManagedLabelEditPolicy.java
index 1afe1f6f924..15476286ffa 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/IMaskManagedLabelEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/IMaskManagedLabelEditPolicy.java
@@ -25,51 +25,18 @@ public interface IMaskManagedLabelEditPolicy {
public String MASK_MANAGED_LABEL_EDIT_POLICY = "MaskManagedLabelPolicy";
/**
- * Retrieve the mask name for the given mask value.
- *
- * @param value
- * the value of the given mask
- * @return the mask name
- */
- // @unused
- public String getMaskLabel(int value);
-
- /**
- * Returns the {@link Collection} of mask names
- *
- * @return the {@link Collection} of mask names
- */
- // @unused
- public Collection<String> getMaskLabels();
-
- /**
- * Returns the {@link Collection} of mask values
- *
- * @return the {@link Collection} of mask values
- */
- // @unused
- public Collection<Integer> getMaskValues();
-
- /**
- * Returns the {@link Map} of masks
+ * Returns the {@link Map} of masks. The key is the mask ID, the value is the mask Label
*
* @return the {@link Map} of masks
*/
- public Map<Integer, String> getMasks();
+ public Map<String, String> getMasks();
/**
* Retrieve the current display Value for the current host edit part.
*
* @return the current display Value for the current host edit part.
*/
- public int getCurrentDisplayValue();
-
- /**
- * Retrieve the default display Value for the current host edit part.
- *
- * @return the default display Value for the current host edit part.
- */
- public int getDefaultDisplayValue();
+ public Collection<String> getCurrentDisplayValue();
/**
* Refreshes the display of the edit part
@@ -79,7 +46,7 @@ public interface IMaskManagedLabelEditPolicy {
/**
* Sets the new Value for the element that manages the mask value
*/
- public void updateDisplayValue(int newValue);
+ public void updateDisplayValue(Collection<String> newValue);
/**
* Sets the default display value for the edit part
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NoSemanticParserEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NoSemanticParserEditPolicy.java
index ef64b2e72c9..2ec58355fb7 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NoSemanticParserEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/NoSemanticParserEditPolicy.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -24,48 +24,24 @@ import org.eclipse.gef.editpolicies.AbstractEditPolicy;
public class NoSemanticParserEditPolicy extends AbstractEditPolicy implements IMaskManagedLabelEditPolicy {
@Override
- public String getMaskLabel(int value) {
- //Nothing
- return null;
- }
-
- @Override
- public Collection<String> getMaskLabels() {
+ public Map<String, String> getMasks() {
//Nothing
return null;
}
@Override
- public Collection<Integer> getMaskValues() {
+ public Collection<String> getCurrentDisplayValue() {
//Nothing
return null;
}
@Override
- public Map<Integer, String> getMasks() {
- //Nothing
- return null;
- }
-
- @Override
- public int getCurrentDisplayValue() {
- //Nothing
- return 0;
- }
-
- @Override
- public int getDefaultDisplayValue() {
- //Nothing
- return 0;
- }
-
- @Override
public void refreshDisplay() {
//Nothing
}
@Override
- public void updateDisplayValue(int newValue) {
+ public void updateDisplayValue(Collection<String> newValue) {
//Nothing
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/MaskLabelHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/MaskLabelHelper.java
new file mode 100644
index 00000000000..a56f88d7c59
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/MaskLabelHelper.java
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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.infra.gmfdiag.common.helper;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.NamedStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStringStyleObservableList;
+
+
+public class MaskLabelHelper {
+
+
+ /**
+ * Return the current mask values, or null if undefined
+ *
+ * @param view
+ * @return
+ */
+ public static Collection<String> getMaskValues(View view) {
+ if(view.getNamedStyle(NotationPackage.eINSTANCE.getStringListValueStyle(), VisualInformationPapyrusConstants.CUSTOM_MASK_LABEL) != null) {
+ CustomStringStyleObservableList values = new CustomStringStyleObservableList(view, EMFHelper.resolveEditingDomain(view), VisualInformationPapyrusConstants.CUSTOM_MASK_LABEL);
+ Set<String> result = new HashSet<String>(values);
+ values.dispose();
+ return result;
+ }
+ return null;
+ }
+
+ public static void setMaskValues(View view, Collection<String> masks) {
+ CustomStringStyleObservableList values = new CustomStringStyleObservableList(view, EMFHelper.resolveEditingDomain(view), VisualInformationPapyrusConstants.CUSTOM_MASK_LABEL);
+ if(!values.isEmpty()) {
+ values.clear();
+ }
+ values.addAll(masks);
+ values.commit(null);
+ values.dispose();
+ }
+
+ public static void unsetMaskValues(final View view) {
+ final NamedStyle style = view.getNamedStyle(NotationPackage.eINSTANCE.getStringListValueStyle(), VisualInformationPapyrusConstants.CUSTOM_MASK_LABEL);
+ if(style == null) {
+ return;
+ }
+
+ TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)EMFHelper.resolveEditingDomain(view);
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain, "Restore default label configuration") {
+
+ @Override
+ protected void doExecute() {
+ view.getStyles().remove(style);
+ }
+ });
+ }
+
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringMask.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringMask.java
new file mode 100644
index 00000000000..669eec3b37d
--- /dev/null
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/StringMask.java
@@ -0,0 +1,211 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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.infra.widgets.editors;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A Widget to manipulate a list of values.
+ *
+ * The widget is configured with a Map of (String, String) entries (Key -> Label).
+ * It returns the list of selected keys.
+ *
+ * @author Camille Letavernier
+ */
+public class StringMask extends AbstractListEditor implements SelectionListener, IChangeListener, DisposeListener {
+
+ private Button[] checkboxes;
+
+ private Collection<String> currentValue;
+
+ private final Composite checkboxContainer;
+
+ private boolean refreshCheckboxes = true;
+
+ private boolean isReadOnly = false;
+
+ public static final String DATA_KEY = "stringValue"; //$NON-NLS-1$
+
+ public StringMask(final Composite parent, final int style) {
+ super(parent, style);
+ checkboxContainer = new Composite(this, style);
+ checkboxContainer.setLayoutData(getDefaultLayoutData());
+ checkboxContainer.setLayout(new GridLayout(2, true));
+ checkboxContainer.addDisposeListener(this);
+ }
+
+ @Override
+ protected GridData getLabelLayoutData() {
+ GridData data = super.getLabelLayoutData();
+ data.verticalAlignment = SWT.BEGINNING;
+ return data;
+ }
+
+ public Collection<String> getValue() {
+ Set<String> values = new HashSet<String>();
+ for(Button button : checkboxes) {
+ if(button.getSelection()) {
+ String value = (String)button.getData(DATA_KEY);
+ values.add(value);
+ }
+ }
+ return values;
+ }
+
+ @Override
+ public void dispose() {
+ if(modelProperty != null) {
+ modelProperty.removeChangeListener(this);
+ }
+ super.dispose();
+ }
+
+ @Override
+ public Object getEditableType() {
+ return String.class;
+ }
+
+ @Override
+ public void setReadOnly(final boolean readOnly) {
+ this.isReadOnly = readOnly;
+ for(Button button : checkboxes) {
+ button.setEnabled(!readOnly);
+ }
+ }
+
+ @Override
+ public boolean isReadOnly() {
+ return isReadOnly;
+ }
+
+ public void setMasks(final Map<String, String> values) {
+ if(checkboxes != null) {
+ disposeCheckboxes();
+ }
+
+ checkboxes = new Button[values.size()];
+
+ int i = 0;
+ for(Entry<String, String> mask : values.entrySet()) {
+ String stringValue = mask.getKey();
+ String label = mask.getValue();
+
+ checkboxes[i] = new Button(checkboxContainer, SWT.CHECK);
+ checkboxes[i].setText(label);
+ checkboxes[i].setData(DATA_KEY, stringValue);
+ checkboxes[i].addSelectionListener(this);
+ checkboxes[i].setToolTipText(stringValue);
+ i++;
+ }
+ }
+
+ protected void disposeCheckboxes() {
+ for(Button button : checkboxes) {
+ button.removeSelectionListener(this);
+ button.dispose();
+ }
+ }
+
+ public void setNumColumns(final int numColumns) {
+ ((GridLayout)checkboxContainer.getLayout()).numColumns = numColumns;
+ checkboxContainer.layout();
+ layout();
+ }
+
+ @Override
+ public void doBinding() {
+ // We don't do a real databinding here
+ modelProperty.addChangeListener(this);
+
+ refreshCheckboxes();
+ }
+
+ protected void refreshCheckboxes() {
+ if(!refreshCheckboxes) {
+ return;
+ }
+
+ Collection<String> values = getCurrentValue();
+ for(Button button : checkboxes) {
+ String value = (String)button.getData(DATA_KEY);
+ button.setSelection(values.contains(value));
+ }
+ }
+
+ @Override
+ public void setToolTipText(final String text) {
+ super.setLabelToolTipText(text);
+ }
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ Button button = (Button)e.widget;
+ String value = (String)button.getData(DATA_KEY);
+ Collection<String> values = new HashSet<String>(getCurrentValue());
+ if(button.getSelection()) {
+ values.add(value);
+ } else {
+ values.remove(value);
+ }
+ setCurrentValue(values);
+ }
+
+ protected void setCurrentValue(final Collection<String> values) {
+ if(modelProperty != null) {
+ refreshCheckboxes = false;
+ modelProperty.clear();
+ modelProperty.addAll(values);
+ refreshCheckboxes = true;
+ }
+ currentValue = values;
+
+ commit();
+ }
+
+ protected Collection<String> getCurrentValue() {
+ if(modelProperty != null) {
+ return modelProperty;
+ } else {
+ return currentValue;
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(final SelectionEvent e) {
+ // Nothing
+ }
+
+ public int getNumColumns() {
+ return ((GridLayout)checkboxContainer.getLayout()).numColumns;
+ }
+
+ @Override
+ public void handleChange(final ChangeEvent event) {
+ refreshCheckboxes();
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
index f6c49e06b49..b98ce10843d 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -24,11 +24,11 @@ public interface IMaskManagedSemanticParser extends ISemanticParser {
/** The label to show in case ParserOptions.None is passed as flag (avoid a fully masked label) */
public static final String MaskedLabel = "<empty label>";
-
+
/**
* Get the {@link Map} of masks
- *
+ *
* @return the {@link Map} of masks
*/
- public Map<Integer, String> getMasks();
+ public Map<String, String> getMasks();
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
index 290d871a00a..ac45a78f46e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java
@@ -7,12 +7,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.parser;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -53,7 +54,9 @@ public class FlowPortLabelParser extends PropertyLabelParser {
@Override
public String getPrintString(IAdaptable element, int flags) {
- if(flags == 0) {
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
@@ -67,9 +70,8 @@ public class FlowPortLabelParser extends PropertyLabelParser {
FlowPort flowPort = UMLUtil.getStereotypeApplication(property, FlowPort.class);
if(flowPort != null) {
- int directionFlag = flags & ILabelPreferenceConstants.DISP_DIRECTION;
// manage direction only if the FlowPort is type and type is not a FlowSpecification
- if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DIRECTION)) {
String direction;
switch(flowPort.getDirection().getValue()) {
case FlowDirection.IN_VALUE:
@@ -94,7 +96,7 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_VISIBILITY)) {
String visibility;
switch(property.getVisibility().getValue()) {
case VisibilityKind.PACKAGE:
@@ -117,18 +119,18 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_DERIVE)) && (property.isDerived())) {
result = String.format(DERIVED_FORMAT, result);
}
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME)) && (property.isSetName())) {
String name = property.getName();
result = String.format(NAME_FORMAT, result, name);
}
// manage type and conjugated property
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_TYPE))) {
String type = "<Undefined>";
if(property.getType() != null) {
@@ -136,7 +138,7 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE)) || (!"<Undefined>".equals(type))) {
if((flowPort != null) && (flowPort.isConjugated())) {
type = String.format(CONJUGATED_FORMAT, type);
}
@@ -145,13 +147,13 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_MULTIPLICITY))) {
// If multiplicity is [1] (SysML default), only show when explicitly asked.
// TODO : add a case for default with multiplicity not set.
String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY)) || !("1".equals(lower) && "1".equals(upper))) {
if(lower.equals(upper)) {
result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
@@ -162,7 +164,7 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_VALUE)) && ((property.getDefaultValue() != null))) {
ValueSpecification valueSpecification = property.getDefaultValue();
if(valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) {
result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
@@ -170,7 +172,7 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
// manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MODIFIERS)) {
StringBuffer sb = new StringBuffer();
if(property.isReadOnly()) {
sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
@@ -234,8 +236,8 @@ public class FlowPortLabelParser extends PropertyLabelParser {
}
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(10);
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
@@ -244,7 +246,7 @@ public class FlowPortLabelParser extends PropertyLabelParser {
masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_VALUE, "Default Value");
masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
return masks;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
index 9edb455a35f..3572f01114e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java
@@ -7,12 +7,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.parser;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -43,10 +44,12 @@ public class FlowPropertyLabelParser extends PropertyLabelParser {
@Override
public String getPrintString(IAdaptable element, int flags) {
- if (flags == 0) {
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = super.getPrintString(element, flags);
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -57,7 +60,7 @@ public class FlowPropertyLabelParser extends PropertyLabelParser {
if(flowProperty != null) {
// manage direction
- if((flags & ILabelPreferenceConstants.DISP_DIRECTION) == ILabelPreferenceConstants.DISP_DIRECTION) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DIRECTION)) {
String direction;
switch(flowProperty.getDirection().getValue()) {
case FlowDirection.IN_VALUE:
@@ -114,9 +117,10 @@ public class FlowPropertyLabelParser extends PropertyLabelParser {
}
return semanticElementsBeingParsed;
}
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(10);
+
+ @Override
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>(10);
masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
@@ -125,7 +129,7 @@ public class FlowPropertyLabelParser extends PropertyLabelParser {
masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_VALUE, "Default Value");
masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
return masks;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
index f41231b13cf..9d299989baf 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
@@ -38,8 +39,15 @@ public class RequirementLabelParser extends NamedElementLabelParser {
/**
* {@inheritDoc}
*/
+ @Override
public String getPrintString(IAdaptable element, int flags) {
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
+ return MaskedLabel;
+ }
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -49,7 +57,7 @@ public class RequirementLabelParser extends NamedElementLabelParser {
Requirement requirement = UMLUtil.getStereotypeApplication(clazz, Requirement.class);
// manage name
- if((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NAME)) {
String name = clazz.getName();
result = String.format(NAME_FORMAT, name);
}
@@ -58,7 +66,7 @@ public class RequirementLabelParser extends NamedElementLabelParser {
if(requirement != null) {
// manage id
- if((flags & ILabelPreferenceConstants.DISP_ID) == ILabelPreferenceConstants.DISP_ID) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_ID)) {
String id = requirement.getId();
result = String.format(ID_FORMAT, result, id);
}
@@ -71,6 +79,7 @@ public class RequirementLabelParser extends NamedElementLabelParser {
/**
* {@inheritDoc}
*/
+ @Override
public List<EObject> getSemanticElementsBeingParsed(EObject element) {
List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
index 66141a680b9..a430d41a7aa 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -44,12 +45,15 @@ public class UnitLabelParser extends NamedElementLabelParser {
/**
* {@inheritDoc}
*/
+ @Override
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -60,13 +64,13 @@ public class UnitLabelParser extends NamedElementLabelParser {
Unit unit = UMLUtil.getStereotypeApplication(iSpec, Unit.class);
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (iSpec.isSetName())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME)) && (iSpec.isSetName())) {
String name = iSpec.getName();
result = String.format(NAME_FORMAT, name);
}
// manage dimension
- if(((flags & ILabelPreferenceConstants.DISP_DIMENSION) == ILabelPreferenceConstants.DISP_DIMENSION)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_DIMENSION))) {
String dimensionName = "<Undefined>";
if((unit != null) && (unit.getDimension() != null)) {
Dimension dim = unit.getDimension();
@@ -85,6 +89,7 @@ public class UnitLabelParser extends NamedElementLabelParser {
/**
* {@inheritDoc}
*/
+ @Override
public boolean isAffectingEvent(Object event, int flags) {
if(event instanceof Notification) {
@@ -96,10 +101,11 @@ public class UnitLabelParser extends NamedElementLabelParser {
return false;
}
-
+
/**
* {@inheritDoc}
*/
+ @Override
public List<EObject> getSemanticElementsBeingParsed(EObject element) {
List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>();
@@ -115,10 +121,11 @@ public class UnitLabelParser extends NamedElementLabelParser {
}
return semanticElementsBeingParsed;
}
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
+
+ @Override
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
masks.put(ILabelPreferenceConstants.DISP_DIMENSION, "Dimension");
return masks;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
index 6711d85583c..50571ee812f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java
@@ -7,83 +7,40 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.preferences;
+import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
+
/**
* Label constants for label mask preferences.
*/
-public interface ILabelPreferenceConstants {
+public interface ILabelPreferenceConstants extends ICustomAppearence {
/** preference id for display labels */
- public String LABEL_DISPLAY_PREFERENCE = "label.display";
-
- /** Style constant for visibility display in labels. */
- public final static int DISP_VISIBILITY = 1 << 1;
-
- /** Style constant for isDerive display in labels. */
- public final static int DISP_DERIVE = 1 << 2;
-
- /** Style constant for name display in labels. */
- public final static int DISP_NAME = 1 << 3;
-
- /** Style constant for type display in labels. */
- public final static int DISP_TYPE = 1 << 4;
-
- /** Style constant for multiplicity display in labels. */
- public final static int DISP_MULTIPLICITY = 1 << 5;
-
- /** Style constant for default value display in labels. */
- public final static int DISP_DEFAULTVALUE = 1 << 6;
-
- /** Style constant for modifiers display in labels. */
- public final static int DISP_MODIFIERS = 1 << 7;
-
- /** Style constant for direction display in labels. */
- public final static int DISP_DIRECTION = 1 << 8;
-
- /** Style constant for conjugated info display in labels. */
- public final static int DISP_CONJUGATED = 1 << 9;
+ public String LABEL_DISPLAY_PREFERENCE = "label.display"; //$NON-NLS-1$
/** Style constant for id info display in labels. */
- public final static int DISP_ID = 1 << 10;
+ public final static String DISP_ID = "id"; //$NON-NLS-1$
/** Style constant for dimension info display in labels. */
- public final static int DISP_DIMENSION = 1 << 11;
+ public final static String DISP_DIMENSION = "dimension"; //$NON-NLS-1$
/** Style constant for specification info display in labels. */
- public final static int DISP_SPECIFICATION = 1 << 12;
+ public final static String DISP_SPECIFICATION = "specification"; //$NON-NLS-1$
/** Style constant for signal info display in labels. */
- public final static int DISP_SIGNAL = 1 << 13;
-
- /** Style constant for parameter name display in labels. */
- public final static int DISP_PARAM_NAME = 1 << 14;
-
- /** Style constant for parameter type display in labels. */
- public final static int DISP_PARAM_TYPE = 1 << 15;
-
- /** Style constant for parameter multiplicity display in labels. */
- public final static int DISP_PARAM_MULTIPLICITY = 1 << 16;
-
- /** Style constant for parameter default value display in labels. */
- public final static int DISP_PARAM_DEFAULTVALUE = 1 << 17;
-
- /** Style constant for parameter modifiers display in labels. */
- public final static int DISP_PARAM_MODIFIERS = 1 << 18;
-
- /** Style constant for parameter direction display in labels. */
- public final static int DISP_PARAM_DIRECTION = 1 << 19;
+ public final static String DISP_SIGNAL = "signal"; //$NON-NLS-1$
/** Style constant forcing multiplicity display in labels. */
- public final static int DISP_DEFAULT_MULTIPLICITY = 1 << 20;
+ public final static String DISP_DEFAULT_MULTIPLICITY = "defaultMultiplicity"; //$NON-NLS-1$
/** Style constant forcing type display in labels. */
- public final static int DISP_UNDEFINED_TYPE = 1 << 21;
+ public final static String DISP_UNDEFINED_TYPE = "undefinedType"; //$NON-NLS-1$
/** Style constant forcing name display in labels. */
- public final static int DISP_NON_NAVIGABLE_ROLE = 1 << 22;
+ public final static String DISP_NON_NAVIGABLE_ROLE = "nonNavigableRole"; //$NON-NLS-1$
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
index 7ffbbe8e246..036a23793ba 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -40,6 +40,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.TopGraphicEditPart;
@@ -72,7 +73,7 @@ import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy;
import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy;
import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
@@ -122,12 +123,12 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
/**
* Compartment-like isSelectable implementation.
- *
+ *
* By default, the edit parts get selectable only if
* the compartment's top level container matches the top level
* container of the editpart that currently has the keyboard focus
* i.e: you need to select the shape first before selecting a this label.
- *
+ *
* @see CompartmentEditPart#isSelectable()
*/
@Override
@@ -138,7 +139,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
TopGraphicEditPart focusTopEP = ((IGraphicalEditPart)focusPart).getTopGraphicEditPart();
TopGraphicEditPart myTopEP = getTopGraphicEditPart();
if(myTopEP == focusTopEP) {
- // check if the selection contains only editparts belonging to
+ // check if the selection contains only editparts belonging to
// the same top level editpart
Iterator<?> selection = getViewer().getSelectedEditParts().iterator();
while(selection.hasNext()) {
@@ -247,7 +248,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
for(View view : views) {
- if(NameLabelIconHelper.showLabelIcon(view)) {
+ if(AppearanceHelper.showElementIcon(view)) {
return org.eclipse.papyrus.sysml.diagram.common.Activator.getInstance().getLabelProvider().getImage(parserElement);
}
}
@@ -562,7 +563,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
/**
* Returns the kind of associated editor for direct edition.
- *
+ *
* @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
*/
public int getDirectEditionType() {
@@ -580,7 +581,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
/**
* Checks if an extended editor is present.
- *
+ *
* @return <code>true</code> if an extended editor is present.
*/
protected boolean checkExtendedEditor() {
@@ -592,7 +593,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
/**
* Checks if a default direct edition is available
- *
+ *
* @return <code>true</code> if a default direct edition is available
*/
protected boolean checkDefaultEdition() {
@@ -627,7 +628,7 @@ public abstract class AbstractElementNodeLabelEditPart extends GraphicalEditPart
/**
* Performs the direct edit usually used by GMF editors.
- *
+ *
* @param theRequest
* the direct edit request that starts the direct edit system
*/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
index be27e485713..ceea2535b90 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java
@@ -17,17 +17,13 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart;
import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
-import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper;
/**
@@ -41,8 +37,8 @@ public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements I
/**
* {@inheritDoc}
*/
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>();
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
IParser parser = getHostLabelEditPart().getParser();
if(parser instanceof IMaskManagedSemanticParser) {
@@ -55,53 +51,22 @@ public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements I
/**
* {@inheritDoc}
*/
- public int getCurrentDisplayValue() {
- return getHostLabelEditPart().getParserOptions().intValue();
+ public Collection<String> getCurrentDisplayValue() {
+ return MaskLabelHelper.getMaskValues(getView());
}
/**
* {@inheritDoc}
*/
- public int getDefaultDisplayValue() {
- return getHostLabelEditPart().getDefaultParserOptions().intValue();
- }
-
- /**
- * {@inheritDoc}
- */
- public void updateDisplayValue(int newValue) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new AddMaskManagedLabelDisplayCommand(editingDomain, (EModelElement)getHost().getModel(), newValue));
- }
+ public void updateDisplayValue(Collection<String> maskValues) {
+ MaskLabelHelper.setMaskValues(getView(), maskValues);
}
/**
* {@inheritDoc}
*/
public void setDefaultDisplayValue() {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new RemoveEAnnotationCommand(editingDomain, (EModelElement)getHost().getModel(), VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION));
- }
- }
-
- // @unused.
- public String getMaskLabel(int value) {
- // Not implemented.
- return null;
- }
-
- // @unused.
- public Collection<String> getMaskLabels() {
- // Not implemented.
- return null;
- }
-
- // @unused.
- public Collection<Integer> getMaskValues() {
- // Not implemented.
- return null;
+ MaskLabelHelper.unsetMaskValues(getView());
}
// @unused.
@@ -117,10 +82,14 @@ public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements I
/**
* Get the host label edit part (has to implement {@link ITextAwareEditPart}).
- *
+ *
* @return the host label edit part.
*/
private ITextAwareEditPart getHostLabelEditPart() {
return (ITextAwareEditPart)getHost();
}
+
+ private View getView() {
+ return (View)getHost().getModel();
+ }
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
index 3714a8a30c5..acfda87b46a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java
@@ -7,12 +7,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
+import java.util.Collection;
import java.util.Collections;
import java.util.Map;
@@ -21,6 +22,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.InstanceValue;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.ValueSpecification;
@@ -39,8 +41,9 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
+ Collection<String> maskValues = getMaskValues(element);
- if(flags == 0) {
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
@@ -52,7 +55,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
Property property = (Property)eObject;
// manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_VISIBILITY)) {
String visibility;
switch(property.getVisibility().getValue()) {
case VisibilityKind.PACKAGE:
@@ -75,24 +78,24 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
}
// manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DERIVE) && property.isDerived()) {
result = String.format(DERIVED_FORMAT, result);
}
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NAME) && property.isSetName()) {
String name = property.getName();
// If property is owned by Association (non navigable) only show the name when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) == ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) || !((property.getOwningAssociation() != null) && (property.getOwningAssociation().getOwnedEnds().contains(property)))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) || !((property.getOwningAssociation() != null) && (property.getOwningAssociation().getOwnedEnds().contains(property)))) {
result = String.format(NAME_FORMAT, result, name);
}
}
// manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_TYPE)) {
String type = "<Undefined>";
if(property.getType() != null) {
type = property.getType().getName();
@@ -100,19 +103,19 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
result = String.format(TYPE_FORMAT, result, type);
}
}
// manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
// If multiplicity is [1] (SysML default), only show when explicitly asked.
String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
if(lower.equals(upper)) {
result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
@@ -123,7 +126,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
}
// manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) {
ValueSpecification valueSpecification = property.getDefaultValue();
if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
@@ -131,7 +134,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
}
// manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MODIFIERS)) {
StringBuffer sb = new StringBuffer();
if(property.isReadOnly()) {
sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
@@ -163,7 +166,7 @@ public class AssociationEndLabelParser extends PropertyLabelParser {
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return Collections.emptyMap();
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
index 96c30980bda..c15b8038d7b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -42,11 +43,13 @@ public class ConnectorLabelParser extends NamedElementLabelParser {
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -55,20 +58,20 @@ public class ConnectorLabelParser extends NamedElementLabelParser {
Connector connector = (Connector)eObject;
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (connector.isSetName())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NAME) && (connector.isSetName())) {
String name = connector.getName();
result = String.format(NAME_FORMAT, name);
}
// manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_TYPE)) {
String type = "<Undefined>";
if(connector.getType() != null) {
type = connector.getType().getName();
}
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || !"<Undefined>".equals(type)) {
result = String.format(TYPE_FORMAT, result, type);
}
}
@@ -85,7 +88,7 @@ public class ConnectorLabelParser extends NamedElementLabelParser {
if(event instanceof Notification) {
Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) {
+ if(feature instanceof EStructuralFeature) {
return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || super.isAffectingEvent(event, flags);
}
}
@@ -110,9 +113,10 @@ public class ConnectorLabelParser extends NamedElementLabelParser {
}
return semanticElementsBeingParsed;
}
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
+
+ @Override
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
index 49d7500ce8c..b3bb50a2513 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -51,11 +52,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
*/
@Override
public String getEditString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String editString = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -63,13 +66,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
Constraint semElement = (Constraint)eObject;
// edit name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME))) {
if(semElement.isSetName()) {
editString = semElement.getName();
}
// (try to) edit constraint specification
- } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ } else if((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) {
if(semElement.getSpecification() != null) {
editString = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
if(editString == null) {
@@ -86,6 +89,12 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
+ return MaskedLabel;
+ }
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -94,13 +103,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
Constraint semElement = (Constraint)eObject;
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (semElement.isSetName())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME)) && (semElement.isSetName())) {
String name = semElement.getName();
result = String.format(NAME_FORMAT, name);
}
// manage specification
- if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) {
String spec = "<Undefined>";
if(semElement.getSpecification() != null) {
spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification());
@@ -120,6 +129,8 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
@Override
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
+ Collection<String> maskValues = getMaskValues(element);
+
ICommand command = UnexecutableCommand.INSTANCE;
SetRequest updateRequest = null;
@@ -129,12 +140,12 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
}
// prepare set name request
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME))) {
updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
updateRequest.setLabel("Update Constraint Label");
// prepare set specification request
- } else if(((flags & ILabelPreferenceConstants.DISP_SPECIFICATION) == ILabelPreferenceConstants.DISP_SPECIFICATION)) {
+ } else if((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) {
ValueSpecification spec = constraint.getSpecification();
if(spec == null) {
return UnexecutableCommand.INSTANCE;
@@ -193,13 +204,13 @@ public class ConstraintLabelParser extends NamedElementLabelParser {
}
return semanticElementsBeingParsed;
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>(2);
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
masks.put(ILabelPreferenceConstants.DISP_SPECIFICATION, "Specification");
return masks;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
index 93f3ee3cf94..12de26abe32 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java
@@ -7,13 +7,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -27,8 +29,10 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper;
import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
import org.eclipse.uml2.uml.MultiplicityElement;
@@ -58,23 +62,25 @@ public class MultiplicityElementLabelParser implements IMaskManagedSemanticParse
public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
return ParserEditStatus.UNEDITABLE_STATUS;
}
-
+
/**
* {@inheritDoc}
*/
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
return UnexecutableCommand.INSTANCE;
}
-
+
/**
* {@inheritDoc}
*/
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -83,13 +89,13 @@ public class MultiplicityElementLabelParser implements IMaskManagedSemanticParse
MultiplicityElement multElt = (MultiplicityElement)eObject;
// manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_MULTIPLICITY))) {
// If multiplicity is [1] (SysML default), only show when explicitly asked.
// TODO : add a case for default with multiplicity not set.
String lower = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getLowerValue()) : "1";
String upper = (multElt.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(multElt.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
if(lower.equals(upper)) {
result = String.format(MULTIPLICITY_FORMAT_ALT, lower, upper);
@@ -123,7 +129,7 @@ public class MultiplicityElementLabelParser implements IMaskManagedSemanticParse
public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
return null;
}
-
+
/**
* {@inheritDoc}
*/
@@ -143,18 +149,27 @@ public class MultiplicityElementLabelParser implements IMaskManagedSemanticParse
}
return semanticElementsBeingParsed;
}
-
+
/**
* {@inheritDoc}
*/
public boolean areSemanticElementsAffected(EObject listener, Object notification) {
return true;
}
-
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
+
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
return masks;
}
+
+ protected Collection<String> getMaskValues(IAdaptable element) {
+ View view = (View)element.getAdapter(View.class);
+ if(view == null) {
+ return Collections.emptySet();
+ }
+
+ return MaskLabelHelper.getMaskValues(view);
+ }
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
index 298f5ce826c..1d67136a4ca 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -28,9 +29,11 @@ import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.papyrus.gmf.diagram.common.parser.IMaskManagedSemanticParser;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.uml2.uml.NamedElement;
@@ -141,7 +144,16 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser {
/**
* {@inheritDoc}
*/
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return Collections.emptyMap();
}
+
+ protected Collection<String> getMaskValues(IAdaptable element) {
+ View view = (View)element.getAdapter(View.class);
+ if(view == null) {
+ return Collections.emptySet();
+ }
+
+ return MaskLabelHelper.getMaskValues(view);
+ }
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
index dffc5c0fadd..d96fbb412fc 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -55,11 +56,13 @@ public class OperationLabelParser extends NamedElementLabelParser {
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -68,7 +71,7 @@ public class OperationLabelParser extends NamedElementLabelParser {
Operation operation = (Operation)eObject;
// manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_VISIBILITY)) {
String visibility;
switch(operation.getVisibility().getValue()) {
case VisibilityKind.PACKAGE:
@@ -91,7 +94,7 @@ public class OperationLabelParser extends NamedElementLabelParser {
}
// manage name and parameters
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (operation.isSetName())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME)) && (operation.isSetName())) {
String name = operation.getName();
StringBuffer params = new StringBuffer();
@@ -104,20 +107,20 @@ public class OperationLabelParser extends NamedElementLabelParser {
}
// manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_TYPE))) {
String type = "<Undefined>";
if(operation.getType() != null) {
type = operation.getType().getName();
}
-
+
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE)) || (!"<Undefined>".equals(type))) {
result = String.format(TYPE_FORMAT, result, type);
}
}
// manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MODIFIERS)) {
StringBuffer sb = new StringBuffer();
if(operation.isAbstract()) {
sb.append(sb.length() == 0 ? "abstract" : ", abstract");
@@ -180,19 +183,25 @@ public class OperationLabelParser extends NamedElementLabelParser {
}
return semanticElementsBeingParsed;
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(5);
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>(5);
masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
- masks.putAll(parameterParser.getMasks());
+
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_DIRECTION, "Parameter direction");
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_NAME, "Parameter name");
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_TYPE, "Parameter type");
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_MULTIPLICITY, "Parameter multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_DEFAULT, "Parameter default value");
+ masks.put(ILabelPreferenceConstants.DISP_PARAMETER_MODIFIERS, "Parameter modifiers");
return masks;
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
index 307e05a75c9..12fba016fa6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -58,20 +59,22 @@ public class ParameterLabelParser extends NamedElementLabelParser {
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = "";
EObject eObject = (EObject)element.getAdapter(EObject.class);
- if((eObject != null) && (eObject instanceof Parameter)) {
+ if(eObject != null && eObject instanceof Parameter) {
Parameter parameter = (Parameter)eObject;
// manage direction
- if((flags & ILabelPreferenceConstants.DISP_PARAM_DIRECTION) == ILabelPreferenceConstants.DISP_PARAM_DIRECTION) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DIRECTION) || maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_DIRECTION)) {
String direction;
switch(parameter.getDirection().getValue()) {
case ParameterDirectionKind.IN:
@@ -93,20 +96,20 @@ public class ParameterLabelParser extends NamedElementLabelParser {
result = String.format(DIRECTION_FORMAT, direction, result);
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_NAME) == ILabelPreferenceConstants.DISP_PARAM_NAME) && (parameter.isSetName())) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_NAME) || maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_NAME)) && (parameter.isSetName())) {
String name = parameter.getName();
result = String.format(NAME_FORMAT, result, name);
}
// manage type
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_TYPE) == ILabelPreferenceConstants.DISP_PARAM_TYPE)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_TYPE) || maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_TYPE)) {
String type = "<Undefined>";
if(parameter.getType() != null) {
type = parameter.getType().getName();
}
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
result = String.format(TYPE_FORMAT, result, type);
}
}
@@ -114,12 +117,12 @@ public class ParameterLabelParser extends NamedElementLabelParser {
// manage multiplicity
String lower = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getLowerValue()) : "1";
String upper = (parameter.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(parameter.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) == ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY) && !("1".equals(lower) && "1".equals(upper))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_MULTIPLICITY) || maskValues.contains(ILabelPreferenceConstants.DISP_MULTIPLICITY)) && !("1".equals(lower) && "1".equals(upper))) {
result = String.format(MULTIPLICITY_FORMAT, result, lower, upper);
}
// manage default value
- if(((flags & ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE) && ((parameter.getDefaultValue() != null))) {
+ if((maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_DEFAULT) || maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) {
ValueSpecification valueSpecification = parameter.getDefaultValue();
if((valueSpecification instanceof InstanceValue && parameter.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
@@ -127,7 +130,7 @@ public class ParameterLabelParser extends NamedElementLabelParser {
}
// manage modifier
- if((flags & ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) == ILabelPreferenceConstants.DISP_PARAM_MODIFIERS) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_PARAMETER_MODIFIERS) || maskValues.contains(ILabelPreferenceConstants.DISP_MODIFIERS)) {
StringBuffer sb = new StringBuffer();
if(parameter.isOrdered()) {
sb.append(sb.length() == 0 ? "ordered" : ", ordered");
@@ -192,19 +195,19 @@ public class ParameterLabelParser extends NamedElementLabelParser {
}
return semanticElementsBeingParsed;
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(6);
- masks.put(ILabelPreferenceConstants.DISP_PARAM_DIRECTION, "Parameter direction");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_NAME, "Parameter name");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_TYPE, "Parameter type");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_MULTIPLICITY, "Parameter multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_DEFAULTVALUE, "Parameter default value");
- masks.put(ILabelPreferenceConstants.DISP_PARAM_MODIFIERS, "Parameter modifiers");
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
+ masks.put(ILabelPreferenceConstants.DISP_DIRECTION, "Direction");
+ masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
+ masks.put(ILabelPreferenceConstants.DISP_TYPE, "Type");
+ masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_VALUE, "Default value");
+ masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
return masks;
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
index d2f57ade3b0..58ba4cb5ed2 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,7 +67,9 @@ public class PropertyLabelParser extends NamedElementLabelParser {
@Override
public String getPrintString(IAdaptable element, int flags) {
- if(flags == 0) {
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
@@ -78,7 +81,7 @@ public class PropertyLabelParser extends NamedElementLabelParser {
Property property = (Property)eObject;
// manage visibility
- if((flags & ILabelPreferenceConstants.DISP_VISIBILITY) == ILabelPreferenceConstants.DISP_VISIBILITY) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_VISIBILITY)) {
String visibility;
switch(property.getVisibility().getValue()) {
case VisibilityKind.PACKAGE:
@@ -101,37 +104,37 @@ public class PropertyLabelParser extends NamedElementLabelParser {
}
// manage derived modifier
- if(((flags & ILabelPreferenceConstants.DISP_DERIVE) == ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DERIVE) && (property.isDerived())) {
result = String.format(DERIVED_FORMAT, result);
}
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NAME) && (property.isSetName())) {
String name = property.getName();
result = String.format(NAME_FORMAT, result, name);
}
// manage type
- if(((flags & ILabelPreferenceConstants.DISP_TYPE) == ILabelPreferenceConstants.DISP_TYPE)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_TYPE)) {
String type = "<Undefined>";
if(property.getType() != null) {
type = property.getType().getName();
}
// If type is undefined only show "<Undefined>" when explicitly asked.
- if(((flags & ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) == ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) {
result = String.format(TYPE_FORMAT, result, type);
}
}
// manage multiplicity
- if(((flags & ILabelPreferenceConstants.DISP_MULTIPLICITY) == ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MULTIPLICITY)) {
// If multiplicity is [1] (SysML default), only show when explicitly asked.
// TODO : add a case for default with multiplicity not set.
String lower = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getLowerValue()) : "1";
String upper = (property.getLowerValue() != null) ? ValueSpecificationUtil.getSpecificationValue(property.getUpperValue()) : "1";
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) == ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY) || !("1".equals(lower) && "1".equals(upper))) {
if(lower.equals(upper)) {
result = String.format(MULTIPLICITY_FORMAT_ALT, result, lower, upper);
@@ -142,7 +145,7 @@ public class PropertyLabelParser extends NamedElementLabelParser {
}
// manage default value
- if(((flags & ILabelPreferenceConstants.DISP_DEFAULTVALUE) == ILabelPreferenceConstants.DISP_DEFAULTVALUE) && ((property.getDefaultValue() != null))) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) {
ValueSpecification valueSpecification = property.getDefaultValue();
if((valueSpecification instanceof InstanceValue && property.getType().equals(valueSpecification.getType())) || !(valueSpecification instanceof InstanceValue)) {
result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification));
@@ -150,7 +153,7 @@ public class PropertyLabelParser extends NamedElementLabelParser {
}
// manage modifier
- if((flags & ILabelPreferenceConstants.DISP_MODIFIERS) == ILabelPreferenceConstants.DISP_MODIFIERS) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_MODIFIERS)) {
StringBuffer sb = new StringBuffer();
if(property.isReadOnly()) {
sb.append(sb.length() == 0 ? "readOnly" : ", readOnly");
@@ -187,7 +190,7 @@ public class PropertyLabelParser extends NamedElementLabelParser {
if(event instanceof Notification) {
Object feature = ((Notification)event).getFeature();
- if(feature instanceof EStructuralFeature) { // UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) ||
+ if(feature instanceof EStructuralFeature) { // UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) ||
return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature) || super.isAffectingEvent(event, flags);
}
}
@@ -226,8 +229,8 @@ public class PropertyLabelParser extends NamedElementLabelParser {
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(9);
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_VISIBILITY, "Visibility");
masks.put(ILabelPreferenceConstants.DISP_DERIVE, "Is Derived");
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
@@ -235,7 +238,7 @@ public class PropertyLabelParser extends NamedElementLabelParser {
masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type");
masks.put(ILabelPreferenceConstants.DISP_MULTIPLICITY, "Multiplicity");
masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity");
- masks.put(ILabelPreferenceConstants.DISP_DEFAULTVALUE, "Default Value");
+ masks.put(ILabelPreferenceConstants.DISP_DEFAULT_VALUE, "Default Value");
masks.put(ILabelPreferenceConstants.DISP_MODIFIERS, "Modifiers");
return masks;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
index b5a7b690391..fe200e59a04 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java
@@ -7,13 +7,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.parser;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -46,11 +47,13 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa
*/
@Override
public String getPrintString(IAdaptable element, int flags) {
-
- if (flags == 0) {
+
+ Collection<String> maskValues = getMaskValues(element);
+
+ if(maskValues.isEmpty()) {
return MaskedLabel;
}
-
+
String result = PREFIX;
EObject eObject = (EObject)element.getAdapter(EObject.class);
@@ -59,13 +62,13 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa
Reception reception = (Reception)eObject;
// manage name
- if(((flags & ILabelPreferenceConstants.DISP_NAME) == ILabelPreferenceConstants.DISP_NAME) && (reception.isSetName())) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_NAME) && reception.isSetName()) {
String name = reception.getName();
result = String.format(NAME_FORMAT, result, name);
}
// manage signal
- if(((flags & ILabelPreferenceConstants.DISP_SIGNAL) == ILabelPreferenceConstants.DISP_SIGNAL)) {
+ if(maskValues.contains(ILabelPreferenceConstants.DISP_SIGNAL)) {
String type = "<Undefined>";
if(reception.getSignal() != null) {
type = reception.getSignal().getName();
@@ -110,13 +113,13 @@ public class ReceptionLabelParser extends NamedElementLabelParser implements IMa
}
return semanticElementsBeingParsed;
}
-
+
/**
* {@inheritDoc}
*/
@Override
- public Map<Integer, String> getMasks() {
- Map<Integer, String> masks = new HashMap<Integer, String>(2);
+ public Map<String, String> getMasks() {
+ Map<String, String> masks = new HashMap<String, String>();
masks.put(ILabelPreferenceConstants.DISP_NAME, "Name");
masks.put(ILabelPreferenceConstants.DISP_SIGNAL, "Signel");
return masks;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.classpath
index f6326c88c74..704f76c8d92 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.classpath
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="custom-src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f287d53cf45
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
index 09689e8b0cb..ecc94ac9a49 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/META-INF/MANIFEST.MF
@@ -30,7 +30,7 @@ Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-Name: %pluginName
Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.expressions,
org.eclipse.ui.navigator,
org.eclipse.ui.navigator.resources,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/InstanceSpecificationLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/InstanceSpecificationLabelHelper.java
deleted file mode 100644
index b23c79b15ef..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/helper/InstanceSpecificationLabelHelper.java
+++ /dev/null
@@ -1,146 +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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz.custom.helper;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
-import org.eclipse.papyrus.uml.tools.utils.InstanceSpecificationUtil;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * Helper for labels displaying {@link Property}
- */
-public class InstanceSpecificationLabelHelper extends StereotypedElementLabelHelper implements ILabelMaskProvider {
-
- //Singleton instance
- private static InstanceSpecificationLabelHelper labelHelper;
-
- public static InstanceSpecificationLabelHelper getInstance() {
- if(labelHelper == null) {
- labelHelper = new InstanceSpecificationLabelHelper();
- }
- return labelHelper;
- }
-
- /** Map for masks */
- protected final Map<Integer, String> masks = new HashMap<Integer, String>();
-
- protected InstanceSpecificationLabelHelper() {
- // initialize the map
- masks.put(ICustomAppearence.DISP_NAME, "Name");
- masks.put(ICustomAppearence.DISP_TYPE, "Type");
- }
-
- /**
- * Computes the label that should be displayed by the figure managed by this
- * edit part.
- *
- * @param editPart
- * the edit part that controls the {@link Property} to be
- * displayed
- * @return the label corresponding to the specific display of the property
- * ("default" display given by preferences or specific display given
- * by eAnnotation).
- */
- @Override
- protected String elementLabel(GraphicalEditPart editPart) {
- int displayValue = getDefaultValue();
-
- IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
-
- if(policy != null) {
- displayValue = policy.getCurrentDisplayValue();
- } else if(editPart.getModel() instanceof View) {
- displayValue = AppearanceHelper.getLabelDisplay((View)editPart.getModel());
- }
-
- return parseString(editPart, displayValue);
- }
-
- protected String parseString(GraphicalEditPart editPart, int displayValue) {
- InstanceSpecification instance = getUMLElement(editPart);
-
- if(instance != null) {
- return InstanceSpecificationUtil.getCustomLabel(instance, displayValue);
- }
-
- return "";
- }
-
- /**
- * Returns the mask name given the value of the mask
- *
- * @return the mask name or <code>null</code> if no masks has been found
- */
- public String getMaskLabel(int value) {
- return masks.get(value);
- }
-
- /**
- * Returns the collection of mask names
- *
- * @return the collection of mask names
- */
- public Collection<String> getMaskLabels() {
- return masks.values();
- }
-
- /**
- * Returns the map of masks used to display a {@link Property}
- *
- * @return the {@link Map} of masks used to display a {@link Property}
- */
- @Override
- public Map<Integer, String> getMasks() {
- return masks;
- }
-
- /**
- * Returns the collection of mask values
- *
- * @return the collection of mask values
- */
- public Set<Integer> getMaskValues() {
- return masks.keySet();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public InstanceSpecification getUMLElement(GraphicalEditPart editPart) {
- if(editPart.getModel() instanceof View) {
- View view = (View)editPart.getModel();
- if(view.getElement() instanceof InstanceSpecification) {
- return (InstanceSpecification)view.getElement();
- }
- }
- return null;
- }
-
- @Override
- public int getDefaultValue() {
- return ICustomAppearence.DEFAULT_UML_INSTANCESPECIFICATION;
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java
index 5760af781b5..6bc06bf0f0d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/PropertyParser.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2008, 2009 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
@@ -33,42 +33,43 @@ import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
-import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
import org.eclipse.uml2.uml.Property;
/**
* This the parser in charge of editing and displaying properties in Papyrus. For the edition of
* properties, a dialog box is opened
- *
+ *
* @author Patrick Tessier
*/
public class PropertyParser implements IParser {
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
return null;
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public String getEditString(final IAdaptable element, int flags) {
if(element instanceof EObjectAdapter) {
final Property property = ((Property)((EObjectAdapter)element).getRealObject());
- return PropertyUtil.getCustomLabel(property, ICustomAppearence.DISP_NAME);
+ return property.getName();
}
return "";
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
final Property property = ((Property)((EObjectAdapter)element).getRealObject());
final String result = newString;
@@ -78,12 +79,14 @@ public class PropertyParser implements IParser {
} catch (ServiceException ex) {
return null;
}
- AbstractTransactionalCommand tc = new AbstractTransactionalCommand(editingDomain, "Edit Property", (List)null) {
+
+ AbstractTransactionalCommand tc = new AbstractTransactionalCommand(editingDomain, "Edit Property", (List<?>)null) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
SafeRunnable.run(new SafeRunnable() {
+ @Override
public void run() {
RecordingCommand rc = new RecordingCommand(getEditingDomain()) {
@@ -102,25 +105,28 @@ public class PropertyParser implements IParser {
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public String getPrintString(IAdaptable element, int flags) {
return "<default>";
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public boolean isAffectingEvent(Object event, int flags) {
return false;
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.OK, "");
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationBranchEndMultiplicityEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationBranchEndMultiplicityEditPolicy.java
index b25f88ab65b..091c4ceeb43 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationBranchEndMultiplicityEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationBranchEndMultiplicityEditPolicy.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -13,21 +13,24 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+import java.util.Collection;
+import java.util.Collections;
+
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
/**
* this class enables to refresh the multiplicity label of the association end (target)
- *
+ *
*/
public class DisplayAssociationBranchEndMultiplicityEditPolicy extends DisplayAssociationBranchEndEditPolicy {
/**
- *
+ *
* @see org.eclipse.papyrus.uml.diagram.clazz.custom.policies.DisplayAssociationEndEditPolicy#getDefaultDisplayValue()
- *
+ *
*/
@Override
- public int getDefaultDisplayValue() {
- return ICustomAppearence.DISP_MULTIPLICITY;
+ protected Collection<String> getDefaultDisplayValue() {
+ return Collections.singleton(ICustomAppearence.DISP_MULTIPLICITY);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndEditPolicy.java
index 4ab90fd19a3..78461a0f459 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndEditPolicy.java
@@ -14,6 +14,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -67,42 +68,18 @@ public class DisplayAssociationEndEditPolicy extends AbstractMaskManagedEditPoli
* {@inheritDoc}
*/
@Override
- public int getDefaultDisplayValue() {
- return ICustomAppearence.DISP_VISIBILITY | ICustomAppearence.DISP_DERIVE | ICustomAppearence.DISP_NAME;
+ protected Collection<String> getDefaultDisplayValue() {
+ return Arrays.asList(ICustomAppearence.DISP_VISIBILITY, ICustomAppearence.DISP_DERIVE, ICustomAppearence.DISP_NAME);
}
/**
* {@inheritDoc}
*/
@Override
- public String getMaskLabel(int value) {
- return propertyLabelHelper.getMaskLabel(value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getMaskLabels() {
- return propertyLabelHelper.getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return propertyLabelHelper.getMasks();
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<Integer> getMaskValues() {
- return propertyLabelHelper.getMaskValues();
- }
-
@Override
public String getPreferencePageID() {
return "org.eclipse.papyrus.uml.diagram.clazz.custom.preferences.PropertyPreferencePage";
@@ -163,7 +140,7 @@ public class DisplayAssociationEndEditPolicy extends AbstractMaskManagedEditPoli
/**
* notifies that the the property has changed.
- *
+ *
* @param property
* the property that has changed
* @param notification
@@ -242,7 +219,7 @@ public class DisplayAssociationEndEditPolicy extends AbstractMaskManagedEditPoli
/**
* notifies that the type of the property has changed.
- *
+ *
* @param type
* the type of the property that has changed
* @param notification
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndSourceMultiplicityEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndSourceMultiplicityEditPolicy.java
index 88908dbc662..f07e6c2d400 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndSourceMultiplicityEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndSourceMultiplicityEditPolicy.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -13,21 +13,24 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+import java.util.Collection;
+import java.util.Collections;
+
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
/**
* this class enables to refresh the multiplicity label of the association end (source)
- *
+ *
*/
public class DisplayAssociationEndSourceMultiplicityEditPolicy extends DisplayAssociationEndSourceEditPolicy {
/**
- *
+ *
* @see org.eclipse.papyrus.uml.diagram.clazz.custom.policies.DisplayAssociationEndEditPolicy#getDefaultDisplayValue()
- *
+ *
*/
@Override
- public int getDefaultDisplayValue() {
- return ICustomAppearence.DISP_MULTIPLICITY;
+ public Collection<String> getDefaultDisplayValue() {
+ return Collections.singleton(ICustomAppearence.DISP_MULTIPLICITY);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndTargetMultiplicityEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndTargetMultiplicityEditPolicy.java
index e8f2208aa53..c0a5198cacd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndTargetMultiplicityEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/DisplayAssociationEndTargetMultiplicityEditPolicy.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -13,21 +13,24 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
+import java.util.Collection;
+import java.util.Collections;
+
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
/**
* this class enables to refresh the multiplicity label of the association end (target)
- *
+ *
*/
public class DisplayAssociationEndTargetMultiplicityEditPolicy extends DisplayAssociationEndTargetEditPolicy {
/**
- *
+ *
* @see org.eclipse.papyrus.uml.diagram.clazz.custom.policies.DisplayAssociationEndEditPolicy#getDefaultDisplayValue()
- *
+ *
*/
@Override
- public int getDefaultDisplayValue() {
- return ICustomAppearence.DISP_MULTIPLICITY;
+ public Collection<String> getDefaultDisplayValue() {
+ return Collections.singleton(ICustomAppearence.DISP_MULTIPLICITY);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationNameLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationNameLabelEditPolicy.java
index 3ca31755957..654805b6191 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationNameLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/InstanceSpecificationNameLabelEditPolicy.java
@@ -15,6 +15,7 @@
package org.eclipse.papyrus.uml.diagram.clazz.custom.policies;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -22,7 +23,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.InstanceSpecificationLabelHelper;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
import org.eclipse.papyrus.uml.tools.utils.InstanceSpecificationUtil;
@@ -35,8 +35,12 @@ import org.eclipse.uml2.uml.UMLPackage;
*/
public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManagedEditPolicy {
+ protected final Map<String, String> masks = new HashMap<String, String>();
+
public InstanceSpecificationNameLabelEditPolicy() {
super();
+ masks.put(ICustomAppearence.DISP_NAME, "Name");
+ masks.put(ICustomAppearence.DISP_TYPE, "Type");
}
@Override
@@ -63,13 +67,12 @@ public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManage
/**
* @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getMaskLabel(int)
- *
+ *
* @param value
* @return
*/
- @Override
public String getMaskLabel(int value) {
- return InstanceSpecificationLabelHelper.getInstance().getMaskLabel(value);
+ return masks.get(value);
}
@Override
@@ -82,42 +85,17 @@ public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManage
}
/**
- * @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getMaskLabels()
- *
- * @return
- */
- @Override
- public Collection<String> getMaskLabels() {
- return InstanceSpecificationLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getMaskValues()
- *
- * @return
- */
- @Override
- public Collection<Integer> getMaskValues() {
- return InstanceSpecificationLabelHelper.getInstance().getMaskValues();
- }
-
- /**
* @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getMasks()
- *
+ *
* @return
*/
@Override
- public Map<Integer, String> getMasks() {
- return InstanceSpecificationLabelHelper.getInstance().getMasks();
+ public Map<String, String> getMasks() {
+ return masks;
}
- /**
- * @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getDefaultDisplayValue()
- *
- * @return
- */
@Override
- public int getDefaultDisplayValue() {
+ protected Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_INSTANCESPECIFICATION;
}
@@ -130,7 +108,7 @@ public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManage
// - the annotation corresponding to the display of the stereotype changes
// - the stereotype application list has changed
Object object = notification.getNotifier();
-
+ InstanceSpecification instance = getUMLElement();
if(notification.getEventType() == Notification.ADD) {
if(notification.getFeature().equals(UMLPackage.eINSTANCE.getInstanceSpecification_Classifier())) {
getDiagramEventBroker().addNotificationListener((EObject)notification.getNewValue(), this);
@@ -159,7 +137,7 @@ public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManage
/**
* @see org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy#getPreferencePageID()
- *
+ *
* @return
*/
@Override
@@ -169,7 +147,7 @@ public class InstanceSpecificationNameLabelEditPolicy extends AbstractMaskManage
/**
* @see org.eclipse.papyrus.uml.diagram.common.editpolicies.AbstractMaskManagedEditPolicy#refreshDisplay()
- *
+ *
*/
@Override
public void refreshDisplay() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/OperationLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/OperationLabelEditPolicy.java
index d465741c950..d6b3b48aaa8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/OperationLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/OperationLabelEditPolicy.java
@@ -66,7 +66,7 @@ public class OperationLabelEditPolicy extends AbstractMaskManagedEditPolicy {
* {@inheritDoc}
*/
@Override
- public int getDefaultDisplayValue() {
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_OPERATION;
}
@@ -74,23 +74,7 @@ public class OperationLabelEditPolicy extends AbstractMaskManagedEditPolicy {
* {@inheritDoc}
*/
@Override
- public String getMaskLabel(int value) {
- return OperationLabelHelper.getInstance().getMaskLabel(value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getMaskLabels() {
- return OperationLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return OperationLabelHelper.getInstance().getMasks();
}
@@ -98,14 +82,6 @@ public class OperationLabelEditPolicy extends AbstractMaskManagedEditPolicy {
* {@inheritDoc}
*/
@Override
- public Collection<Integer> getMaskValues() {
- return OperationLabelHelper.getInstance().getMaskValues();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public String getPreferencePageID() {
return "org.eclipse.papyrus.uml.diagram.clazz.custom.preferences.OperationPreferencePage";
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/PropertyLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/PropertyLabelEditPolicy.java
index cef8cbb63c8..209393c7b28 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/PropertyLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/policies/PropertyLabelEditPolicy.java
@@ -65,7 +65,7 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
* {@inheritDoc}
*/
@Override
- public int getDefaultDisplayValue() {
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_PROPERTY;
}
@@ -73,34 +73,10 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
* {@inheritDoc}
*/
@Override
- public String getMaskLabel(int value) {
- return PropertyLabelHelper.getInstance().getMaskLabel(value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<String> getMaskLabels() {
- return PropertyLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return PropertyLabelHelper.getInstance().getMasks();
}
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection<Integer> getMaskValues() {
- return PropertyLabelHelper.getInstance().getMaskValues();
- }
-
@Override
public String getPreferencePageID() {
return "org.eclipse.papyrus.uml.diagram.clazz.custom.preferences.PropertyPreferencePage";
@@ -154,7 +130,7 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the the property has changed.
- *
+ *
* @param property
* the property that has changed
* @param notification
@@ -233,7 +209,7 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the type of the property has changed.
- *
+ *
* @param type
* the type of the property that has changed
* @param notification
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/OperationPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/OperationPreferencePage.java
index c5783e5afaf..35eee3b9621 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/OperationPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/OperationPreferencePage.java
@@ -139,7 +139,7 @@ public class OperationPreferencePage extends AbstractPapyrusElementPreferencePag
data.left = new FormAttachment(displName, 85);
data.top = new FormAttachment(0, 0);
displParamDirection.setLayoutData(data);
- displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MOFIFIERS);
+ displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MODIFIERS);
data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
@@ -233,7 +233,7 @@ public class OperationPreferencePage extends AbstractPapyrusElementPreferencePag
displName.setSelection((operationValue & ICustomAppearence.DISP_NAME) == ICustomAppearence.DISP_NAME);
displParamDirection.setSelection((operationValue & ICustomAppearence.DISP_PARAMETER_DIRECTION) == ICustomAppearence.DISP_PARAMETER_DIRECTION);
displParameterType.setSelection((operationValue & ICustomAppearence.DISP_PARAMETER_TYPE) == ICustomAppearence.DISP_PARAMETER_TYPE);
- displModifiers.setSelection((operationValue & ICustomAppearence.DISP_MOFIFIERS) == ICustomAppearence.DISP_MOFIFIERS);
+ displModifiers.setSelection((operationValue & ICustomAppearence.DISP_MODIFIERS) == ICustomAppearence.DISP_MODIFIERS);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/PropertyPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/PropertyPreferencePage.java
index 7c15103b18f..925ff70c076 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/PropertyPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/preferences/PropertyPreferencePage.java
@@ -146,12 +146,12 @@ public class PropertyPreferencePage extends AbstractPapyrusElementPreferencePage
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
displMutliplicity.setLayoutData(data);
- displDfltValue = createCheckButton(group, "Default Value", ICustomAppearence.DISP_DFLT_VALUE);
+ displDfltValue = createCheckButton(group, "Default Value", ICustomAppearence.DISP_DEFAULT_VALUE);
data = new FormData();
data.left = new FormAttachment(displVisibility, 85);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
displDfltValue.setLayoutData(data);
- displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MOFIFIERS);
+ displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MODIFIERS);
data = new FormData();
data.left = new FormAttachment(displDerive, 85);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
@@ -218,8 +218,8 @@ public class PropertyPreferencePage extends AbstractPapyrusElementPreferencePage
displName.setSelection((propertyValue & ICustomAppearence.DISP_NAME) == ICustomAppearence.DISP_NAME);
displType.setSelection((propertyValue & ICustomAppearence.DISP_TYPE) == ICustomAppearence.DISP_TYPE);
displMutliplicity.setSelection((propertyValue & ICustomAppearence.DISP_MULTIPLICITY) == ICustomAppearence.DISP_MULTIPLICITY);
- displDfltValue.setSelection((propertyValue & ICustomAppearence.DISP_DFLT_VALUE) == ICustomAppearence.DISP_DFLT_VALUE);
- displModifiers.setSelection((propertyValue & ICustomAppearence.DISP_MOFIFIERS) == ICustomAppearence.DISP_MOFIFIERS);
+ displDfltValue.setSelection((propertyValue & ICustomAppearence.DISP_DEFAULT_VALUE) == ICustomAppearence.DISP_DEFAULT_VALUE);
+ displModifiers.setSelection((propertyValue & ICustomAppearence.DISP_MODIFIERS) == ICustomAppearence.DISP_MODIFIERS);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index 9491a8311d5..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/AssociationLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.diagram.clazz.custom.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationEndSourceLabelHelper;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.AssociationEndTargetLabelHelper;
-import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart;
-import org.eclipse.uml2.uml.Association;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * Property
- *
- * @author Camille Letavernier
- *
- */
-public class AssociationLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- @Override
- public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class && adaptableObject instanceof View) {
- View view = (View)adaptableObject;
- if(view.getDiagram() == null || !ModelEditPart.MODEL_ID.equals(view.getDiagram().getType())) {
- return null;
- }
-
- if(view.getElement() instanceof Association) {
- String type = view.getType();
-
- if("6003".equals(type)) {
- return AssociationEndSourceLabelHelper.getInstance();
- }
-
- if("6005".equals(type)) {
- return AssociationEndTargetLabelHelper.getInstance();
- }
-
- if("6033".equals(type)) {
- return AssociationEndSourceLabelHelper.getInstance();
- }
-
- if("6034".equals(type)) {
- return AssociationEndTargetLabelHelper.getInstance();
- }
-
- if("6024".equals(type)) {
- return AssociationEndTargetLabelHelper.getInstance();
- }
-
- if("6035".equals(type)) {
- return AssociationEndTargetLabelHelper.getInstance();
- }
-
- }
- }
- return null;
- }
-
- @Override
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/InstanceSpecificationLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/InstanceSpecificationLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index 44a5971572e..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/InstanceSpecificationLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,43 +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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz.custom.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.clazz.custom.helper.InstanceSpecificationLabelHelper;
-import org.eclipse.uml2.uml.InstanceSpecification;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * InstanceSpecification
- *
- * @author Camille Letavernier
- *
- */
-public class InstanceSpecificationLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- @Override
- public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class) {
- if(adaptableObject instanceof InstanceSpecification) {
- return InstanceSpecificationLabelHelper.getInstance();
- }
- }
- return null;
- }
-
- @Override
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
index bf4a6db9147..ada1123b5b3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml
@@ -608,21 +608,4 @@
</Priority>
</editpolicyProvider>
</extension>
-<extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.uml2.uml.Property"
- class="org.eclipse.papyrus.uml.diagram.common.providers.PropertyLabelMaskProviderAdapterFactory">
- <adapter
- type="org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider">
- </adapter>
- </factory>
- <factory
- adaptableType="org.eclipse.uml2.uml.Operation"
- class="org.eclipse.papyrus.uml.diagram.common.providers.OperationLabelMaskProviderAdapterFactory">
- <adapter
- type="org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider">
- </adapter>
- </factory>
-+</extension>
</plugin>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractMaskManagedEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractMaskManagedEditPolicy.java
index c89dff6d420..69e27d08ed2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractMaskManagedEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/AbstractMaskManagedEditPolicy.java
@@ -12,6 +12,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.editpolicies;
+import java.util.Collection;
+
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EModelElement;
@@ -22,11 +24,9 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
-import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.uml2.uml.Element;
@@ -45,7 +45,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
protected Element hostSemanticElement;
/**
- *
+ *
* {@inheritDoc}
*/
@Override
@@ -73,7 +73,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Sets the semantic element which is linked to the edit policy
- *
+ *
* @return the element linked to the edit policy
*/
protected Element initSemanticElement() {
@@ -97,7 +97,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
}
/**
- *
+ *
* {@inheritDoc}
*/
@Override
@@ -129,7 +129,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Gets the diagram event broker from the editing domain.
- *
+ *
* @return the diagram event broker
*/
protected DiagramEventBroker getDiagramEventBroker() {
@@ -142,7 +142,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Returns the {@link Element} managed by this edit part.
- *
+ *
* @return the {@link Element} managed by this edit part.
*/
public Element getUMLElement() {
@@ -151,7 +151,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Returns the view controlled by the host edit part
- *
+ *
* @return the view controlled by the host edit part
*/
protected View getView() {
@@ -161,7 +161,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Returns <code>true</code> if the specified object is the annotation in
* charge of the mask managed label.
- *
+ *
* @param object
* the object to be checked
* @return <code>true</code> if the object is an {@link EAnnotation} and its
@@ -184,7 +184,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* Returns <code>true</code> if the the annotation in charge of the mask
* managed label is removed from the given object which should be a View.
- *
+ *
* @param object
* the object to be checked
* @param notification
@@ -217,7 +217,7 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
/**
* @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
+ *
* @param notification
* the notification object
*/
@@ -232,33 +232,28 @@ public abstract class AbstractMaskManagedEditPolicy extends GraphicalEditPolicyE
* {@inheritDoc}
*/
public void setDefaultDisplayValue() {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new RemoveEAnnotationCommand(editingDomain, (EModelElement)getHost().getModel(), VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION));
- }
-
+ MaskLabelHelper.unsetMaskValues((View)getHost().getModel());
}
/**
* {@inheritDoc}
*/
- public void updateDisplayValue(int newValue) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart)getHost()).getEditingDomain();
- if(editingDomain != null) {
- editingDomain.getCommandStack().execute(new AddMaskManagedLabelDisplayCommand(editingDomain, (EModelElement)getHost().getModel(), newValue));
- }
+ public void updateDisplayValue(Collection<String> newValue) {
+ MaskLabelHelper.setMaskValues((View)getHost().getModel(), newValue);
}
/**
* {@inheritDoc}
*/
- public int getCurrentDisplayValue() {
- if(getHost().getModel() instanceof View) {
- View view = (View)getHost().getModel();
- //Delegate to AppearanceHelper (May delegate to either e.g. Notation EAnnotations or CSS)
- return AppearanceHelper.getLabelDisplay(view);
+ public Collection<String> getCurrentDisplayValue() {
+ Collection<String> maskValues = MaskLabelHelper.getMaskValues((View)getHost().getModel());
+ if(maskValues == null) {
+ return getDefaultDisplayValue();
}
- return getDefaultDisplayValue();
+
+ return maskValues;
}
+ protected abstract Collection<String> getDefaultDisplayValue();
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java
index 4c8703975c4..4e145937f41 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/OperationLabelHelper.java
@@ -16,21 +16,18 @@ package org.eclipse.papyrus.uml.diagram.common.helper;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
import org.eclipse.papyrus.uml.tools.utils.OperationUtil;
import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Property;
/**
- * Helper for labels displaying {@link Property}
+ * Helper for labels displaying {@link Operation}
*/
-public class OperationLabelHelper extends StereotypedElementLabelHelper implements ILabelMaskProvider {
+public class OperationLabelHelper extends StereotypedElementLabelHelper {
/**
* singelton instance
@@ -50,7 +47,7 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper implemen
}
/** Map for masks */
- protected final Map<Integer, String> masks = new HashMap<Integer, String>(7);
+ protected final Map<String, String> masks = new HashMap<String, String>();
/**
* Creates a new Operation label helper.
@@ -66,7 +63,7 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper implemen
masks.put(ICustomAppearence.DISP_PARAMETER_MULTIPLICITY, "Parameters Multiplicity");
masks.put(ICustomAppearence.DISP_PARAMETER_DEFAULT, "Parameters Default Value");
masks.put(ICustomAppearence.DISP_PARAMETER_MODIFIERS, "Parameters Modifiers");
- masks.put(ICustomAppearence.DISP_MOFIFIERS, "Modifiers");
+ masks.put(ICustomAppearence.DISP_MODIFIERS, "Modifiers");
}
@@ -75,7 +72,7 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper implemen
* edit part.
*
* @param editPart
- * the edit part that controls the {@link Property} to be
+ * the edit part that controls the {@link Operation} to be
* displayed
* @return the label corresponding to the specific display of the property
* ("default" display given by preferences or specific display given
@@ -83,63 +80,25 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper implemen
*/
@Override
protected String elementLabel(GraphicalEditPart editPart) {
- // int displayValue = ICustomAppearence.DEFAULT_UML_OPERATION;
- //
- // IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- // if(policy != null) {
- // displayValue = policy.getCurrentDisplayValue();
- // }
- // return OperationUtil.getCustomLabel(getUMLElement(editPart), displayValue);
+ Collection<String> displayValue = ICustomAppearence.DEFAULT_UML_OPERATION;
- Object model = editPart.getModel();
- if(model instanceof View) {
- Operation element = getUMLElement(editPart);
- if(element != null) {
- int displayValue = AppearanceHelper.getLabelDisplay((View)model);
- return OperationUtil.getCustomLabel(element, displayValue);
- }
+ IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if(policy != null) {
+ displayValue = policy.getCurrentDisplayValue();
}
-
- return "";
- }
-
- /**
- * Returns the mask name given the value of the mask
- *
- * @return the mask name or <code>null</code> if no masks has been found
- */
- public String getMaskLabel(int value) {
- return masks.get(value);
- }
-
- /**
- * Returns the collection of mask names
- *
- * @return the collection of mask names
- */
- public Collection<String> getMaskLabels() {
- return masks.values();
+ return OperationUtil.getCustomLabel(getUMLElement(editPart), displayValue);
}
/**
- * Returns the map of masks used to display a {@link Property}
+ * Returns the map of masks used to display an {@link Operation}
*
- * @return the {@link Map} of masks used to display a {@link Property}
+ * @return the {@link Map} of masks used to display a {@link Operation}
*/
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return masks;
}
/**
- * Returns the collection of mask values
- *
- * @return the collection of mask values
- */
- public Set<Integer> getMaskValues() {
- return masks.keySet();
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -147,8 +106,4 @@ public class OperationLabelHelper extends StereotypedElementLabelHelper implemen
return (Operation)((View)editPart.getModel()).getElement();
}
- public int getDefaultValue() {
- return ICustomAppearence.DEFAULT_UML_OPERATION;
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PortLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PortLabelHelper.java
index 08fe8aac88d..6a00481b928 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PortLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PortLabelHelper.java
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.helper;
+import java.util.Collection;
+
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
@@ -38,11 +40,11 @@ public class PortLabelHelper extends PropertyLabelHelper {
}
@Override
- protected String parseString(GraphicalEditPart editPart, int displayValue) {
+ protected String parseString(GraphicalEditPart editPart, Collection<String> maskValues) {
Port port = getUMLElement(editPart);
if(port != null) {
- return PortUtil.getCustomLabel(port, displayValue);
+ return PortUtil.getCustomLabel(port, maskValues);
}
return "";
@@ -62,8 +64,4 @@ public class PortLabelHelper extends PropertyLabelHelper {
return null;
}
- @Override
- public int getDefaultValue() {
- return super.getDefaultValue() | ICustomAppearence.DISP_CONJUGATED;
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PropertyLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PropertyLabelHelper.java
index a2a124d72f7..3122707b69e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PropertyLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/PropertyLabelHelper.java
@@ -14,14 +14,12 @@
package org.eclipse.papyrus.uml.diagram.common.helper;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
import org.eclipse.papyrus.uml.tools.utils.PropertyUtil;
@@ -30,7 +28,7 @@ import org.eclipse.uml2.uml.Property;
/**
* Helper for labels displaying {@link Property}
*/
-public class PropertyLabelHelper extends StereotypedElementLabelHelper implements ILabelMaskProvider {
+public class PropertyLabelHelper extends StereotypedElementLabelHelper {
// Einstance
private static PropertyLabelHelper labelHelper;
@@ -43,7 +41,7 @@ public class PropertyLabelHelper extends StereotypedElementLabelHelper implement
}
/** Map for masks */
- protected final Map<Integer, String> masks = new HashMap<Integer, String>();
+ protected final Map<String, String> masks = new HashMap<String, String>();
protected PropertyLabelHelper() {
// initialize the map
@@ -52,14 +50,14 @@ public class PropertyLabelHelper extends StereotypedElementLabelHelper implement
masks.put(ICustomAppearence.DISP_NAME, "Name");
masks.put(ICustomAppearence.DISP_TYPE, "Type");
masks.put(ICustomAppearence.DISP_MULTIPLICITY, "Multiplicity");
- masks.put(ICustomAppearence.DISP_DFLT_VALUE, "Default Value");
- masks.put(ICustomAppearence.DISP_MOFIFIERS, "Modifiers");
+ masks.put(ICustomAppearence.DISP_DEFAULT_VALUE, "Default Value");
+ masks.put(ICustomAppearence.DISP_MODIFIERS, "Modifiers");
}
/**
* Computes the label that should be displayed by the figure managed by this
* edit part.
- *
+ *
* @param editPart
* the edit part that controls the {@link Property} to be
* displayed
@@ -69,20 +67,18 @@ public class PropertyLabelHelper extends StereotypedElementLabelHelper implement
*/
@Override
protected String elementLabel(GraphicalEditPart editPart) {
- int displayValue = getDefaultValue();
-
IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ Collection<String> displayValue = Collections.emptySet();
+
if(policy != null) {
displayValue = policy.getCurrentDisplayValue();
- } else if(editPart.getModel() instanceof View) {
- displayValue = AppearanceHelper.getLabelDisplay((View)editPart.getModel());
}
return parseString(editPart, displayValue);
}
- protected String parseString(GraphicalEditPart editPart, int displayValue) {
+ protected String parseString(GraphicalEditPart editPart, Collection<String> displayValue) {
Property property = getUMLElement(editPart);
if(property != null) {
@@ -92,43 +88,17 @@ public class PropertyLabelHelper extends StereotypedElementLabelHelper implement
return "";
}
- /**
- * Returns the mask name given the value of the mask
- *
- * @return the mask name or <code>null</code> if no masks has been found
- */
- public String getMaskLabel(int value) {
- return masks.get(value);
- }
-
- /**
- * Returns the collection of mask names
- *
- * @return the collection of mask names
- */
- public Collection<String> getMaskLabels() {
- return masks.values();
- }
/**
* Returns the map of masks used to display a {@link Property}
- *
+ *
* @return the {@link Map} of masks used to display a {@link Property}
*/
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return masks;
}
/**
- * Returns the collection of mask values
- *
- * @return the collection of mask values
- */
- public Set<Integer> getMaskValues() {
- return masks.keySet();
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -142,8 +112,4 @@ public class PropertyLabelHelper extends StereotypedElementLabelHelper implement
return null;
}
- public int getDefaultValue() {
- return ICustomAppearence.DEFAULT_UML_PROPERTY;
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
index 9875201cb23..5d13b4de7ff 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/StereotypedElementLabelHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -31,7 +31,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
+import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.diagram.common.Activator;
@@ -60,7 +60,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Parses the string containing the complete definition of properties to be
* displayed, and generates a map.
- *
+ *
* @param editPart
* the edit part for which the label is edited
* @param stereotypesToDisplay
@@ -89,7 +89,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Returns the image to be displayed for the applied stereotypes.
- *
+ *
* @return the image that represents the first applied stereotype or <code>null</code> if no image has to be displayed
*/
public Collection<Image> stereotypeIconsToDisplay(GraphicalEditPart editPart) {
@@ -114,7 +114,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Returns a String that displays stereotypes (using their simple name or
* their qualified name) and their properties
- *
+ *
* @param editPart
* the edit part for which the label is edited
* @param separator
@@ -201,7 +201,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* get the list of stereotype to display from the eannotation
- *
+ *
* @return the list of stereotypes to display
*/
public String stereotypesToDisplay(GraphicalEditPart editPart) {
@@ -245,7 +245,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Computes the string that displays the stereotypes for the current element
- *
+ *
* @param separator
* the separator used to split the string representing the
* stereotypes.
@@ -320,7 +320,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Refreshes the label of the figure associated to the specified edit part
- *
+ *
* @param editPart
* the edit part managing the refreshed figure
*/
@@ -329,7 +329,7 @@ public abstract class StereotypedElementLabelHelper {
// computes the icon to be displayed
final Collection<Image> imageToDisplay = stereotypeIconsToDisplay(editPart);
// should check if edit part has to display the element icon or not
- if(NameLabelIconHelper.showLabelIcon((View)editPart.getModel())) {
+ if(AppearanceHelper.showElementIcon((View)editPart.getModel())) {
imageToDisplay.add(getImage(editPart));
}
// for each element in the list of stereotype icon, adds it to the icons
@@ -371,7 +371,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Computes the label corresponding to the semantic element
- *
+ *
* @param editPart
* the graphical part managing the semantic element
* @return the string corresponding to the display of the semantic element
@@ -380,7 +380,7 @@ public abstract class StereotypedElementLabelHelper {
/**
* Returns the image for the element
- *
+ *
* @param editPart
* the edit part that displays the element
* @return the image
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/OperationLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/OperationLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index a74aa85129f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/OperationLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.diagram.common.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.common.helper.OperationLabelHelper;
-import org.eclipse.uml2.uml.Operation;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * Operation
- *
- * @author Camille Letavernier
- *
- */
-public class OperationLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class) {
- if(adaptableObject instanceof Operation) {
- return OperationLabelHelper.getInstance();
- }
- }
- return null;
- }
-
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index b4e06bbf45f..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PropertyLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.diagram.common.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.common.helper.PortLabelHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.PropertyLabelHelper;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.Property;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * Property
- *
- * @author Camille Letavernier
- *
- */
-public class PropertyLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class) {
- if(adaptableObject instanceof Port) {
- return PortLabelHelper.getInstance();
- } else if(adaptableObject instanceof Property) {
- Property property = (Property)adaptableObject;
- if(property.getAssociation() != null) {
- // Association association = property.getAssociation();
- // int index = association.getMemberEnds().indexOf(property);
- // if (index == 0){
- // return AssociationEndSourceLabelHelper.getInstance();
- // } else {
- // return AssociationEndTargetLabelHelper.getInstance();
- // }
- }
-
- return PropertyLabelHelper.getInstance();
- }
- }
- return null;
- }
-
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationUseLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationUseLabelEditPolicy.java
index 5284c4374c0..90ba5ce64b7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationUseLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/CollaborationUseLabelEditPolicy.java
@@ -62,7 +62,8 @@ public class CollaborationUseLabelEditPolicy extends AbstractMaskManagedEditPoli
/**
* {@inheritDoc}
*/
- public int getDefaultDisplayValue() {
+ @Override
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_PROPERTY;
}
@@ -83,17 +84,12 @@ public class CollaborationUseLabelEditPolicy extends AbstractMaskManagedEditPoli
/**
* {@inheritDoc}
*/
- public Map<Integer, String> getMasks() {
+ @Override
+ public Map<String, String> getMasks() {
return CollaborationUseLabelHelper.getInstance().getMasks();
}
- /**
- * {@inheritDoc}
- */
- public Collection<Integer> getMaskValues() {
- return CollaborationUseLabelHelper.getInstance().getMaskValues();
- }
-
+ @Override
public String getPreferencePageID() {
return CollaborationUsePreferencePage.ID;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java
index bb7f9213a58..75fc420ff10 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ParameterLabelEditPolicy.java
@@ -54,38 +54,20 @@ public class ParameterLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* {@inheritDoc}
*/
- public int getDefaultDisplayValue() {
+ @Override
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_PARAMETER;
}
/**
* {@inheritDoc}
*/
- public String getMaskLabel(int value) {
- return ParameterLabelHelper.getInstance().getMaskLabel(value);
- }
-
- /**
- * {@inheritDoc}
- */
- public Collection<String> getMaskLabels() {
- return ParameterLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<Integer, String> getMasks() {
+ @Override
+ public Map<String, String> getMasks() {
return ParameterLabelHelper.getInstance().getMasks();
}
- /**
- * {@inheritDoc}
- */
- public Collection<Integer> getMaskValues() {
- return ParameterLabelHelper.getInstance().getMaskValues();
- }
-
+ @Override
public String getPreferencePageID() {
return ParameterPreferencePage.ID;
}
@@ -134,7 +116,7 @@ public class ParameterLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the the parameter has changed.
- *
+ *
* @param parameter
* the parameter that has changed
* @param notification
@@ -217,7 +199,7 @@ public class ParameterLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the type of the parameter has changed.
- *
+ *
* @param type
* the type of the parameter that has changed
* @param notification
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLabelEditPolicy.java
index 54e522929c9..34a5b93a5d3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PortLabelEditPolicy.java
@@ -8,7 +8,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.papyrus.uml.diagram.common.helper.PortLabelHelper;
-import org.eclipse.papyrus.uml.diagram.common.helper.PropertyLabelHelper;
import org.eclipse.papyrus.uml.diagram.composite.custom.preferences.PropertyPreferencePage;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
import org.eclipse.uml2.uml.Property;
@@ -16,44 +15,28 @@ import org.eclipse.uml2.uml.UMLPackage;
public class PortLabelEditPolicy extends PropertyLabelEditPolicy {
+
/**
* {@inheritDoc}
*/
- public int getDefaultDisplayValue() {
+ @Override
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_PORT;
}
- /**
- * {@inheritDoc}
- */
- public String getMaskLabel(int value) {
- return PortLabelHelper.getInstance().getMaskLabel(value);
- }
/**
* {@inheritDoc}
*/
- public Collection<String> getMaskLabels() {
- return PortLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<Integer, String> getMasks() {
+ @Override
+ public Map<String, String> getMasks() {
return PortLabelHelper.getInstance().getMasks();
}
- /**
- * {@inheritDoc}
- */
- public Collection<Integer> getMaskValues() {
- return PortLabelHelper.getInstance().getMaskValues();
- }
-
+ @Override
public String getPreferencePageID() {
return PropertyPreferencePage.ID;
}
-
+
/**
* notifies that the the property has changed.
*
@@ -62,6 +45,7 @@ public class PortLabelEditPolicy extends PropertyLabelEditPolicy {
* @param notification
* the notification send when the element has been changed
*/
+ @Override
protected void notifyPropertyChanged(Property property, Notification notification) {
switch(notification.getFeatureID(Property.class)) {
case UMLPackage.PROPERTY__NAME:
@@ -137,6 +121,7 @@ public class PortLabelEditPolicy extends PropertyLabelEditPolicy {
break;
}
}
+
/**
* Refreshes the display of the edit part
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyLabelEditPolicy.java
index 87be980a41a..b1692293d58 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyLabelEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/PropertyLabelEditPolicy.java
@@ -57,38 +57,20 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* {@inheritDoc}
*/
- public int getDefaultDisplayValue() {
+ @Override
+ public Collection<String> getDefaultDisplayValue() {
return ICustomAppearence.DEFAULT_UML_PROPERTY;
}
/**
* {@inheritDoc}
*/
- public String getMaskLabel(int value) {
- return PropertyLabelHelper.getInstance().getMaskLabel(value);
- }
-
- /**
- * {@inheritDoc}
- */
- public Collection<String> getMaskLabels() {
- return PropertyLabelHelper.getInstance().getMaskLabels();
- }
-
- /**
- * {@inheritDoc}
- */
- public Map<Integer, String> getMasks() {
+ @Override
+ public Map<String, String> getMasks() {
return PropertyLabelHelper.getInstance().getMasks();
}
- /**
- * {@inheritDoc}
- */
- public Collection<Integer> getMaskValues() {
- return PropertyLabelHelper.getInstance().getMaskValues();
- }
-
+ @Override
public String getPreferencePageID() {
return PropertyPreferencePage.ID;
}
@@ -143,7 +125,7 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the the property has changed.
- *
+ *
* @param property
* the property that has changed
* @param notification
@@ -226,7 +208,7 @@ public class PropertyLabelEditPolicy extends AbstractMaskManagedEditPolicy {
/**
* notifies that the type of the property has changed.
- *
+ *
* @param type
* the type of the property that has changed
* @param notification
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CollaborationUseLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CollaborationUseLabelHelper.java
index 805f4549152..92568d2c71b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CollaborationUseLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/CollaborationUseLabelHelper.java
@@ -16,11 +16,9 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.helper;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
import org.eclipse.papyrus.uml.tools.utils.CollaborationUseUtil;
@@ -30,7 +28,7 @@ import org.eclipse.uml2.uml.CollaborationUse;
/**
* Helper for labels displaying {@link CollaborationUse} in Composite Diagram
*/
-public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper implements ILabelMaskProvider {
+public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper {
/** Single instance */
private static CollaborationUseLabelHelper labelHelper;
@@ -44,11 +42,11 @@ public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper i
}
/** Map for masks */
- protected final Map<Integer, String> masks = new HashMap<Integer, String>(7);
+ protected final Map<String, String> masks = new HashMap<String, String>();
/**
* Returns the mask name given the value of the mask
- *
+ *
* @return the mask name or <code>null</code> if no masks has been found
*/
public String getMaskLabel(int value) {
@@ -57,7 +55,7 @@ public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper i
/**
* Returns the collection of mask names
- *
+ *
* @return the collection of mask names
*/
public Collection<String> getMaskLabels() {
@@ -66,23 +64,13 @@ public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper i
/**
* Returns the map of masks used to display a {@link Property}
- *
+ *
* @return the {@link Map} of masks used to display a {@link Property}
*/
- @Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return masks;
}
- /**
- * Returns the collection of mask values
- *
- * @return the collection of mask values
- */
- public Set<Integer> getMaskValues() {
- return masks.keySet();
- }
-
/** Disable constructor (private) */
protected CollaborationUseLabelHelper() {
super();
@@ -98,7 +86,7 @@ public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper i
*/
@Override
protected String elementLabel(GraphicalEditPart editPart) {
- int displayValue = ICustomAppearence.DEFAULT_UML_PROPERTY;
+ Collection<String> displayValue = ICustomAppearence.DEFAULT_UML_PROPERTY;
IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if(policy != null) {
@@ -123,9 +111,4 @@ public class CollaborationUseLabelHelper extends StereotypedElementLabelHelper i
return null;
}
- @Override
- public int getDefaultValue() {
- return ICustomAppearence.DEFAULT_UML_PROPERTY;
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java
index a35275e9ff9..44912dbb8d7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/helper/ParameterLabelHelper.java
@@ -16,11 +16,9 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.helper;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.helper.StereotypedElementLabelHelper;
import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
@@ -30,7 +28,7 @@ import org.eclipse.uml2.uml.Parameter;
/**
* Helper for labels displaying {@link Parameter} in Composite Diagram
*/
-public class ParameterLabelHelper extends StereotypedElementLabelHelper implements ILabelMaskProvider {
+public class ParameterLabelHelper extends StereotypedElementLabelHelper {
/** Single instance */
private static ParameterLabelHelper labelHelper;
@@ -44,20 +42,11 @@ public class ParameterLabelHelper extends StereotypedElementLabelHelper implemen
}
/** Map for masks */
- protected final Map<Integer, String> masks = new HashMap<Integer, String>(7);
-
- /**
- * Returns the mask name given the value of the mask
- *
- * @return the mask name or <code>null</code> if no masks has been found
- */
- public String getMaskLabel(int value) {
- return masks.get(value);
- }
+ protected final Map<String, String> masks = new HashMap<String, String>();
/**
* Returns the collection of mask names
- *
+ *
* @return the collection of mask names
*/
public Collection<String> getMaskLabels() {
@@ -66,31 +55,21 @@ public class ParameterLabelHelper extends StereotypedElementLabelHelper implemen
/**
* Returns the map of masks used to display a {@link Parameter}
- *
+ *
* @return the {@link Map} of masks used to display a {@link Parameter}
*/
- @Override
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return masks;
}
- /**
- * Returns the collection of mask values
- *
- * @return the collection of mask values
- */
- public Set<Integer> getMaskValues() {
- return masks.keySet();
- }
-
/** Disable constructor (private) */
protected ParameterLabelHelper() {
super();
// initialize the map
masks.clear();
- masks.put(ICustomAppearence.DISP_PARAMETER_DIRECTION, "Direction");
- masks.put(ICustomAppearence.DISP_PARAMETER_NAME, "Name");
- masks.put(ICustomAppearence.DISP_PARAMETER_TYPE, "Type");
+ masks.put(ICustomAppearence.DISP_DIRECTION, "Direction");
+ masks.put(ICustomAppearence.DISP_NAME, "Name");
+ masks.put(ICustomAppearence.DISP_TYPE, "Type");
}
/**
@@ -98,7 +77,7 @@ public class ParameterLabelHelper extends StereotypedElementLabelHelper implemen
*/
@Override
protected String elementLabel(GraphicalEditPart editPart) {
- int displayValue = ICustomAppearence.DEFAULT_UML_PARAMETER;
+ Collection<String> displayValue = ICustomAppearence.DEFAULT_UML_PARAMETER;
IMaskManagedLabelEditPolicy policy = (IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if(policy != null) {
@@ -119,9 +98,4 @@ public class ParameterLabelHelper extends StereotypedElementLabelHelper implemen
return (Parameter)((View)editPart.getModel()).getElement();
}
- @Override
- public int getDefaultValue() {
- return ICustomAppearence.DEFAULT_UML_PARAMETER;
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/PropertyPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/PropertyPreferencePage.java
index 2c0ee4a256c..3be4cf27ae3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/PropertyPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/preferences/PropertyPreferencePage.java
@@ -162,13 +162,13 @@ public class PropertyPreferencePage extends AbstractPapyrusElementPreferencePage
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
displMutliplicity.setLayoutData(data);
- displDfltValue = createCheckButton(group, "Default Value", ICustomAppearence.DISP_DFLT_VALUE);
+ displDfltValue = createCheckButton(group, "Default Value", ICustomAppearence.DISP_DEFAULT_VALUE);
data = new FormData();
data.left = new FormAttachment(displVisibility, 85);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
displDfltValue.setLayoutData(data);
- displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MOFIFIERS);
+ displModifiers = createCheckButton(group, "Modifiers", ICustomAppearence.DISP_MODIFIERS);
data = new FormData();
data.left = new FormAttachment(displDerive, 85);
data.top = new FormAttachment(displVisibility, ITabbedPropertyConstants.HSPACE);
@@ -232,8 +232,8 @@ public class PropertyPreferencePage extends AbstractPapyrusElementPreferencePage
displName.setSelection((propertyValue & ICustomAppearence.DISP_NAME) == ICustomAppearence.DISP_NAME);
displType.setSelection((propertyValue & ICustomAppearence.DISP_TYPE) == ICustomAppearence.DISP_TYPE);
displMutliplicity.setSelection((propertyValue & ICustomAppearence.DISP_MULTIPLICITY) == ICustomAppearence.DISP_MULTIPLICITY);
- displDfltValue.setSelection((propertyValue & ICustomAppearence.DISP_DFLT_VALUE) == ICustomAppearence.DISP_DFLT_VALUE);
- displModifiers.setSelection((propertyValue & ICustomAppearence.DISP_MOFIFIERS) == ICustomAppearence.DISP_MOFIFIERS);
+ displDfltValue.setSelection((propertyValue & ICustomAppearence.DISP_DEFAULT_VALUE) == ICustomAppearence.DISP_DEFAULT_VALUE);
+ displModifiers.setSelection((propertyValue & ICustomAppearence.DISP_MODIFIERS) == ICustomAppearence.DISP_MODIFIERS);
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CollaborationUseLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CollaborationUseLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index fa91d7f9a53..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CollaborationUseLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,43 +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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.composite.custom.helper.CollaborationUseLabelHelper;
-import org.eclipse.uml2.uml.CollaborationUse;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * CollaborationUse
- *
- * @author Camille Letavernier
- *
- */
-public class CollaborationUseLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- @Override
- public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class) {
- if(adaptableObject instanceof CollaborationUse) {
- return CollaborationUseLabelHelper.getInstance();
- }
- }
- return null;
- }
-
- @Override
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ParameterLabelMaskProviderAdapterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ParameterLabelMaskProviderAdapterFactory.java
deleted file mode 100644
index 27d4492a237..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/ParameterLabelMaskProviderAdapterFactory.java
+++ /dev/null
@@ -1,43 +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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.papyrus.infra.emf.appearance.style.ILabelMaskProvider;
-import org.eclipse.papyrus.uml.diagram.composite.custom.helper.ParameterLabelHelper;
-import org.eclipse.uml2.uml.Parameter;
-
-/**
- * An IAdapterFactory for retrieving the {@link ILabelMaskProvider} from a UML
- * Parameter
- *
- * @author Camille Letavernier
- *
- */
-public class ParameterLabelMaskProviderAdapterFactory implements IAdapterFactory {
-
- @Override
- public ILabelMaskProvider getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == ILabelMaskProvider.class) {
- if(adaptableObject instanceof Parameter) {
- return ParameterLabelHelper.getInstance();
- }
- }
- return null;
- }
-
- @Override
- public Class<?>[] getAdapterList() {
- return new Class[]{ ILabelMaskProvider.class };
- }
-
-}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UMLNotation/ui/Label.xwt b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UMLNotation/ui/Label.xwt
index bb2a35b213d..20313858768 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UMLNotation/ui/Label.xwt
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UMLNotation/ui/Label.xwt
@@ -5,11 +5,11 @@
<Composite.layout>
<ppel:PropertiesLayout></ppel:PropertiesLayout>
</Composite.layout>
- <ppe:IntegerMask input="{Binding}"
+ <ppe:StringMask input="{Binding}"
property="UMLNotation:Property:labelCustomization">
- <ppe:IntegerMask.maskProvider>
+ <ppe:StringMask.maskProvider>
<uml:LabelCustomizationMaskProvider
input="{Binding}" property="UMLNotation:Property:labelCustomization"></uml:LabelCustomizationMaskProvider>
- </ppe:IntegerMask.maskProvider>
- </ppe:IntegerMask>
+ </ppe:StringMask.maskProvider>
+ </ppe:StringMask>
</Composite> \ No newline at end of file
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
index 3526631230b..363e20170f5 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/ElementCustomizationObservableValue.java
@@ -16,24 +16,20 @@ import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.appearance.commands.AddMaskManagedLabelDisplayCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetNameLabelIconCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetQualifiedNameDepthCommand;
import org.eclipse.papyrus.infra.emf.appearance.commands.SetShadowFigureCommand;
import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
import org.eclipse.papyrus.infra.tools.databinding.AggregatedObservable;
import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.papyrus.uml.tools.databinding.AbstractUMLAggregatedObservableValue;
import org.eclipse.papyrus.uml.tools.databinding.CommandBasedObservableValue;
-import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
-import org.eclipse.uml2.uml.Element;
/**
* An IObservableValue for custom Papyrus properties.
* This enables to edit a few preferences-based values.
- *
+ *
* @author Camille Letavernier
*/
public class ElementCustomizationObservableValue extends AbstractUMLAggregatedObservableValue implements CommandBasedObservableValue, AggregatedObservable {
@@ -46,12 +42,10 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
private View notationElement;
- private Element semanticElement;
-
/**
- *
+ *
* Constructor.
- *
+ *
* @param sourceElement
* The selected EditPart
* @param property
@@ -61,7 +55,6 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
super(EMFHelper.resolveEditingDomain(sourceElement));
this.sourceElement = sourceElement;
this.property = property;
- semanticElement = UMLUtil.resolveUMLElement(sourceElement);
notationElement = (View)sourceElement.getModel();
if(domain instanceof TransactionalEditingDomain) {
transactionalDomain = (TransactionalEditingDomain)domain;
@@ -72,7 +65,6 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
//Some listeners need to be added
public Object getValueType() {
switch(property) {
- case LABEL_CUSTOMIZATION:
case QUALIFIED_NAME:
return Integer.class;
case ELEMENT_ICON:
@@ -89,8 +81,6 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
@Override
protected Object doGetValue() {
switch(property) {
- case LABEL_CUSTOMIZATION:
- return getEditPolicy().getCurrentDisplayValue();
case ELEMENT_ICON:
return AppearanceHelper.showElementIcon(notationElement);
case SHADOW:
@@ -103,14 +93,6 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
}
/**
- *
- * @return the {@link IMaskManagedLabelEditPolicy#MASK_MANAGED_LABEL_EDIT_POLICY} edit policy
- */
- protected IMaskManagedLabelEditPolicy getEditPolicy() {
- return (IMaskManagedLabelEditPolicy)sourceElement.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -145,13 +127,6 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
Activator.log.warn(value + " is not a valid value for QualifiedNameDepth ; need an Integer"); //$NON-NLS-1$
}
break;
- case LABEL_CUSTOMIZATION:
- if(value instanceof Integer) {
- return new AddMaskManagedLabelDisplayCommand(transactionalDomain, notationElement, (Integer)value);
- } else {
- Activator.log.warn(value + " is not a valid value for LabelCustomization ; need an Integer"); //$NON-NLS-1$
- }
- break;
}
return UnexecutableCommand.INSTANCE;
@@ -159,15 +134,11 @@ public class ElementCustomizationObservableValue extends AbstractUMLAggregatedOb
/**
* The list of valid properties for {@link ElementCustomizationObservableValue}
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public enum Property {
- /**
- * A UML Property or Operation label customization
- */
- LABEL_CUSTOMIZATION,
/**
* Whether and how the element icon should be displayed
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/MaskValueObservableList.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/MaskValueObservableList.java
new file mode 100644
index 00000000000..4619177a6b0
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/databinding/MaskValueObservableList.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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.databinding;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
+import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStringStyleObservableList;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+
+
+/**
+ * An IObservableList for the StringListValueStyle named "maskLabel" (See {@link VisualInformationPapyrusConstants#CUSTOM_MASK_LABEL}
+ *
+ * It is used for configuring an {@link IMaskManagedLabelEditPolicy}
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class MaskValueObservableList extends CustomStringStyleObservableList {
+
+ private EditPart editPart;
+
+ private EditingDomain domain;
+
+ public MaskValueObservableList(EditPart editPart, EditingDomain domain) {
+ super(getView(editPart), domain, VisualInformationPapyrusConstants.CUSTOM_MASK_LABEL);
+ this.editPart = editPart;
+ this.domain = domain;
+
+ updateWrappedList(getDefaultValues());
+ }
+
+ private static View getView(EditPart editPart) {
+ return (View)editPart.getModel();
+ }
+
+ @Override
+ protected IObservableList getConcreteList() {
+ if(!isStyleCreated()) {
+ return new WritableList(getDefaultValues(), String.class);
+ }
+ return super.getConcreteList();
+ }
+
+ protected List<String> getDefaultValues() {
+ return new LinkedList<String>(((IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY)).getCurrentDisplayValue());
+ }
+
+ @Override
+ protected void refreshCacheList() {
+ super.refreshCacheList();
+ ((IMaskManagedLabelEditPolicy)editPart.getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY)).refreshDisplay();
+ }
+
+
+ //When the style is not yet created (Style#values = []), we need to transform the commands. In this case, the "current value" equals "defaut value", which is not always empty.
+ //The superclass expects an empty default state, and will return Unexecutable commands if we try to e.g. remove elements
+ //For example, if our default state is [name, visibility], we can handle a "Remove visibility" command, by creating a [name] list.
+
+ @Override
+ public Command getRemoveCommand(Object value) {
+ if(isStyleCreated()) {
+ return super.getRemoveCommand(value);
+ }
+
+ //The current list is not always empty, even if the style is not defined: we have a default value
+ Collection<Object> currentValues = new HashSet<Object>(wrappedList);
+ if(currentValues.remove(value)) {
+ return getAddAllCommand(currentValues);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ public Command getRemoveAllCommand(Collection<?> values) {
+ if(isStyleCreated()) {
+ return super.getRemoveAllCommand(values);
+ }
+
+ Collection<Object> currentValues = new HashSet<Object>(wrappedList);
+ if(currentValues.containsAll(values)) {
+ currentValues.removeAll(values);
+ if(currentValues.isEmpty()) {
+ return IdentityCommand.INSTANCE;
+ }
+ return getAddAllCommand(currentValues);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
index 56ac86ec598..d115969535e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/modelelement/UMLNotationModelElement.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -13,14 +13,17 @@ package org.eclipse.papyrus.uml.properties.modelelement;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.widgets.providers.AbstractStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.papyrus.uml.properties.databinding.ElementCustomizationObservableValue;
import org.eclipse.papyrus.uml.properties.databinding.ElementCustomizationObservableValue.Property;
+import org.eclipse.papyrus.uml.properties.databinding.MaskValueObservableList;
import org.eclipse.papyrus.uml.properties.messages.Messages;
import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
import org.eclipse.papyrus.uml.tools.utils.UMLUtil;
@@ -79,7 +82,8 @@ public class UMLNotationModelElement extends AbstractModelElement {
@Override
public IObservable doGetObservable(String propertyPath) {
if(propertyPath.equals(LabelCustomization)) {
- return new ElementCustomizationObservableValue(sourceElement, Property.LABEL_CUSTOMIZATION);
+ EditingDomain editingDomain = EMFHelper.resolveEditingDomain(sourceElement);
+ return new MaskValueObservableList(sourceElement, editingDomain);
} else if(propertyPath.equals(StereotypeDisplay)) {
//TODO : check if we need an observable in this case. For now, the Widget is responsible for updating the element
//@see StereotypeDisplay
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 3eace32199e..3b64cd7fa47 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,6 +1,6 @@
/*****************************************************************************
* 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
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderLi
/**
* A MaskProvider for the labelCustomization property
- *
+ *
* @author Camille Letavernier
*/
public class LabelCustomizationMaskProvider implements XWTCompliantMaskProvider {
@@ -42,7 +42,7 @@ public class LabelCustomizationMaskProvider implements XWTCompliantMaskProvider
public LabelCustomizationMaskProvider() {
}
- public Map<Integer, String> getMasks() {
+ public Map<String, String> getMasks() {
return editPolicy.getMasks();
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java
index 3f256a7d23c..31a21c2dd62 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/CollaborationUseUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -9,11 +9,13 @@
*
* Contributors:
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
+
import org.eclipse.uml2.uml.CollaborationUse;
/**
@@ -25,7 +27,7 @@ public class CollaborationUseUtil {
/**
* return the full label of the CollaborationUse, given UML2 specification.
- *
+ *
* @return the string corresponding to the label of the CollaborationUse
*/
public static String getLabel(CollaborationUse collaborationUse) {
@@ -50,28 +52,28 @@ public class CollaborationUseUtil {
/**
* return the custom label of the CollaborationUse, given UML2 specification and a custom style.
- *
+ *
* @param style
* the integer representing the style of the label
- *
+ *
* @return the string corresponding to the label of the CollaborationUse
*/
- public static String getCustomLabel(CollaborationUse collaborationUse, int style) {
+ public static String getCustomLabel(CollaborationUse collaborationUse, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
// visibility
buffer.append(" ");
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(collaborationUse));
}
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(collaborationUse.getName());
}
- if((style & ICustomAppearence.DISP_TYPE) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_TYPE)) {
// type
if(collaborationUse.getType() != null) {
buffer.append(": " + collaborationUse.getType().getName());
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ICustomAppearence.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ICustomAppearence.java
index 7b65eb595b9..955348f3120 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ICustomAppearence.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ICustomAppearence.java
@@ -13,6 +13,9 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Arrays;
+import java.util.Collection;
+
/**
* Interface that manages display constants for custom labels (ex: operations label in a class
* diagram).
@@ -31,93 +34,70 @@ public interface ICustomAppearence {
/**
* Style constant for visibility display in labels.
*/
- public final static int DISP_VISIBILITY = 1 << 1;
+ public final static String DISP_VISIBILITY = "visibility";
/**
* Style constant for isDerive display in labels.
*/
- public final static int DISP_DERIVE = 1 << 2;
+ public final static String DISP_DERIVE = "derived";
/**
* Style constant for name display in labels.
*/
- public final static int DISP_NAME = 1 << 3;
+ public final static String DISP_NAME = "name";
/**
* Style constant for type display in labels.
*/
- public final static int DISP_TYPE = 1 << 4;
+ public final static String DISP_TYPE = "type";
/**
* Style constant for multiplicity display in labels.
*/
- public final static int DISP_MULTIPLICITY = 1 << 5;
+ public final static String DISP_MULTIPLICITY = "multiplicity";
/**
* Style constant for default value display in labels.
*/
- public final static int DISP_DFLT_VALUE = 1 << 6;
+ public final static String DISP_DEFAULT_VALUE = "defaultValue";
/**
* Style constant for modifiers display in labels.
*/
- public final static int DISP_MOFIFIERS = 1 << 7;
-
- /**
- * Style constant for parameters display in labels.
- *
- * @deprecated
- * @see #DISP_PARAMETER_TYPE
- */
- @Deprecated
- // @unused
- public final static int DISP_PARAMETERS = 1 << 8;
-
- /**
- * Style constant for return parameters display in labels.
- *
- * @deprecated
- * @see #DISP_RT_TYPE
- */
- @Deprecated
- // @unused
- public final static int DISP_RETURN_PARAMETERS = 1 << 9;
+ public final static String DISP_MODIFIERS = "modifiers";
/** Style constant for carriage return in labels */
- public final static int DISP_MULTI_LINE = 1 << 10;
+ public final static String DISP_MULTI_LINE = "multiline";
- /**
- * Style constant for opaque action body display in labels.
- */
- // @unused
- public final static int DISP_BODY = 1 << 11;
+ /** Style constant for operation#parameter direction display in labels */
+ public final String DISP_PARAMETER_DIRECTION = "parametersDirection";
- /** Style constant for parameter direction display in labels */
- public final int DISP_PARAMETER_DIRECTION = 1 << 11;
+ /** Style constant for direction display in labels */
+ public final String DISP_DIRECTION = "direction";
- /** Style constant for parameter name display in labels */
- public final int DISP_PARAMETER_NAME = 1 << 12;
+ /** Style constant for operation#parameter name display in labels */
+ public final String DISP_PARAMETER_NAME = "parametersName";
- /** Style constant for parameter type display in labels */
- public final int DISP_PARAMETER_TYPE = 1 << 8;
+ /** Style constant for operation#parameter type display in labels */
+ public final String DISP_PARAMETER_TYPE = "parametersType";
- /** Style constant for parameter multiplicity display in labels */
- public final int DISP_PARAMETER_MULTIPLICITY = 1 << 14;
+ /** Style constant for operation#parameter multiplicity display in labels */
+ public final String DISP_PARAMETER_MULTIPLICITY = "parametersMultiplicity";
- /** Style constant for parameter default value display in labels */
- public final int DISP_PARAMETER_DEFAULT = 1 << 15;
+ /** Style constant for operation#parameter default value display in labels */
+ public final String DISP_PARAMETER_DEFAULT = "parametersDefault";
- /** Style constant for parameter modifiers display in labels */
- public final int DISP_PARAMETER_MODIFIERS = 1 << 16;
+ /** Style constant for operation#parameter modifiers display in labels */
+ public final String DISP_PARAMETER_MODIFIERS = "parametersModifiers";
- /** Style constant for return parameter type display in labels */
- public final int DISP_RT_TYPE = 1 << 9;
+ /** Style constant for return type display in labels */
+ public final String DISP_RT_TYPE = "returnType";
- /** Style constant for return parameter multiplicity display in labels */
- public final int DISP_RT_MULTIPLICITY = 1 << 18;
+ /** Style constant for return multiplicity display in labels */
+ public final String DISP_RT_MULTIPLICITY = "returnMultiplicity";
/** Style constant for conjugated labels */
- public final int DISP_CONJUGATED = 1 << 19;
+ public final String DISP_CONJUGATED = "conjugated";
// /////////////////////////////////////////////////////////////////////////
// UML DEFAULT DISPLAY
@@ -125,48 +105,49 @@ public interface ICustomAppearence {
/**
* default uml property display in classes edit part.
*/
- public final static int DEFAULT_UML_PROPERTY = DISP_VISIBILITY | DISP_DERIVE | DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY;
+ public final static Collection<String> DEFAULT_UML_PROPERTY = Arrays.asList(DISP_VISIBILITY, DISP_DERIVE, DISP_NAME, DISP_TYPE, DISP_MULTIPLICITY);
/**
* default uml property display in classes edit part.
*/
- public final static int DEFAULT_UML_ROLE = DISP_VISIBILITY | DISP_DERIVE | DISP_NAME | DISP_TYPE;
+ public final static Collection<String> DEFAULT_UML_ROLE = Arrays.asList(DISP_VISIBILITY, DISP_DERIVE, DISP_NAME, DISP_TYPE);
/**
* default uml operation display.
*/
- public final static int DEFAULT_UML_OPERATION = DISP_VISIBILITY | DISP_NAME | DISP_PARAMETER_DIRECTION | DISP_PARAMETER_TYPE | DISP_RT_TYPE | DISP_PARAMETER_NAME;
+ public final static Collection<String> DEFAULT_UML_OPERATION = Arrays.asList(DISP_VISIBILITY, DISP_NAME, DISP_PARAMETER_DIRECTION, DISP_PARAMETER_TYPE, DISP_RT_TYPE, DISP_PARAMETER_NAME);
/**
* default uml Property in composite diagrams.
*/
// @unused
- public final static int DEFAULT_UML_COMPO_PROPERTY = DISP_NAME | DISP_TYPE;
+ public final static Collection<String> DEFAULT_UML_COMPO_PROPERTY = Arrays.asList(DISP_NAME, DISP_TYPE);
/**
* default uml Property in class diagrams as association ends.
*/
// @unused
- public final static int DEFAULT_UML_RELATIONEND_PROPERTY = DISP_VISIBILITY | DISP_DERIVE | DISP_NAME | DISP_MOFIFIERS | DISP_MULTI_LINE;
+ public final static Collection<String> DEFAULT_UML_RELATIONEND_PROPERTY = Arrays.asList(DISP_VISIBILITY, DISP_DERIVE, DISP_NAME, DISP_MODIFIERS, DISP_MULTI_LINE);
/**
* default uml Port ins composite diagrams.
*/
- public final static int DEFAULT_UML_PORT = DISP_VISIBILITY | DISP_DERIVE | DISP_NAME | DISP_TYPE | DISP_MULTIPLICITY | DISP_CONJUGATED;
+ public final static Collection<String> DEFAULT_UML_PORT = Arrays.asList(DISP_VISIBILITY, DISP_DERIVE, DISP_NAME, DISP_TYPE, DISP_MULTIPLICITY, DISP_CONJUGATED);
/**
* default uml OpaqueAction in activity diagrams.
*/
// @unused
- public final static int DEFAULT_UML_OPAQUE_ACTION = DISP_NAME;
+ public final static Collection<String> DEFAULT_UML_OPAQUE_ACTION = Arrays.asList(DISP_NAME);
/**
* default uml Parameter in composite diagrams.
*/
- public final static int DEFAULT_UML_PARAMETER = DISP_PARAMETER_DIRECTION | DISP_PARAMETER_NAME | DISP_PARAMETER_TYPE;
+ public final static Collection<String> DEFAULT_UML_PARAMETER = Arrays.asList(DISP_DIRECTION, DISP_NAME, DISP_TYPE);
/**
* default uml instancespecification .
*/
- public final static int DEFAULT_UML_INSTANCESPECIFICATION = DISP_NAME | DISP_TYPE;
+ public final static Collection<String> DEFAULT_UML_INSTANCESPECIFICATION = Arrays.asList(DISP_NAME, DISP_TYPE);
+
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java
index 44b48829ed4..418f3c81e2b 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/InstanceSpecificationUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -12,49 +12,53 @@
*/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
import java.util.Iterator;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.InstanceSpecification;
/**
- * util class to display name of instancespecification
+ * util class to display name of instancespecification
*
*/
public class InstanceSpecificationUtil {
+
/**
* return the custom label of the operation, given UML2 specification and a custom style.
- *
+ *
* @param style
* the integer representing the style of the label
- *
+ *
* @return the string corresponding to the label of the operation
*/
- public static String getCustomLabel(InstanceSpecification instance, int style) {
+ public static String getCustomLabel(InstanceSpecification instance, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
buffer.append(" "); // adds " " first for correct display considerations
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(NamedElementUtil.getName(instance));
}
// classifier
- if((style & ICustomAppearence.DISP_TYPE) != 0) {
- if( !getTypesAsString(instance, style).equals("")){
+ if(maskValues.contains(ICustomAppearence.DISP_TYPE)) {
+ if(!getTypesAsString(instance).equals("")) {
buffer.append(": ");
- buffer.append(getTypesAsString(instance, style));}
+ buffer.append(getTypesAsString(instance));
+ }
}
return buffer.toString();
}
+
/**
* Returns the list of classifier for an instance specification as a string
- *
+ *
* @return a string containing all classifier separated by commas
*/
- private static String getTypesAsString(InstanceSpecification instance, int style) {
+ private static String getTypesAsString(InstanceSpecification instance) {
StringBuffer typeString = new StringBuffer();
Iterator<Classifier> classifierIterator = instance.getClassifiers().iterator();
boolean firstParameter = true;
@@ -63,8 +67,8 @@ public class InstanceSpecificationUtil {
// get the label for this Classifier
String classifierName = NamedElementUtil.getName(classifier);
- if (!classifierName.trim().equals("")) {
- if (!firstParameter) {
+ if(!classifierName.trim().equals("")) {
+ if(!firstParameter) {
typeString.append(", ");
}
typeString.append(classifierName);
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java
index 7b4adf2b05d..d7b59c2a9dc 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/OperationUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -9,10 +9,11 @@
*
* Contributors:
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
import java.util.Iterator;
import org.eclipse.uml2.uml.Constraint;
@@ -27,40 +28,40 @@ public class OperationUtil {
/**
* return the custom label of the operation, given UML2 specification and a custom style.
- *
+ *
* @param style
* the integer representing the style of the label
- *
+ *
* @return the string corresponding to the label of the operation
*/
- public static String getCustomLabel(Operation operation, int style) {
+ public static String getCustomLabel(Operation operation, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
buffer.append(" "); // adds " " first for correct display considerations
// visibility
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(operation));
}
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(operation.getName());
}
- //
+ //
// parameters : '(' parameter-list ')'
buffer.append("(");
- buffer.append(OperationUtil.getParametersAsString(operation, style));
+ buffer.append(OperationUtil.getParametersAsString(operation, maskValues));
buffer.append(")");
// return type
- if((style & ICustomAppearence.DISP_RT_TYPE) != 0) {
- buffer.append(OperationUtil.getReturnTypeAsString(operation, style));
+ if(maskValues.contains(ICustomAppearence.DISP_RT_TYPE)) {
+ buffer.append(OperationUtil.getReturnTypeAsString(operation, maskValues));
}
// modifiers
- if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_MODIFIERS)) {
String modifiers = OperationUtil.getModifiersAsString(operation);
if(!modifiers.equals("")) {
buffer.append("{");
@@ -73,14 +74,14 @@ public class OperationUtil {
/**
* Returns return parameter label as a string, string parametrized with a style mask.
- *
+ *
* @param style
* the mask that indicates which element to display
* @return a string containing the return parameter type
*/
- private static String getReturnTypeAsString(Operation operation, int style) {
- boolean displayType = ((style & ICustomAppearence.DISP_RT_TYPE) != 0);
- boolean displayMultiplicity = ((style & ICustomAppearence.DISP_RT_MULTIPLICITY) != 0);
+ private static String getReturnTypeAsString(Operation operation, Collection<String> maskValues) {
+ boolean displayType = maskValues.contains(ICustomAppearence.DISP_RT_TYPE);
+ boolean displayMultiplicity = maskValues.contains(ICustomAppearence.DISP_RT_MULTIPLICITY);
StringBuffer label = new StringBuffer("");
// Retrieve the return parameter (assume to be unique if defined)
@@ -107,10 +108,10 @@ public class OperationUtil {
/**
* Returns operation parameters as a string, the label is customized using a bit mask
- *
+ *
* @return a string containing all parameters separated by commas
*/
- private static String getParametersAsString(Operation operation, int style) {
+ private static String getParametersAsString(Operation operation, Collection<String> maskValues) {
StringBuffer paramString = new StringBuffer();
Iterator<Parameter> paramIterator = operation.getOwnedParameters().iterator();
boolean firstParameter = true;
@@ -122,9 +123,9 @@ public class OperationUtil {
// get the label for this parameter
- String parameterString = ParameterUtil.getCustomLabel(parameter, style);
- if (!parameterString.trim().equals("")) {
- if (!firstParameter) {
+ String parameterString = ParameterUtil.getCustomLabel(parameter, maskValues);
+ if(!parameterString.trim().equals("")) {
+ if(!firstParameter) {
paramString.append(", ");
}
paramString.append(parameterString);
@@ -137,7 +138,7 @@ public class OperationUtil {
/**
* Returns operation modifiers as string, separated with comma.
- *
+ *
* @return a string containing the modifiers
*/
private static String getModifiersAsString(Operation operation) {
@@ -202,7 +203,7 @@ public class OperationUtil {
/**
* Gives the return parameter for this operation, or <code>null</code> if none exists.
- *
+ *
* @return the return parameter of the operation or <code>null</code>
*/
private static Parameter getReturnParameter(Operation operation) {
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java
index ce38cf5ad51..6ec5265eb8d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/ParameterUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -9,10 +9,12 @@
*
* Contributors:
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
+
import org.eclipse.uml2.uml.Parameter;
/**
@@ -23,11 +25,11 @@ public class ParameterUtil {
/**
* Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline
* string if <code>multiline</code> is <code>false</code>.
- *
+ *
* @param multiLine
* boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to
* <code>false</code>.
- *
+ *
* @return a string giving all modifiers for the property
*/
public static String getModifiersAsString(Parameter parameter, boolean multiLine) {
@@ -59,7 +61,7 @@ public class ParameterUtil {
/**
* Update the modifiers string
- *
+ *
* @param buffer
* the existing bufferString to append
* @param needsComma
@@ -81,7 +83,7 @@ public class ParameterUtil {
/**
* return the full label of the Parameter.
- *
+ *
* @return the string corresponding to the label of the parameter
*/
public static String getLabel(Parameter parameter) {
@@ -127,33 +129,33 @@ public class ParameterUtil {
/**
* return the custom label of the property, given UML2 specification and a custom style.
- *
+ *
* @param style
* the integer representing the style of the label
- *
+ *
* @return the string corresponding to the label of the property
*/
- public static String getCustomLabel(Parameter parameter, int style) {
+ public static String getCustomLabel(Parameter parameter, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
// visibility
buffer.append(" ");
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
}
// direction property
- if((style & ICustomAppearence.DISP_PARAMETER_DIRECTION) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_PARAMETER_DIRECTION) || maskValues.contains(ICustomAppearence.DISP_DIRECTION)) {
buffer.append(" ");
buffer.append(parameter.getDirection().getLiteral());
}
// name
- if((style & ICustomAppearence.DISP_PARAMETER_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_PARAMETER_NAME) || maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(parameter.getName());
}
- if((style & ICustomAppearence.DISP_PARAMETER_TYPE) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_PARAMETER_TYPE) || maskValues.contains(ICustomAppearence.DISP_TYPE)) {
// type
if(parameter.getType() != null) {
buffer.append(": " + parameter.getType().getName());
@@ -162,13 +164,13 @@ public class ParameterUtil {
}
}
- if((style & ICustomAppearence.DISP_PARAMETER_MULTIPLICITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_PARAMETER_MULTIPLICITY) || maskValues.contains(ICustomAppearence.DISP_MULTIPLICITY)) {
// multiplicity -> do not display [1]
String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
buffer.append(multiplicity);
}
- if((style & ICustomAppearence.DISP_PARAMETER_DEFAULT) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_PARAMETER_DEFAULT) || maskValues.contains(ICustomAppearence.DISP_DEFAULT_VALUE)) {
// default value
if(parameter.getDefault() != null) {
buffer.append(" = ");
@@ -176,8 +178,8 @@ public class ParameterUtil {
}
}
- if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
- boolean multiLine = ((style & ICustomAppearence.DISP_MULTI_LINE) != 0);
+ if(maskValues.contains(ICustomAppearence.DISP_MODIFIERS)) {
+ boolean multiLine = (maskValues.contains(ICustomAppearence.DISP_MULTI_LINE));
// property modifiers
String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine);
if(!modifiers.equals("")) {
@@ -192,7 +194,7 @@ public class ParameterUtil {
/**
* Returns the default value as a String
- *
+ *
* @param equalSign
* boolean set to <code>true</code> if the label must have the <code>=</code> sign
* before the default value
@@ -209,17 +211,4 @@ public class ParameterUtil {
}
return "";
}
-
- /**
- * Returns <code>true</code> if the given style has the given mask
- *
- * @param style
- * the style to check
- * @param mask
- * the mask to check
- * @return <code>true</code> if the style has the bit mask
- */
- static boolean hasStyle(int style, int mask) {
- return ((style & mask) != 0);
- }
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java
index 009248b612c..2bfb067f5c0 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PortUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -13,11 +13,14 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
+
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
public class PortUtil extends PropertyUtil {
+
/**
* return the custom label of the property, given UML2 specification and a custom style.
*
@@ -26,54 +29,52 @@ public class PortUtil extends PropertyUtil {
*
* @return the string corresponding to the label of the property
*/
- public static String getCustomLabel(Property property, int style) {
+ public static String getCustomLabel(Property property, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
// visibility
buffer.append(" ");
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(property));
}
// derived property
- if((style & ICustomAppearence.DISP_DERIVE) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_DERIVE)) {
if(property.isDerived()) {
buffer.append("/");
}
}
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(property.getName());
}
- if((style & ICustomAppearence.DISP_TYPE) != 0) {
- if( (style &ICustomAppearence.DISP_CONJUGATED)!=0){
- if( ((Port)property).isConjugated()){
+ if(maskValues.contains(ICustomAppearence.DISP_TYPE)) {
+ if(maskValues.contains(ICustomAppearence.DISP_CONJUGATED)) {
+ if(((Port)property).isConjugated()) {
buffer.append(": ~");
- }
- else{
+ } else {
buffer.append(": ");
}
- }
- else{
+ } else {
buffer.append(": ");
}
// type
if(property.getType() != null) {
- buffer.append( property.getType().getName());
+ buffer.append(property.getType().getName());
} else {
- buffer.append( TypeUtil.UNDEFINED_TYPE_NAME);
+ buffer.append(TypeUtil.UNDEFINED_TYPE_NAME);
}
}
- if((style & ICustomAppearence.DISP_MULTIPLICITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_MULTIPLICITY)) {
// multiplicity -> do not display [1]
String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
buffer.append(multiplicity);
}
- if((style & ICustomAppearence.DISP_DFLT_VALUE) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_DEFAULT_VALUE)) {
// default value
if(property.getDefault() != null) {
buffer.append(" = ");
@@ -81,8 +82,8 @@ public class PortUtil extends PropertyUtil {
}
}
- if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
- boolean multiLine = ((style & ICustomAppearence.DISP_MULTI_LINE) != 0);
+ if(maskValues.contains(ICustomAppearence.DISP_MODIFIERS)) {
+ boolean multiLine = maskValues.contains(ICustomAppearence.DISP_MULTI_LINE);
// property modifiers
String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
if(!modifiers.equals("")) {
@@ -90,7 +91,7 @@ public class PortUtil extends PropertyUtil {
buffer.append("\n");
}
- if (!buffer.toString().endsWith(" ")){
+ if(!buffer.toString().endsWith(" ")) {
buffer.append(" ");
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
index 554e42e9feb..33a2169ca22 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/PropertyUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2009 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
@@ -9,12 +9,13 @@
*
* Contributors:
* Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -29,7 +30,7 @@ public class PropertyUtil {
/**
* Get all properties that can be subset by this {@link Property} checks the type and the
* multiplicity.
- *
+ *
* @param property
* property for which the list of subsettable properties are made
* @param noCheck
@@ -80,7 +81,7 @@ public class PropertyUtil {
/**
* Find a subsetted property given its name and a context to find it.
- *
+ *
* @param name
* the name of the property
* @return the property found or <code>null</code> if the element was not found.
@@ -100,7 +101,7 @@ public class PropertyUtil {
/**
* Get all properties that can be redefined by this {@link Property}.
- *
+ *
* @return all properties that can be redefined
*/
public static List<Property> getRedefinableProperties(Property property) {
@@ -128,7 +129,7 @@ public class PropertyUtil {
/**
* Find a redefined property given its name and a context to find it.
- *
+ *
* @param name
* the name of the property
* @return the property found or <code>null</code> if the element was not found.
@@ -147,7 +148,7 @@ public class PropertyUtil {
/**
* Get the displayed string for the derived attribute of the property.
- *
+ *
* @param property
* the property
* @return If the property is derived, return "/". Otherwise return an empty String
@@ -158,7 +159,7 @@ public class PropertyUtil {
/**
* return the full label of the property, given UML2 specification.
- *
+ *
* @return the string corresponding to the label of the property
*/
public static String getLabel(Property property) {
@@ -209,34 +210,34 @@ public class PropertyUtil {
/**
* return the custom label of the property, given UML2 specification and a custom style.
- *
+ *
* @param style
- * the integer representing the style of the label
- *
+ * the collection of label fragments to display
+ *
* @return the string corresponding to the label of the property
*/
- public static String getCustomLabel(Property property, int style) {
+ public static String getCustomLabel(Property property, Collection<String> style) {
StringBuffer buffer = new StringBuffer();
// visibility
buffer.append(" ");
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(style.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(property));
}
// derived property
- if((style & ICustomAppearence.DISP_DERIVE) != 0) {
+ if(style.contains(ICustomAppearence.DISP_DERIVE)) {
if(property.isDerived()) {
buffer.append("/");
}
}
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(style.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(property.getName());
}
- if((style & ICustomAppearence.DISP_TYPE) != 0) {
+ if(style.contains(ICustomAppearence.DISP_TYPE)) {
// type
if(property.getType() != null) {
buffer.append(": " + property.getType().getName());
@@ -245,13 +246,13 @@ public class PropertyUtil {
}
}
- if((style & ICustomAppearence.DISP_MULTIPLICITY) != 0) {
+ if(style.contains(ICustomAppearence.DISP_MULTIPLICITY)) {
// multiplicity -> do not display [1]
String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(property);
buffer.append(multiplicity);
}
- if((style & ICustomAppearence.DISP_DFLT_VALUE) != 0) {
+ if(style.contains(ICustomAppearence.DISP_DEFAULT_VALUE)) {
// default value
if(property.getDefault() != null) {
buffer.append(" = ");
@@ -259,19 +260,19 @@ public class PropertyUtil {
}
}
- if((style & ICustomAppearence.DISP_MOFIFIERS) != 0) {
- boolean multiLine = ((style & ICustomAppearence.DISP_MULTI_LINE) != 0);
+ if(style.contains(ICustomAppearence.DISP_MODIFIERS)) {
+ boolean multiLine = style.contains(ICustomAppearence.DISP_MULTI_LINE);
// property modifiers
String modifiers = PropertyUtil.getModifiersAsString(property, multiLine);
if(!modifiers.equals("")) {
if(multiLine) {
buffer.append("\n");
}
-
- if (!buffer.toString().endsWith(" ")){
+
+ if(!buffer.toString().endsWith(" ")) {
buffer.append(" ");
}
-
+
buffer.append(modifiers);
}
}
@@ -281,11 +282,11 @@ public class PropertyUtil {
/**
* Returns the modifier of the property, separated by a comma, as as single line if <code>multiline</code> is <code>false</code> or as a multiline
* string if <code>multiline</code> is <code>false</code>.
- *
+ *
* @param multiLine
* boolean that indicates if the string should have several lines when set to <code>true</code> or only one line when set to
* <code>false</code>.
- *
+ *
* @return a string giving all modifiers for the property
*/
public static String getModifiersAsString(Property property, boolean multiLine) {
@@ -330,7 +331,7 @@ public class PropertyUtil {
/**
* Update the modifiers string
- *
+ *
* @param buffer
* the existing bufferString to append
* @param needsComma
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java
index aff8f747f3d..0abc0be2ba0 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/SignalUtil.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.utils;
+import java.util.Collection;
+
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Signal;
@@ -23,31 +25,31 @@ public class SignalUtil {
/**
* return the custom label of the signal, given UML2 specification and a custom style.
- *
+ *
* @param style
* the integer representing the style of the label
- *
+ *
* @return the string corresponding to the label of the signal
*/
- public static String getCustomLabel(Signal signal, int style) {
+ public static String getCustomLabel(Signal signal, Collection<String> maskValues) {
StringBuffer buffer = new StringBuffer();
buffer.append(" "); // adds " " first for correct display considerations
// visibility
- if((style & ICustomAppearence.DISP_VISIBILITY) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_VISIBILITY)) {
buffer.append(NamedElementUtil.getVisibilityAsSign(signal));
}
// name
- if((style & ICustomAppearence.DISP_NAME) != 0) {
+ if(maskValues.contains(ICustomAppearence.DISP_NAME)) {
buffer.append(" ");
buffer.append(signal.getName());
}
- //
+ //
// parameters : '(' parameter-list ')'
buffer.append("(");
- buffer.append(getPropertiesAsString(signal, style));
+ buffer.append(getPropertiesAsString(signal, maskValues));
buffer.append(")");
return buffer.toString();
@@ -55,15 +57,15 @@ public class SignalUtil {
/**
* Returns signal properties as a string, the label is customized using a bit mask
- *
+ *
* @return a string containing all properties separated by commas
*/
- private static String getPropertiesAsString(Signal signal, int style) {
+ private static String getPropertiesAsString(Signal signal, Collection<String> maskValues) {
StringBuffer propertiesString = new StringBuffer();
boolean firstProperty = true;
for(Property property : signal.getOwnedAttributes()) {
// get the label for this property
- String propertyString = PropertyUtil.getCustomLabel(property, style);
+ String propertyString = PropertyUtil.getCustomLabel(property, maskValues);
if(!propertyString.trim().equals("")) {
if(!firstProperty) {
propertiesString.append(", ");
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
index c222cc5b896..55bf938b168 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 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
@@ -19,6 +19,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.AbstractListEditor;
import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.views.properties.Activator;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.contexts.Property;
@@ -33,7 +34,7 @@ import org.eclipse.swt.widgets.Control;
* An Abstract class to factorize code for PropertyEditors. PropertyEditors are
* <strong>not</strong> required to extend this class, but could benefit from
* its methods.
- *
+ *
* @author Camille Letavernier
*/
public abstract class AbstractPropertyEditor implements IChangeListener, CustomizablePropertyEditor {
@@ -98,7 +99,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Constructor. Constructs a new PropertyEditor with the given ListEditor
- *
+ *
* @param editor
*/
protected AbstractPropertyEditor(AbstractListEditor editor) {
@@ -107,7 +108,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Constructor. Constructs a new PropertyEditor with the given ValueEditor
- *
+ *
* @param editor
*/
protected AbstractPropertyEditor(AbstractValueEditor editor) {
@@ -116,7 +117,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the ListEditor for this PropertyEditor
- *
+ *
* @param editor
*/
protected void setEditor(AbstractListEditor editor) {
@@ -126,7 +127,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the ValueEditor for this PropertyEditor
- *
+ *
* @param editor
*/
protected void setEditor(AbstractValueEditor editor) {
@@ -161,6 +162,10 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
Activator.log.error(ex);
}
+ if(getInputObservable() instanceof ICommitListener && getEditor() != null) {
+ getEditor().addCommitListener((ICommitListener)getInputObservable());
+ }
+
updateLabel();
updateDescription();
}
@@ -195,7 +200,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Applies the readOnly state to the editor
- *
+ *
* @param readOnly
* Indicates if this widget should be read-only
*/
@@ -225,7 +230,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
* Sets the property path for this PropertyEditor.
* The propertyPath elements should be separated by ":"
* e.g. UML:NamedElement:name
- *
+ *
* @param path
*/
public void setProperty(String path) {
@@ -269,7 +274,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the input DataSource for this Property editor.
- *
+ *
* @param input
*/
public void setInput(DataSource input) {
@@ -336,7 +341,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Finds the property associated to the Editor's {@link #propertyPath}
- *
+ *
* @return The property associated to the Editor's {@link #propertyPath}
*/
protected Property getModelProperty() {
@@ -357,7 +362,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Marks this editor as readOnly
- *
+ *
* @param readOnly
*/
public void setReadOnly(boolean readOnly) {
@@ -376,7 +381,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Tests if this editor is read-only
- *
+ *
* @return
* True if this editor is read-only
*/
@@ -420,7 +425,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Returns the IObservable for this propertyEditor, or null if it is
* not available
- *
+ *
* @return The IObservable associated to this propertyEditor
*/
protected IObservable getInputObservable() {
@@ -446,7 +451,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the editor's Layout Data
- *
+ *
* @param data
*/
public void setLayoutData(Object data) {
@@ -457,7 +462,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Returns the editor's Layout Data
- *
+ *
* @return
* The editor's layout data
*/
@@ -467,7 +472,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Indicates whether the editor's label should be displayed or not
- *
+ *
* @param showLabel
*/
public void setShowLabel(boolean showLabel) {
@@ -480,7 +485,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Indicates whether the editor's label is displayed or not
- *
+ *
* @return
* true if the label should be displayed
*/
@@ -491,7 +496,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the label for this editor. The label will replace the property's
* default label
- *
+ *
* @param customLabel
* The label to use with this property editor
*/
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
index 30d6147b387..a3f343ff168 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -12,103 +12,62 @@
package org.eclipse.papyrus.views.properties.widgets;
import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
-import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
import org.eclipse.swt.widgets.Composite;
/**
* A widget to edit mask-based Integer values
* The integer value is interpreted as a list of boolean values
* The widget cannot use more than 32 masks
- *
+ *
* @author Camille Letavernier
*/
-public class IntegerMask extends AbstractPropertyEditor implements XWTCompliantMaskProviderListener {
-
- private org.eclipse.papyrus.infra.widgets.editors.IntegerMask editor;
-
- private XWTCompliantMaskProvider maskProvider;
-
- private boolean maskProviderReady = false;
+@Deprecated
+public class IntegerMask extends InvalidWidget {
/**
- *
+ *
* Constructor.
- *
+ *
* @param parent
* The composite in which this widget will be created
* @param style
*/
public IntegerMask(Composite parent, int style) {
- editor = createIntegerMask(parent, style);
- setEditor(editor);
- }
-
- /**
- * Creates the integer mask.
- *
- * @param parent
- * The composite in which the widget will be displayed
- * @param style
- * The style for the widget
- * @return the integer mask.
- */
- protected org.eclipse.papyrus.infra.widgets.editors.IntegerMask createIntegerMask(Composite parent, int style) {
- return new org.eclipse.papyrus.infra.widgets.editors.IntegerMask(parent, style);
- }
-
- @Override
- protected void checkInput() {
- if(maskProvider != null && maskProviderReady) {
- super.checkInput();
- }
+ super(parent, style);
}
/**
* @return the number of columns for this editor
- *
+ *
*/
public int getNumColumns() {
- return editor.getNumColumns();
+ return 0;
}
/**
* Sets the number of columns for this editor. The mask checkboxes will be
* distributed according to this number
- *
+ *
* @param numColumns
*/
public void setNumColumns(int numColumns) {
- editor.setNumColumns(numColumns);
+ //
}
/**
* Sets the MaskProvider for this editor
- *
+ *
* @param provider
*/
public void setMaskProvider(XWTCompliantMaskProvider provider) {
- if(this.maskProvider != null) {
- maskProvider.removeMaskProviderListener(this);
- }
-
- maskProviderReady = false;
- this.maskProvider = provider;
- provider.addMaskProviderListener(this);
- checkInput();
+ //
}
/**
- *
+ *
* @return the MaskProvider associated to this editor
*/
public XWTCompliantMaskProvider getMaskProvider() {
- return maskProvider;
- }
-
- public void notifyReady(XWTCompliantMaskProvider provider) {
- this.maskProviderReady = true;
- editor.setMasks(maskProvider.getMasks());
- provider.removeMaskProviderListener(this);
- checkInput();
+ return null;
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
index fbfe2ee3fc9..e18d9a9f62d 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -18,12 +18,12 @@ import java.util.Map;
*
* @author Camille Letavernier
*
- * @see IntegerMask
+ * @see StringMask
*/
public interface MaskProvider {
/**
* @return the list of masks and their String descriptions
*/
- public Map<Integer, String> getMasks();
+ public Map<String, String> getMasks();
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java
new file mode 100644
index 00000000000..3cf53f78487
--- /dev/null
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * 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.views.properties.widgets;
+
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A widget to edit mask-based Integer values
+ * The integer value is interpreted as a list of boolean values
+ * The widget cannot use more than 32 masks
+ *
+ * @author Camille Letavernier
+ */
+public class StringMask extends AbstractPropertyEditor implements XWTCompliantMaskProviderListener {
+
+ private org.eclipse.papyrus.infra.widgets.editors.StringMask editor;
+
+ private XWTCompliantMaskProvider maskProvider;
+
+ private boolean maskProviderReady = false;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this widget will be created
+ * @param style
+ */
+ public StringMask(Composite parent, int style) {
+ editor = createStringMask(parent, style);
+ setEditor(editor);
+ }
+
+ /**
+ * Creates the integer mask.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed
+ * @param style
+ * The style for the widget
+ * @return the integer mask.
+ */
+ protected org.eclipse.papyrus.infra.widgets.editors.StringMask createStringMask(Composite parent, int style) {
+ return new org.eclipse.papyrus.infra.widgets.editors.StringMask(parent, style);
+ }
+
+ @Override
+ protected void checkInput() {
+ if(maskProvider != null && maskProviderReady) {
+ super.checkInput();
+ }
+ }
+
+ /**
+ * @return the number of columns for this editor
+ *
+ */
+ public int getNumColumns() {
+ return editor.getNumColumns();
+ }
+
+ /**
+ * Sets the number of columns for this editor. The mask checkboxes will be
+ * distributed according to this number
+ *
+ * @param numColumns
+ */
+ public void setNumColumns(int numColumns) {
+ editor.setNumColumns(numColumns);
+ }
+
+ /**
+ * Sets the MaskProvider for this editor
+ *
+ * @param provider
+ */
+ public void setMaskProvider(XWTCompliantMaskProvider provider) {
+ if(this.maskProvider != null) {
+ maskProvider.removeMaskProviderListener(this);
+ }
+
+ maskProviderReady = false;
+ this.maskProvider = provider;
+ provider.addMaskProviderListener(this);
+ checkInput();
+ }
+
+ /**
+ *
+ * @return the MaskProvider associated to this editor
+ */
+ public XWTCompliantMaskProvider getMaskProvider() {
+ return maskProvider;
+ }
+
+ public void notifyReady(XWTCompliantMaskProvider provider) {
+ this.maskProviderReady = true;
+ editor.setMasks(maskProvider.getMasks());
+ provider.removeMaskProviderListener(this);
+ checkInput();
+ }
+}

Back to the top