Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom')
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java120
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java146
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java198
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java111
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java273
-rw-r--r--deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java122
6 files changed, 0 insertions, 970 deletions
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java
deleted file mode 100644
index 9d3e75c3a76..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/DurationObservationParser.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-/**
- * Specific Parser for the DurationObservation.
- */
-public class DurationObservationParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a line break */
- private static final String LINE_BREAK = System.getProperty("line.separator");
-
- public DurationObservationParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public DurationObservationParser(EAttribute[] features) {
- super(features);
- }
-
- public DurationObservationParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- Object adapter = element.getAdapter(EObject.class);
- if(adapter instanceof DurationObservation) {
- return DurationObservationHelper.getLabelString((DurationObservation)adapter);
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof DurationObservation) {
- DurationObservation observation = (DurationObservation)element;
- semanticElementsBeingParsed.add(observation);
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getMessage_SendEvent().equals(feature) || UMLPackage.eINSTANCE.getMessage_ReceiveEvent().equals(feature) || UMLPackage.eINSTANCE.getDurationObservation_Event().equals(feature);
- }
-
-}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java
deleted file mode 100644
index 0eb25997237..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/InteractionUseCustomParsers.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * A specific parser for the InteractionUse. This parser of refreshing the text displayed by the
- * InteractionUse.
- */
-public class InteractionUseCustomParsers extends MessageFormatParser implements ISemanticParser {
-
- public InteractionUseCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public InteractionUseCustomParsers(EAttribute[] features) {
- super(features);
- }
-
- public InteractionUseCustomParsers() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
-
- }
- }
- return featureImpl;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.AbstractParser#isAffectingEvent(java.lang.Object
- * , int)
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse
- * .core.runtime.IAdaptable, int)
- */
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
-
- if(obj instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse)obj;
- Interaction interaction = interactionUse.getRefersTo();
-
- if(interaction != null) {
- String interactionName = interaction.getName();
- if(interactionName != null) {
- sb.append(interaction.getName());
- }
- }
- }
- return sb.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected
- * (org.eclipse.emf.ecore.EObject, java.lang.Object)
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed
- * (org.eclipse.emf.ecore.EObject)
- */
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof InteractionUse) {
- InteractionUse interactionUse = (InteractionUse)element;
- semanticElementsBeingParsed.add(interactionUse);
-
- Interaction interaction = interactionUse.getRefersTo();
- if(interaction != null) {
- // Add the interaction refered.
- semanticElementsBeingParsed.add(interaction);
-
- // TODO : Collaboration and interactionUse
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature);
- }
-
-}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java
deleted file mode 100644
index e4ad3e6508e..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/LifelineCustomParsers.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Expression;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.LiteralSpecification;
-import org.eclipse.uml2.uml.OpaqueExpression;
-import org.eclipse.uml2.uml.PartDecomposition;
-import org.eclipse.uml2.uml.TimeExpression;
-import org.eclipse.uml2.uml.Type;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * A specific parser for the Lifeline header. This parser of refreshing the text displayed by the
- * lifeline.
- */
-public class LifelineCustomParsers extends MessageFormatParser implements ISemanticParser {
-
- public LifelineCustomParsers(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public LifelineCustomParsers(EAttribute[] features) {
- super(features);
- }
-
- public LifelineCustomParsers() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * Information identifying the lifeline displayed inside the rectangle
- *
- * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#getPrintString(org.eclipse.core.runtime.IAdaptable, int)
- */
- public String getPrintString(IAdaptable element, int flags) {
- Object obj = element.getAdapter(EObject.class);
- StringBuffer sb = new StringBuffer();
-
- if(obj instanceof Lifeline) {
- Lifeline lifeline = (Lifeline)obj;
- ConnectableElement connectableElement = lifeline.getRepresents();
- ValueSpecification selector = lifeline.getSelector();
-
- if(connectableElement != null) {
- // Add ConnectableElement Name
- String connectableElementName = connectableElement.getName();
- if(connectableElementName != null) {
- sb.append(connectableElementName);
- }
-
- // Add the selector if it is a LiteralSpecification
- if(selector instanceof LiteralSpecification) {
- sb.append("[").append(ValueSpecificationUtil.getSpecificationValue(selector)).append("]");
- }
-
- // Add the type name
- Type type = connectableElement.getType();
- if(type != null && type.getName() != null && type.getName().length() > 0) {
- sb.append(" : ").append(type.getName());
- }
- }
-
- // Add the selector if it is an Expression
- if(selector instanceof Expression || selector instanceof OpaqueExpression || selector instanceof TimeExpression) {
- String specificationValue = ValueSpecificationUtil.getSpecificationValue(selector);
- if(specificationValue != null && specificationValue.length() > 0) {
- sb.append("\n").append(specificationValue);
- }
- }
-
- // Add the decomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if(partDecomposition != null) {
- Interaction refersTo = partDecomposition.getRefersTo();
- if(refersTo != null) {
- sb.append("\nref ").append(refersTo.getName());
- }
- }
-
- // LifelineIndent cannot be empty so if the stringBuffer is empty we add the name of the
- // lifeline
- // This case occurs when creating the lifeline for example
- if(sb.length() == 0) {
- sb.append(lifeline.getName());
- }
- }
-
- return sb.toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#areSemanticElementsAffected
- * (org.eclipse.emf.ecore.EObject, java.lang.Object)
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser#getSemanticElementsBeingParsed
- * (org.eclipse.emf.ecore.EObject)
- */
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof Lifeline) {
- Lifeline lifeline = (Lifeline)element;
-
- // Add the lifeline
- semanticElementsBeingParsed.add(lifeline);
- // Add the selector
- if(lifeline.getSelector() != null) {
- semanticElementsBeingParsed.add(lifeline.getSelector());
- }
-
- // Add the partDecomposition
- PartDecomposition partDecomposition = lifeline.getDecomposedAs();
- if(partDecomposition != null) {
- semanticElementsBeingParsed.add(partDecomposition);
- // Add the Interaction refered by the partDecomposition
- if(partDecomposition.getRefersTo() != null) {
- semanticElementsBeingParsed.add(partDecomposition.getRefersTo());
- }
- }
-
- // Add the connectableElement and its type if it has any
- ConnectableElement connectableElement = lifeline.getRepresents();
- if(connectableElement != null) {
- semanticElementsBeingParsed.add(connectableElement);
- if(connectableElement.getType() != null) {
- semanticElementsBeingParsed.add(connectableElement.getType());
- }
- }
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getLiteralInteger_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralUnlimitedNatural_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralBoolean_Value().equals(feature) || UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Selector().equals(feature) || UMLPackage.eINSTANCE.getLifeline_DecomposedAs().equals(feature) || UMLPackage.eINSTANCE.getLifeline_Represents().equals(feature) || UMLPackage.eINSTANCE.getInteractionUse_RefersTo().equals(feature);
- }
-}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java
deleted file mode 100644
index 4272425d703..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/MessageCustomParser.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ICustomAppearence;
-import org.eclipse.papyrus.uml.tools.utils.OperationUtil;
-import org.eclipse.papyrus.uml.tools.utils.SignalUtil;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageSort;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Operation;
-import org.eclipse.uml2.uml.Parameter;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Signal;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class MessageCustomParser extends MessageFormatParser implements ISemanticParser {
-
- public MessageCustomParser(EAttribute[] features) {
- super(features);
- }
-
- public MessageCustomParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- public MessageCustomParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- @Override
- public String getPrintString(IAdaptable adapter, int flags) {
- Object obj = adapter.getAdapter(EObject.class);
- String result = null;
-
- if(obj instanceof Message) {
- Message message = (Message)obj;
- NamedElement signature = message.getSignature();
-
- if(signature instanceof Operation) {
- Operation operation = (Operation)signature;
- if(MessageSort.REPLY_LITERAL.equals(message.getMessageSort())) {
- result = OperationUtil.getCustomLabel(operation, ICustomAppearence.DISP_NAME | ICustomAppearence.DISP_RT_TYPE);
- } else if(MessageSort.SYNCH_CALL_LITERAL.equals(message.getMessageSort())) {
- result = OperationUtil.getCustomLabel(operation, ICustomAppearence.DISP_NAME | ICustomAppearence.DISP_PARAMETER_NAME | ICustomAppearence.DISP_PARAMETER_TYPE);
- } else {
- result = OperationUtil.getCustomLabel(operation, ICustomAppearence.DISP_NAME | ICustomAppearence.DISP_PARAMETER_NAME | ICustomAppearence.DISP_PARAMETER_TYPE | ICustomAppearence.DISP_RT_TYPE);
- }
- } else if(signature instanceof Signal) {
- result = SignalUtil.getCustomLabel((Signal)signature, ICustomAppearence.DISP_NAME | ICustomAppearence.DISP_TYPE);
- } else if(signature != null) {
- result = signature.getName();
- }
-
- // If the String is empty, we add the name of the message
- if(result == null || result.equals("")) {
- result = message.getName();
- }
- }
-
- return result;
- }
-
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- return true;
- }
-
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof Message) {
- Message message = (Message)element;
- semanticElementsBeingParsed.add(message);
- NamedElement signature = message.getSignature();
- semanticElementsBeingParsed.add(signature);
-
- if(signature instanceof Operation) {
- for(Parameter parameter : ((Operation)signature).getOwnedParameters()) {
- semanticElementsBeingParsed.add(parameter);
- }
- }
- if(signature instanceof Signal) {
- for(Property property : ((Signal)signature).getOwnedAttributes()) {
- semanticElementsBeingParsed.add(property);
- }
- }
-
- }
- return semanticElementsBeingParsed;
- }
-
-}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java
deleted file mode 100644
index 3a168c29ec6..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeConstraintParser.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.common.helper.DurationConstraintHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Duration;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Interval;
-import org.eclipse.uml2.uml.LiteralInteger;
-import org.eclipse.uml2.uml.LiteralString;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.MessageEnd;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-/**
- * Specific Parser for the TimeConstraint and DurationConstraint.
- */
-public class TimeConstraintParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a line break */
- private static final String LINE_BREAK = System.getProperty("line.separator");
-
- /** The format for displaying time constraint text */
- private static final String FORMAT = "{%s}";
-
- public TimeConstraintParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public TimeConstraintParser(EAttribute[] features) {
- super(features);
- }
-
- public TimeConstraintParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- Object adapter = element.getAdapter(EObject.class);
- if(adapter instanceof TimeConstraint) {
- TimeConstraint constraint = (TimeConstraint)adapter;
- ValueSpecification spec = constraint.getSpecification();
- return String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec));
- } else if(adapter instanceof DurationConstraint) {
- String value = getDurationConstraint((DurationConstraint)adapter);
- return String.format(FORMAT, value);
- } else if(adapter instanceof Message) {
- StringBuffer result = new StringBuffer();
- Message message = (Message)adapter;
- MessageEnd event1 = message.getSendEvent();
- MessageEnd event2 = message.getReceiveEvent();
- List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2);
- for(DurationConstraint constraint : constraints) {
- if(result.length() > 0) {
- result.append(LINE_BREAK);
- }
- ValueSpecification spec = constraint.getSpecification();
- result.append(String.format(FORMAT, ValueSpecificationUtil.getSpecificationValue(spec)));
- }
- return result.toString();
- }
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public List getSemanticElementsBeingParsed(EObject element) {
- HashSet<Element> semanticElementsBeingParsed = new HashSet<Element>();
- if(element instanceof Constraint) {
- Constraint constraint = (Constraint)element;
- ValueSpecificationUtil.addEnclosedValueSpecificationToCollection(constraint.getSpecification(), semanticElementsBeingParsed);
- } else if(element instanceof Message) {
- Message message = (Message)element;
- semanticElementsBeingParsed.add(message);
- MessageEnd event1 = message.getSendEvent();
- semanticElementsBeingParsed.add(event1);
- MessageEnd event2 = message.getReceiveEvent();
- semanticElementsBeingParsed.add(event2);
- List<DurationConstraint> constraints = DurationConstraintHelper.getDurationConstraintsBetween(event1, event2);
- for(DurationConstraint constraint : constraints) {
- semanticElementsBeingParsed.add(constraint);
- // owner for listening DurationConstraint deletion
- semanticElementsBeingParsed.add(constraint.getOwner());
- }
- }
- return new ArrayList(semanticElementsBeingParsed);
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature) || UMLPackage.eINSTANCE.getConstraint_Specification().equals(feature) || ValueSpecification.class.isAssignableFrom(feature.getContainerClass());
- }
-
- @Override
- public String getEditString(IAdaptable adapter, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- if(element instanceof DurationConstraint) {
- return getDurationConstraint((DurationConstraint)element);
- }
- return super.getEditString(adapter, flags);
- }
-
- protected String getDurationConstraint(DurationConstraint constraint) {
- ValueSpecification spec = constraint.getSpecification();
- if(spec instanceof Interval){
- Interval interval = (Interval)spec;
- String min = ValueSpecificationUtil.getSpecificationValue(interval.getMin());
- String max = ValueSpecificationUtil.getSpecificationValue(interval.getMax());
- if(min.equals(max))
- return min;
- }
- String value = ValueSpecificationUtil.getSpecificationValue(spec);
- return value;
- }
-
- public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
- EObject element = (EObject)adapter.getAdapter(EObject.class);
- if(element instanceof DurationConstraint){
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- if(editingDomain == null) {
- return UnexecutableCommand.INSTANCE;
- }
- Object[] values = parseInterval(newString);
- if(values == null || values.length != 2) {
- return UnexecutableCommand.INSTANCE;
- }
- return new UpdateDurationConstraintCommand(editingDomain, (DurationConstraint)element, values[0], values[1] );
- }
- return super.getParseCommand(adapter, newString, flags);
- }
-
- private Object[] parseInterval(String newString) {
- int pos = newString.indexOf("..");
- if(pos > -1){
- String[] part = {newString.substring(0, pos), newString.substring(pos + 2)};
- try {
- int min = Integer.parseInt( part[0].trim());
- int max = Integer.parseInt( part[1].trim());
- return new Integer[]{min, max};
- } catch (Exception e) {
- }
- return part;
- }else{
- try {
- int value = Integer.parseInt(newString);
- return new Integer[]{value, value};
- } catch (Exception e) {
- }
-
- // same value for min and max
- return new String[]{newString, newString};
- }
- }
-
- static class UpdateDurationConstraintCommand extends AbstractTransactionalCommand {
- private DurationConstraint constraint;
- private Object min;
- private Object max;
-
- public UpdateDurationConstraintCommand(TransactionalEditingDomain domain, DurationConstraint constraint, Object min, Object max) {
- super(domain, "Set Values", null);
- this.constraint = constraint;
- this.min = min;
- this.max = max;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ValueSpecification spec = constraint.getSpecification();
- if(spec instanceof Interval){
- Interval interval = (Interval)spec;
- setValue(interval.getMin(), min );
- setValue(interval.getMax(), max );
- }
- return CommandResult.newOKCommandResult();
- }
-
- private void setValue(ValueSpecification spec, Object val) {
- if(spec instanceof Duration){
- Duration dur = (Duration)spec;
- if( dur.getExpr() instanceof LiteralInteger && val instanceof Integer){
- ((LiteralInteger)dur.getExpr()).setValue((Integer)val);
- }else{
- LiteralString str = UMLFactory.eINSTANCE.createLiteralString();
- str.setValue(val.toString());
- dur.setExpr(str);
- }
- }
- }
- }
-
-}
diff --git a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java b/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java
deleted file mode 100644
index 90ea480b526..00000000000
--- a/deprecated/org.eclipse.papyrus.uml.diagram.sequence_initial-kepler/custom-src/org/eclipse/papyrus/uml/diagram/sequence/parser/custom/TimeObservationParser.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.parser.custom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLPackage;
-
-
-/**
- * Specific Parser for the TimeObservation.
- */
-public class TimeObservationParser extends MessageFormatParser implements ISemanticParser {
-
- /** The String for displaying a time observation */
- private static final String FORMAT = "@%s";
-
- public TimeObservationParser() {
- super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name() });
- }
-
- public TimeObservationParser(EAttribute[] features) {
- super(features);
- }
-
- public TimeObservationParser(EAttribute[] features, EAttribute[] editableFeatures) {
- super(features, editableFeatures);
- }
-
- /**
- * Gets the e structural feature.
- *
- * @param notification
- * @return the structural feature
- */
- protected EStructuralFeature getEStructuralFeature(Object notification) {
- EStructuralFeature featureImpl = null;
- if(notification instanceof Notification) {
- Object feature = ((Notification)notification).getFeature();
- if(feature instanceof EStructuralFeature) {
- featureImpl = (EStructuralFeature)feature;
- }
- }
- return featureImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAffectingEvent(Object event, int flags) {
- EStructuralFeature feature = getEStructuralFeature(event);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getPrintString(IAdaptable element, int flags) {
- StringBuffer result = new StringBuffer();
- Object adapter = element.getAdapter(EObject.class);
- if(adapter instanceof TimeObservation) {
- TimeObservation observation = (TimeObservation)adapter;
- if(observation.getName() != null) {
- return String.format(FORMAT, observation.getName());
- }
- }
- return result.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean areSemanticElementsAffected(EObject listener, Object notification) {
- EStructuralFeature feature = getEStructuralFeature(notification);
- return isValidFeature(feature);
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List getSemanticElementsBeingParsed(EObject element) {
- List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
- if(element instanceof TimeObservation) {
- semanticElementsBeingParsed.add((TimeObservation)element);
- }
- return semanticElementsBeingParsed;
- }
-
- /**
- * Determines if the given feature has to be taken into account in this parser
- *
- * @param feature
- * the feature to test
- * @return true if is valid, false otherwise
- */
- private boolean isValidFeature(EStructuralFeature feature) {
- return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
- }
-
-}

Back to the top