Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java49
1 files changed, 4 insertions, 45 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
index b41b8e9951c..566080aa846 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/parsers/RoleInstanceSpecificationLinkParser.java
@@ -9,7 +9,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 382954
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.custom.parsers;
@@ -19,10 +19,7 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Property;
/**
* The base class of InstanceSpecification link edge parser
@@ -30,10 +27,9 @@ import org.eclipse.uml2.uml.Property;
* @see the getClissifierMemberType() method for specify the type of end
*
*/
+public class RoleInstanceSpecificationLinkParser implements IParser {
-public abstract class RoleInstanceSpecificationLinkParser implements IParser {
-
- protected static final String UNSPECIFIED_LABEL = "<UNSPECIFIED>";
+ protected static final String UNSPECIFIED_LABEL = "<UNSPECIFIED>"; //$NON-NLS-1$
public RoleInstanceSpecificationLinkParser() {
}
@@ -45,13 +41,11 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
@Override
public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
- // TODO Auto-generated method stub
return null;
}
@Override
public ICommand getParseCommand(IAdaptable element, String newString, int flags) {
- // TODO Auto-generated method stub
return null;
}
@@ -62,18 +56,14 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
@Override
public boolean isAffectingEvent(Object event, int flags) {
- // TODO Auto-generated method stub
return false;
}
@Override
public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
- // TODO Auto-generated method stub
return null;
}
- protected abstract ClassifierMemberKind getClissifierMemberKind();
-
private String getPrintString(IAdaptable element) {
String namedNodeType = getNamedNodeType(element);
return (namedNodeType == null || namedNodeType.isEmpty()) ? UNSPECIFIED_LABEL : namedNodeType;
@@ -81,37 +71,6 @@ public abstract class RoleInstanceSpecificationLinkParser implements IParser {
private String getNamedNodeType(IAdaptable element) {
InstanceSpecification instanceSpecification = ((InstanceSpecification) ((EObjectAdapter) element).getRealObject());
- if (instanceSpecification.getClassifiers().size() <= 0) {
- return null;
- }
- Classifier classifier = instanceSpecification.getClassifiers().get(0);
- if (classifier.getMembers().size() < 2) {
- return null;
- }
- NamedElement namedElement = getClissifierMemberKind().extractNamedElement(classifier);
- if (namedElement == null) {
- return null;
- }
- if (!(namedElement instanceof Property)) {
- return null;
- }
- return ((Property) namedElement).getName();
- }
-
- public static enum ClassifierMemberKind {
- SOURCE(1), TARGET(0), UNKNOWN(-1);
-
- private final int myIndex;
-
- private ClassifierMemberKind(int index) {
- myIndex = index;
- }
-
- public NamedElement extractNamedElement(Classifier classifier) {
- if (myIndex < 0) {
- return null;
- }
- return classifier.getMembers().get(myIndex);
- }
+ return instanceSpecification.getName();
}
}

Back to the top