diff options
10 files changed, 215 insertions, 29 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/CustomUMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/CustomUMLParserProvider.java index 2a8dd12324d..d6d97f5152d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/CustomUMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/providers/CustomUMLParserProvider.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2008 CEA LIST.
+ * Copyright (c) 2008, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -48,15 +48,17 @@ import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PropertyforDataTypeEditP import org.eclipse.papyrus.uml.diagram.clazz.parsers.MessageFormatParser;
import org.eclipse.papyrus.uml.diagram.clazz.providers.UMLParserProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomAppliedStereotypeContextLinkLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
import org.eclipse.papyrus.uml.diagram.common.parser.custom.AssociationEndParser;
import org.eclipse.papyrus.uml.diagram.common.parser.custom.AssociationMultiplicityParser;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.uml2.uml.UMLPackage;
/**
* this class is used to overload specific parsers
*
- * @author patrick Tessier
+ * @author Patrick Tessier
*/
public class CustomUMLParserProvider extends UMLParserProvider {
@@ -75,6 +77,10 @@ public class CustomUMLParserProvider extends UMLParserProvider { protected IParser getAppliedStereotypeParser(String defaultPrintString) {
return new AppliedStereotypeParser(defaultPrintString);
}
+
+ protected IParser getAppliedKeywordParser(String defaultPrintString) {
+ return new AppliedKeywordParser(defaultPrintString);
+ }
protected IParser getAssociationBranchRole() {
EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name(), };
@@ -173,25 +179,25 @@ public class CustomUMLParserProvider extends UMLParserProvider { case AppliedStereotypeInterfaceRealizationEditPart.VISUAL_ID:
return getAppliedStereotypeParser();
case AppliedStereotypeSubstitutionEditPart.VISUAL_ID:
- return getAppliedStereotypeParser();
+ return getAppliedKeywordParser(KeywordLabel.SUBSTITUTE);
case AppliedStereotypeRealizationEditPart.VISUAL_ID:
return getAppliedStereotypeParser();
case AppliedStereotypeAbstractionEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("abstraction"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.ABSTRACTION);
case AppliedStereotypeUsageEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("use"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.USE);
case AppliedStereotypeDependencyEditPart.VISUAL_ID:
return getAppliedStereotypeParser();
case AppliedStereotypeElementImportEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("Import"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.IMPORT);
case AppliedStereotypePackageImportEditPart.VISUAL_ID:
return getAppliedStereotypeParser();
case InformationFlowAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("flow"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.FLOW);
case ContextLinkAppliedStereotypeEditPart.VISUAL_ID:
return getAppliedStereotypeParser(CustomAppliedStereotypeContextLinkLabelDisplayEditPolicy.APPLIED_STEREOTYPE_LABEL);
case AppliedStereotypePackageMergeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("merge"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.MERGE);
}
return super.getParser(visualID);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF index a3ee53d32eb..9b11cdaba19 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF @@ -16,6 +16,7 @@ Export-Package: org.eclipse.papyrus.uml.diagram.common, org.eclipse.papyrus.uml.diagram.common.figure.node,
org.eclipse.papyrus.uml.diagram.common.handlers,
org.eclipse.papyrus.uml.diagram.common.helper,
+ org.eclipse.papyrus.uml.diagram.common.keyword,
org.eclipse.papyrus.uml.diagram.common.layout,
org.eclipse.papyrus.uml.diagram.common.listeners,
org.eclipse.papyrus.uml.diagram.common.locator,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java index 90deb9ae7ac..49fb5552067 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/Activator.java @@ -80,6 +80,15 @@ public class Activator extends AbstractUIPlugin { /** Font manager. */ protected static FontManager fontManager = /* new FontManager(); */null; + + /** + * Keywords are always enclosed in guillemets («keyword»), which serve as visual cues to more readily distinguish when + * a keyword is being used. + * NOTE. Guillemets are a special kind of quotation marks and should not be confused with or replaced by duplicated + * “greater than” (>>) or “less than” (<<) symbols, except in situations where the available character set may not include + *guillemets. + * See Annex C: Keywords OMG Unified Modeling Language TM (OMG UML), Version 2.5 + */ /** left Stereotype delimiters ('Guillemets francais'). */ public static final String ST_LEFT = String.valueOf("\u00AB"); //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/keyword/KeywordLabel.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/keyword/KeywordLabel.java new file mode 100644 index 00000000000..bf3ee652ae3 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/keyword/KeywordLabel.java @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.common.keyword; + +/** + * UML keywords are reserved words that are an integral part of the UML notation and normally appear as text + * annotations attached to a UML graphic element or as part of a text line in a UML diagram. + * See Table C.1 Keywords in OMG Unified Modeling Language TM (OMG UML) Version 2.5 + * + * @author Francois Le Fevre - francois.le-fevre@cea.fr + * @since 3.1 + */ +public class KeywordLabel { + + public static final String ABSTRACTION = "abstraction"; //$NON-NLS-1$ + + public static final String DEPLOY = "deploy"; //$NON-NLS-1$ + + public static final String FLOW = "flow"; //$NON-NLS-1$ + + public static final String IMPORT = "import"; //$NON-NLS-1$ + + public static final String MANIFEST = "manifest"; //$NON-NLS-1$ + + public static final String MERGE = "merge"; //$NON-NLS-1$ + + public static final String SUBSTITUTE = "substitute"; //$NON-NLS-1$ + + public static final String USE = "use"; //$NON-NLS-1$ + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedKeywordParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedKeywordParser.java new file mode 100644 index 00000000000..f4240b78b67 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedKeywordParser.java @@ -0,0 +1,59 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.parser.stereotype; + +import java.util.List; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Stereotype; + +/** + * UML keywords are reserved words that are an integral part of the UML notation and normally appear as text + * annotations attached to a UML graphic element or as part of a text line in a UML diagram. + * See Table C.1 Keywords in OMG Unified Modeling Language TM (OMG UML) Version 2.5 + * + * @author Francois Le Fevre - francois.le-fevre@cea.fr + * @since 3.1 + */ +public class AppliedKeywordParser extends AppliedStereotypeParser { + + + public AppliedKeywordParser() { + this(null); + } + + public AppliedKeywordParser(String defaultPrintString) { + super(defaultPrintString); + } + + @Override + public String getEditString(IAdaptable element, int flags) { + Element subject = doAdapt(element); + List<Stereotype> stereos = subject.getAppliedStereotypes(); + if (stereos.isEmpty()) { + return getMyDefaultPrintString(); + } + StringBuffer result = new StringBuffer(); + result.append(getMyDefaultPrintString()); + for (Stereotype next : stereos) { + if (result.length() > 0) { + result.append(", "); //$NON-NLS-1$ + } + result.append(UMLLabelInternationalization.getInstance().getKeyword(next)); + } + return result.toString(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java index 80ad9bdcee5..7258fb5d74b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/stereotype/AppliedStereotypeParser.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2006 Borland Software Corporation + * Copyright (c) 2006, 2017 Borland Software Corporation * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -37,7 +37,7 @@ import org.eclipse.uml2.uml.Stereotype; public class AppliedStereotypeParser implements ISemanticParser { private final String myDefaultPrintString; - + public AppliedStereotypeParser() { this(null); } @@ -46,7 +46,6 @@ public class AppliedStereotypeParser implements ISemanticParser { myDefaultPrintString = defaultPrintString; } - @Override public boolean areSemanticElementsAffected(EObject listener, Object notification) { if (notification instanceof Notification) { @@ -123,9 +122,20 @@ public class AppliedStereotypeParser implements ISemanticParser { return ParserEditStatus.UNEDITABLE_STATUS; } - private Element doAdapt(IAdaptable adaptable) { + /** + * @since 3.1 + */ + protected Element doAdapt(IAdaptable adaptable) { Element element = (Element) adaptable.getAdapter(EObject.class); return element; } + /** + * @return the myDefaultPrintString + * @since 3.1 + */ + protected String getMyDefaultPrintString() { + return myDefaultPrintString; + } + } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/providers/CustomUMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/providers/CustomUMLParserProvider.java index 6d25ab3688d..08b2c253795 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/providers/CustomUMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/providers/CustomUMLParserProvider.java @@ -11,6 +11,8 @@ package org.eclipse.papyrus.uml.diagram.component.custom.providers;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.AbstractionAppliedStereotypeEditPart;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.ManifestationAppliedStereotypeEditPart;
@@ -30,18 +32,22 @@ public class CustomUMLParserProvider extends UMLParserProvider { protected IParser getAppliedStereotypeParser(String defaultEditString) {
return new AppliedStereotypeParser(defaultEditString);
}
+
+ protected IParser getAppliedKeywordParser(String defaultPrintString) {
+ return new AppliedKeywordParser(defaultPrintString);
+ }
@Override
protected IParser getParser(String visualID) {
switch (visualID) {
case AbstractionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("abstraction"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.ABSTRACTION);
case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("manifestation"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.MANIFEST);
case SubstitutionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("substitution"); //$NON-NLS-1$
+ return getAppliedStereotypeParser(KeywordLabel.SUBSTITUTE);
case UsageAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("use"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.USE);
}
return super.getParser(visualID);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java index d285d10f9b6..ec7940b390f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/providers/CustomParserProvider.java @@ -1,5 +1,5 @@ /*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+ * Copyright (c) 2009-2011, 2017 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -14,6 +14,8 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.providers;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.ConnectorLabelParser;
import org.eclipse.papyrus.uml.diagram.composite.custom.parsers.MultiplicityLabelParser;
@@ -37,6 +39,13 @@ public class CustomParserProvider extends UMLParserProvider { protected IParser getAppliedStereotypeParser(String defaultEditString) {
return new AppliedStereotypeParser(defaultEditString);
}
+
+ /**
+ * @since 3.0
+ */
+ protected IParser getAppliedKeywordParser(String defaultPrintString) {
+ return new AppliedKeywordParser(defaultPrintString);
+ }
@Override
protected IParser getParser(String visualID) {
@@ -47,17 +56,17 @@ public class CustomParserProvider extends UMLParserProvider { case ConnectorNameEditPart.VISUAL_ID:
return getConnectorLabelParser();
case AbstractionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("abstraction"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.ABSTRACTION);
case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("deployment"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.DEPLOY);
case InformationFlowAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("flow"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.FLOW);
case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("manifestation"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.MANIFEST);
case SubstitutionAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("substitution"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.SUBSTITUTE);
case UsageAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("use"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.USE);
}
return super.getParser(visualID);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java index 4fb7ec99d69..960c2413358 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/providers/CustomUMLParserProvider.java @@ -1,6 +1,21 @@ +/*****************************************************************************
+ * Copyright (c) 2015, 2017 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.deployment.custom.providers;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart;
import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ManifestationAppliedStereotypeEditPart;
@@ -15,14 +30,21 @@ public class CustomUMLParserProvider extends UMLParserProvider { protected IParser getAppliedStereotypeParser(String defaultEditString) {
return new AppliedStereotypeParser(defaultEditString);
}
+
+ /**
+ * @since 3.0
+ */
+ protected IParser getAppliedKeywordParser(String defaultPrintString) {
+ return new AppliedKeywordParser(defaultPrintString);
+ }
@Override
protected IParser getParser(String visualID) {
switch (visualID) {
case DeploymentAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("deployment"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.DEPLOY);
case ManifestationAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("manifestation"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.MANIFEST);
}
return super.getParser(visualID);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/providers/CustomUMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/providers/CustomUMLParserProvider.java index 18dbacda05f..26677339761 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/providers/CustomUMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/providers/CustomUMLParserProvider.java @@ -1,6 +1,21 @@ +/*****************************************************************************
+ * Copyright (c) 2015-2017 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:
+ * CEA LIST- Initial API and implementation
+ *
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.usecase.custom.providers;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.papyrus.uml.diagram.common.keyword.KeywordLabel;
+import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedKeywordParser;
import org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser;
import org.eclipse.papyrus.uml.diagram.usecase.edit.parts.AppliedStereotypeAbstractionEditPart;
import org.eclipse.papyrus.uml.diagram.usecase.edit.parts.AppliedStereotypePackageMergeEditPart;
@@ -19,17 +34,24 @@ public class CustomUMLParserProvider extends UMLParserProvider { return new AppliedStereotypeParser(defaultEditString);
}
+ /**
+ * @since 3.0
+ */
+ protected IParser getAppliedKeywordParser(String defaultPrintString) {
+ return new AppliedKeywordParser(defaultPrintString);
+ }
+
@Override
protected IParser getParser(String visualID) {
switch (visualID) {
case AppliedStereotypeAbstractionEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("abstraction"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.ABSTRACTION);
case AppliedStereotypePackageMergeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("merge"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.MERGE);
case AppliedStereotypeUsageEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("use"); //$NON-NLS-1$
+ return getAppliedStereotypeParser(KeywordLabel.USE);
case PackageImportAppliedStereotypeEditPart.VISUAL_ID:
- return getAppliedStereotypeParser("import"); //$NON-NLS-1$
+ return getAppliedKeywordParser(KeywordLabel.IMPORT);
}
return super.getParser(visualID);
}
|