/*****************************************************************************
* 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.edit.parts;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.tools.DirectEditManager;
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.IParser;
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.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.FillStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.GradientData;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
import org.eclipse.papyrus.uml.diagram.sequence.apex.edit.policies.ApexCombinedFragmentResizableShapeEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.apex.util.LifelineFigureHelper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.figures.CombinedFragmentFigure;
import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.uml2.uml.CombinedFragment;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.InteractionOperatorKind;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.UMLPackage;
/**
* @generated
*/
public class CombinedFragmentEditPart extends InteractionFragmentEditPart implements ITextAwareEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 3004;
/**
* Title for dialog of bloc operator modification error
*/
private static final String FORBIDDEN_ACTION = "Forbidden action"; //$NON-NLS-1$
/**
* Message for dialog of block operator modification
*/
private static final String BLOCK_OPERATOR_MODIFICATION_MSG = "It's impossible to change the operator kind of the combined fragment\nbecause the combined fragment has more than one operand"; //$NON-NLS-1$
/**
* Message for dialog of block forbidden operator modification
*/
private static final String FORBIDEN_OPERATOR_MODIFICATION_MSG = "It's impossible to configure combined fragment as consider or ignore.\nUse ConsiderIgnoreFragment instead"; //$NON-NLS-1$
/**
* Message for dialog of block forbidden operand addition
*/
private static final String BLOCK_OPERAND_ADDITION_MSG = "It's impossible to add more than one operand on opt, loop, break, neg combined fragment"; //$NON-NLS-1$
/**
* @generated
*/
protected IFigure contentPane;
/**
* @generated
*/
protected IFigure primaryShape;
/**
* @generated
*/
public CombinedFragmentEditPart(View view) {
super(view);
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CombinedFragmentItemSemanticEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new CombinedFragmentItemComponentEditPolicy());
installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new SequenceGraphicalNodeEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new CombinedFragmentDirectEditPolicy());
}
/**
* @generated
*/
protected LayoutEditPolicy createLayoutEditPolicy() {
org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
protected EditPolicy createChildEditPolicy(EditPart child) {
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
if(result == null) {
result = new NonResizableEditPolicy();
}
return result;
}
protected Command getMoveChildrenCommand(Request request) {
return null;
}
protected Command getCreateCommand(CreateRequest request) {
return null;
}
};
return lep;
}
/**
* apex added
*
* @Override
*/
public EditPolicy getPrimaryDragEditPolicy() {
EditPolicy result = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
return result != null ? result : new ApexCombinedFragmentResizableShapeEditPolicy(PositionConstants.NORTH_SOUTH, PositionConstants.NSEW);
}
/**
* Generated not for handle operator kind
*
* @generated NOT
*/
protected IFigure createNodeShape() {
primaryShape = new CombinedFragmentFigure();
updateHeaderLabel();
return primaryShape;
}
/**
* @generated
*/
public CombinedFragmentFigure getPrimaryShape() {
return (CombinedFragmentFigure)primaryShape;
}
/**
* @generated
*/
protected boolean addFixedChild(EditPart childEditPart) {
if(childEditPart instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
IFigure pane = getPrimaryShape().getCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.add(((CombinedFragmentCombinedFragmentCompartmentEditPart)childEditPart).getFigure());
return true;
}
return false;
}
/**
* @generated
*/
protected boolean removeFixedChild(EditPart childEditPart) {
if(childEditPart instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
IFigure pane = getPrimaryShape().getCompartmentFigure();
setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
pane.remove(((CombinedFragmentCombinedFragmentCompartmentEditPart)childEditPart).getFigure());
return true;
}
return false;
}
/**
* @generated
*/
protected void addChildVisual(EditPart childEditPart, int index) {
if(addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, -1);
}
/**
* @generated
*/
protected void removeChildVisual(EditPart childEditPart) {
if(removeFixedChild(childEditPart)) {
return;
}
super.removeChildVisual(childEditPart);
}
/**
* @generated
*/
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
if(editPart instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
return getPrimaryShape().getCompartmentFigure();
}
return getContentPane();
}
/**
* @generated
*/
protected NodeFigure createNodePlate() {
String prefElementId = "CombinedFragment";
IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)) ;
return result;
}
/**
* Creates figure for this edit part.
*
* Body of this method does not depend on settings in generation model so you may safely remove
* <i>generated</i> tag and modify it.
*
* @generated
*/
protected NodeFigure createNodeFigure() {
NodeFigure figure = createNodePlate();
figure.setLayoutManager(new StackLayout());
IFigure shape = createNodeShape();
figure.add(shape);
contentPane = setupContentPane(shape);
return figure;
}
/**
* Default implementation treats passed figure as content pane. Respects layout one may have set
* for generated figure.
*
* @param nodeShape
* instance of generated figure class
* @generated
*/
protected IFigure setupContentPane(IFigure nodeShape) {
if(nodeShape.getLayoutManager() == null) {
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(5);
nodeShape.setLayoutManager(layout);
}
return nodeShape; // use nodeShape itself as contentPane
}
/**
* @generated
*/
public IFigure getContentPane() {
if(contentPane != null) {
return contentPane;
}
return super.getContentPane();
}
/**
* @generated
*/
protected void setForegroundColor(Color color) {
if(primaryShape != null) {
primaryShape.setForegroundColor(color);
}
}
/**
* @generated NOT
*/
protected void setLineWidth(int width) {
if(primaryShape instanceof NodeFigure){
((NodeFigure)primaryShape).setLineWidth(width);
}else if(primaryShape instanceof Shape) {
((Shape)primaryShape).setLineWidth(width);
}
}
/**
* @generated
*/
protected void setLineType(int style) {
if(primaryShape instanceof Shape) {
((Shape)primaryShape).setLineStyle(style);
}
}
/**
* @generated
*/
@Override
public Object getPreferredValue(EStructuralFeature feature) {
IPreferenceStore preferenceStore = (IPreferenceStore)getDiagramPreferencesHint().getPreferenceStore();
Object result = null;
if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
String prefColor = null;
if(feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
prefColor = PreferenceConstantHelper.getElementConstant("CombinedFragment", PreferenceConstantHelper.COLOR_LINE);
} else if(feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) {
prefColor = PreferenceConstantHelper.getElementConstant("CombinedFragment", PreferenceConstantHelper.COLOR_FONT);
} else if(feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) {
prefColor = PreferenceConstantHelper.getElementConstant("CombinedFragment", PreferenceConstantHelper.COLOR_FILL);
}
result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor((IPreferenceStore)preferenceStore, prefColor));
} else if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
String prefGradient = PreferenceConstantHelper.getElementConstant("CombinedFragment", PreferenceConstantHelper.COLOR_GRADIENT);
GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceStore.getString(prefGradient));
if(feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) {
result = new Integer(gradientPreferenceConverter.getTransparency());
} else if(feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) {
result = gradientPreferenceConverter.getGradientData();
}
}
if(result == null) {
result = getStructuralFeatureValue(feature);
}
return result;
}
/**
* @generated
*/
public List<IElementType> getMARelTypesOnSource() {
ArrayList<IElementType> types = new ArrayList<IElementType>(7);
types.add(UMLElementTypes.Message_4003);
types.add(UMLElementTypes.Message_4004);
types.add(UMLElementTypes.Message_4005);
types.add(UMLElementTypes.Message_4006);
types.add(UMLElementTypes.Message_4007);
types.add(UMLElementTypes.Message_4008);
types.add(UMLElementTypes.Message_4009);
return types;
}
/**
* @generated
*/
public List<IElementType> getMARelTypesOnSourceAndTarget(IGraphicalEditPart targetEditPart) {
LinkedList<IElementType> types = new LinkedList<IElementType>();
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4003);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4004);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4005);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4006);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4007);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4008);
}
if(targetEditPart instanceof InteractionEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof ConsiderIgnoreFragmentEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof InteractionOperandEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof InteractionUseEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof ContinuationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof LifelineEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof ActionExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof BehaviorExecutionSpecificationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof StateInvariantEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof CombinedFragment2EditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof TimeConstraintEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof TimeObservationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof DurationConstraintEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof DestructionOccurrenceSpecificationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof ConstraintEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof CommentEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof DurationConstraintInMessageEditPart) {
types.add(UMLElementTypes.Message_4009);
}
if(targetEditPart instanceof DurationObservationEditPart) {
types.add(UMLElementTypes.Message_4009);
}
return types;
}
/**
* @generated
*/
public List<IElementType> getMATypesForTarget(IElementType relationshipType) {
LinkedList<IElementType> types = new LinkedList<IElementType>();
if(relationshipType == UMLElementTypes.Message_4003) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4004) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4005) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4006) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4007) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4008) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4009) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
}
return types;
}
/**
* @generated
*/
public List<IElementType> getMARelTypesOnTarget() {
ArrayList<IElementType> types = new ArrayList<IElementType>(9);
types.add(UMLElementTypes.Message_4003);
types.add(UMLElementTypes.Message_4004);
types.add(UMLElementTypes.Message_4005);
types.add(UMLElementTypes.Message_4006);
types.add(UMLElementTypes.Message_4007);
types.add(UMLElementTypes.Message_4008);
types.add(UMLElementTypes.Message_4009);
types.add(UMLElementTypes.CommentAnnotatedElement_4010);
types.add(UMLElementTypes.ConstraintConstrainedElement_4011);
return types;
}
/**
* @generated
*/
public List<IElementType> getMATypesForSource(IElementType relationshipType) {
LinkedList<IElementType> types = new LinkedList<IElementType>();
if(relationshipType == UMLElementTypes.Message_4003) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4004) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4005) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4006) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4007) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4008) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.Message_4009) {
types.add(UMLElementTypes.Interaction_2001);
types.add(UMLElementTypes.ConsiderIgnoreFragment_3007);
types.add(UMLElementTypes.CombinedFragment_3004);
types.add(UMLElementTypes.InteractionOperand_3005);
types.add(UMLElementTypes.InteractionUse_3002);
types.add(UMLElementTypes.Continuation_3016);
types.add(UMLElementTypes.Lifeline_3001);
types.add(UMLElementTypes.ActionExecutionSpecification_3006);
types.add(UMLElementTypes.BehaviorExecutionSpecification_3003);
types.add(UMLElementTypes.StateInvariant_3017);
types.add(UMLElementTypes.CombinedFragment_3018);
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.TimeObservation_3020);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.DestructionOccurrenceSpecification_3022);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.Comment_3009);
types.add(UMLElementTypes.DurationConstraint_3023);
types.add(UMLElementTypes.DurationObservation_3024);
} else if(relationshipType == UMLElementTypes.CommentAnnotatedElement_4010) {
types.add(UMLElementTypes.Comment_3009);
} else if(relationshipType == UMLElementTypes.ConstraintConstrainedElement_4011) {
types.add(UMLElementTypes.TimeConstraint_3019);
types.add(UMLElementTypes.DurationConstraint_3021);
types.add(UMLElementTypes.Constraint_3008);
types.add(UMLElementTypes.DurationConstraint_3023);
}
return types;
}
/**
* @generated
*/
public EditPart getTargetEditPart(Request request) {
if(request instanceof CreateViewAndElementRequest) {
CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
IElementType type = (IElementType)adapter.getAdapter(IElementType.class);
if(type == UMLElementTypes.InteractionOperand_3005) {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID));
}
}
return super.getTargetEditPart(request);
}
public List<InteractionOperandEditPart> getOperandChildrenEditParts() {
List<InteractionOperandEditPart> children = new LinkedList<InteractionOperandEditPart>();
IGraphicalEditPart compartment = getChildBySemanticHint(String.valueOf(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID));
if(compartment instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
for(Object ep : compartment.getChildren()) {
if(ep instanceof InteractionOperandEditPart) {
children.add((InteractionOperandEditPart)ep);
}
}
}
return children;
}
/**
* apex updated
*
* Handle for interaction operator, operator kind and covered lifelines
*/
protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
if(UMLPackage.eINSTANCE.getCombinedFragment_InteractionOperator().equals(feature)) {
CombinedFragment combinedFragment = (CombinedFragment)resolveSemanticElement();
String newStringValue = notification.getNewStringValue();
if(notification.getOldValue() instanceof InteractionOperatorKind && !isAllowedInteractionOperator(newStringValue)) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, FORBIDEN_OPERATOR_MODIFICATION_MSG);
CommandHelper.executeCommandWithoutHistory(getEditingDomain(), SetCommand.create(getEditingDomain(), combinedFragment, feature, notification.getOldValue()), true);
return;
}
EList<InteractionOperand> operands = combinedFragment.getOperands();
if (operands == null || operands.size() <= 1) {
// If CombinedFragment have no operand, we can change the
// OperatorKind
updateHeaderLabel();
} else {
if (notification.getOldValue() instanceof InteractionOperatorKind) {
InteractionOperatorKind newValue = (InteractionOperatorKind) notification
.getNewValue();
if (!InteractionOperatorKindCompatibleMapping
.supportMultiOperand(newValue)) {
MessageDialog.openError(Display.getCurrent()
.getActiveShell(), FORBIDDEN_ACTION,
BLOCK_OPERATOR_MODIFICATION_MSG);
CommandHelper.executeCommandWithoutHistory(
getEditingDomain(), SetCommand.create(
getEditingDomain(), combinedFragment,
feature, notification.getOldValue()), true);
} else {
updateHeaderLabel();
}
}
}
/*else if(notification.getOldValue() instanceof InteractionOperatorKind && !newStringValue.equals(getPrimaryShape().getHeaderLabel().getText())) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, BLOCK_OPERATOR_MODIFICATION_MSG);
CommandHelper.executeCommandWithoutHistory(getEditingDomain(), SetCommand.create(getEditingDomain(), combinedFragment, feature, notification.getOldValue()));
return;
}*/
// update guards on enclosed operands
for(InteractionOperandEditPart ioep : getOperandChildrenEditParts()) {
ioep.getPrimaryShape().updateConstraintLabel();
}
} else if(UMLPackage.eINSTANCE.getCombinedFragment_Operand().equals(feature)) {
// Case only call by the model explorer
CombinedFragment combinedFragment = (CombinedFragment)resolveSemanticElement();
InteractionOperatorKind interactionOperator = combinedFragment.getInteractionOperator();
Object newValue = notification.getNewValue();
if(interactionOperator != null && newValue != null) {
if(InteractionOperatorKind.OPT_LITERAL.equals(interactionOperator) || InteractionOperatorKind.LOOP_LITERAL.equals(interactionOperator) || InteractionOperatorKind.BREAK_LITERAL.equals(interactionOperator) || InteractionOperatorKind.NEG_LITERAL.equals(interactionOperator)) {
EList<InteractionOperand> operands = combinedFragment.getOperands();
if(operands != null && operands.size() > 1) {
// Case of there is already an operand on opt, loop, break and neg
// CombinedFragment type
MessageDialog.openError(Display.getCurrent().getActiveShell(), FORBIDDEN_ACTION, BLOCK_OPERAND_ADDITION_MSG);
CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), combinedFragment, feature, newValue), true);
return;
}
}
}
} else if(UMLPackage.eINSTANCE.getInteractionFragment_Covered().equals(feature)) {
if(notification.getNotifier() instanceof CombinedFragment) {
// Synchronize operands' covered lifelines with combined fragment's covered lifelines
CombinedFragment combinedFragment = (CombinedFragment)notification.getNotifier();
EList<Lifeline> combinedFragmentCoveredLifelines = combinedFragment.getCovereds();
for(InteractionOperand operand : combinedFragment.getOperands()) {
EList<Lifeline> operandCoveredLifelines = operand.getCovereds();
if(!operandCoveredLifelines.equals(combinedFragmentCoveredLifelines)) {
// Add new covered lifelines (not already covered)
List<Lifeline> coveredLifelinesToAdd = new ArrayList<Lifeline>(combinedFragmentCoveredLifelines);
coveredLifelinesToAdd.removeAll(operandCoveredLifelines);
if(!coveredLifelinesToAdd.isEmpty()) {
CommandHelper.executeCommandWithoutHistory(getEditingDomain(), AddCommand.create(getEditingDomain(), operand, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToAdd),true);
}
// Delete old covered lifelines (not covered anymore)
List<Lifeline> coveredLifelinesToRemove = new ArrayList<Lifeline>(operandCoveredLifelines);
coveredLifelinesToRemove.removeAll(combinedFragmentCoveredLifelines);
if(!coveredLifelinesToRemove.isEmpty()) {
CommandHelper.executeCommandWithoutHistory(getEditingDomain(), RemoveCommand.create(getEditingDomain(), operand, UMLPackage.eINSTANCE.getInteractionFragment_Covered(), coveredLifelinesToRemove),true);
}
}
}
/* apex added start
View view = getNotationView();
Rectangle newRect = null;
if (view instanceof Node) {
LayoutConstraint constraint = ((Node)view).getLayoutConstraint();
if (constraint instanceof Bounds) {
Bounds b = (Bounds)constraint;
newRect = new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight());
}
}
List<Object> newValues = new ArrayList<Object>();
Object newValue = notification.getNewValue();
if (newValue instanceof Collection) {
newValues.addAll((Collection<? extends Object>) newValue);
} else if (newValue != null) {
newValues.add(newValue);
}
for (Object value : newValues) {
if ((value instanceof Lifeline) == false) {
continue;
}
Lifeline lifeline = (Lifeline)value;
LifelineEditPart lifelineEP = (LifelineEditPart)SequenceUtil.getEditPart(this, lifeline, LifelineEditPart.class);
if (lifelineEP != null) {
IFigure dotLineFigure = lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure();
LifelineFigureHelper.showRegion(dotLineFigure, newRect);
}
}
if (notification.getOldValue() instanceof Lifeline) {
Lifeline lifeline = (Lifeline)notification.getOldValue();
LifelineEditPart lifelineEP = (LifelineEditPart)SequenceUtil.getEditPart(this, lifeline, LifelineEditPart.class);
if (lifelineEP != null) {
IFigure figure = getFigure();
Rectangle origRect = figure.getBounds().getCopy();
boolean isShow = ApexSequenceUtil.apexGetPositionallyCoveredLifelineEditParts(origRect, this).contains(lifelineEP)
&& !ApexSequenceUtil.apexGetPositionallyCoveredLifelineEditParts(newRect, this).contains(lifelineEP);
if ((origRect.width > 0 || origRect.height > 0) && isShow) {
newRect = origRect;
}
IFigure dotLineFigure = lifelineEP.getPrimaryShape().getFigureLifelineDotLineFigure();
LifelineFigureHelper.showRegion(dotLineFigure, newRect, isShow);
}
}
/* apex added end */
}
} else if(UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature)) {
if(notification.getNotifier() instanceof CombinedFragment) {
refreshLabel();
}
}
super.handleNotificationEvent(notification);
/* apex improved start */
//fixed bug (id=364711) when bounds changed update coveredBys with the figure's bounds.
if (notification.getNotifier() instanceof Bounds) {
final Bounds newBounds = (Bounds)notification.getNotifier();
updateCoveredLifelines(newBounds);
/*8
System.out
.println("CombinedFragmentEditPart.handleNotificationEvent(), line : "
+ Thread.currentThread().getStackTrace()[1]
.getLineNumber());
System.out.println("newBounds : " + newBounds);
Rectangle rect = new Rectangle(newBounds.getX(),
newBounds.getY(),
newBounds.getWidth(),
newBounds.getHeight());
System.out.println("rect before abs : " + rect);
figure.translateToAbsolute(rect);
System.out.println("rect after abs : " + rect);
figure.translateToRelative(rect);
System.out.println("rect after rel : " + rect);
figure.translateToParent(rect);
System.out.println("rect after toParent: " + rect);
figure.translateFromParent(rect);
System.out.println("rect from toParent : " + rect);
System.out.println("figure.getBounds() : " + figure.getBounds().getCopy());
//*/
// 아래 로직은 Lifeline의 경계 변경 시 해당 lifeline의 coveredBy를 수정하는 것으로
// LifelineEditPart.handleNotification()에서 호출되어 수행되므로 제외처리
// CombinedFragment의 경계 변경에 따른 해당 lifeline의 coveredBy는
// CombinedFragment의 covered에 의한 notification에 따라 맞게 수정됨
/* apex replaced
Display.getDefault().asyncExec(new Runnable() {
public void run() {
LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater();
updater.update(CombinedFragmentEditPart.this);
}
});
//*/
}
/* apex improved end */
/* apex replaced
//fixed bug (id=364711) when bounds changed update coveredBys with the figure's bounds.
if (notification.getNotifier() instanceof Bounds) {
if (notification.getNotifier() instanceof Bounds) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
LifelineCoveredByUpdater updater = new LifelineCoveredByUpdater();
updater.update(CombinedFragmentEditPart.this);
}
});
}
}
*/
if((getModel() != null) && (getModel() == notification.getNotifier())) {
if(NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) {
refreshLineWidth();
}
}
if(resolveSemanticElement() != null) {
refreshShadow();
}
}
/**
* apex updated
*/
@SuppressWarnings("deprecation")
protected void refreshShadow() {
/* apex improved start */
getPrimaryShape().setShadow(AppearanceHelper.showShadow(getNotationView()));
/* apex improved end */
/* apex replaced
getPrimaryShape().setShadow(ShadowFigureHelper.getShadowFigureValue((View)getModel()));
*/
}
/**
* Override to set the transparency to the correct figure
*/
@Override
protected void setTransparency(int transp) {
getPrimaryShape().setTransparency(transp);
}
/**
* Override to set the gradient data to the correct figure
*/
@Override
protected void setGradient(GradientData gradient) {
IPapyrusNodeFigure fig = getPrimaryShape();
FillStyle style = (FillStyle)getPrimaryView().getStyle(NotationPackage.Literals.FILL_STYLE);
if(gradient != null) {
fig.setIsUsingGradient(true);;
fig.setGradientData(style.getFillColor(), gradient.getGradientColor1(), gradient.getGradientStyle());
} else {
fig.setIsUsingGradient(false);
}
}
public boolean supportsGradient() {
return true;
}
protected void setBackgroundColor(Color c) {
PapyrusNodeFigure fig = getPrimaryShape();
fig.setBackgroundColor(c);
fig.setIsUsingGradient(false);
fig.setGradientData(-1, -1, 0);
}
/**
* Update header label
*/
protected void updateHeaderLabel() {
Object element = resolveSemanticElement();
if(element instanceof CombinedFragment) {
CombinedFragment combinedFragment = (CombinedFragment)element;
String operatorKind = combinedFragment.getInteractionOperator().getName();
getPrimaryShape().getHeaderLabel().setText(operatorKind);
}
}
/**
* Return true if the InteractionOperatorKind is allowed
*
* @param interactionOperatorLiteral
* The InteractionOperator to test
* @return true if allowed
*/
protected boolean isAllowedInteractionOperator(String interactionOperatorLiteral) {
return !(InteractionOperatorKind.CONSIDER_LITERAL.getLiteral().equals(interactionOperatorLiteral) || InteractionOperatorKind.IGNORE_LITERAL.getLiteral().equals(interactionOperatorLiteral));
}
IEclipsePreferences.IPreferenceChangeListener propertyListener;
@Override
protected void addNotationalListeners() {
super.addNotationalListeners();
if(this.propertyListener == null){
this.propertyListener = new IEclipsePreferences.IPreferenceChangeListener() {
public void preferenceChange(PreferenceChangeEvent event) {
handlePreferenceChange(event);
}
};
InstanceScope.INSTANCE.getNode("org.eclipse.papyrus.infra.gmfdiag.preferences").addPreferenceChangeListener(this.propertyListener);
}
}
protected void handlePreferenceChange(PreferenceChangeEvent event) {
if(getParent() == null)
return;
String key = event.getKey();
if(key.equals(getTitlePreferenceKey()))
refreshLabel();
}
public String getTitlePreferenceKey(){
return "ELEMENT_PapyrusUMLSequenceDiagram_CombinedFragment_CombinedFragmentCompartment.compartment_name.visibility";
}
public WrappingLabel getTitleLabel(){
return getPrimaryShape().getTitleLabel();
}
@Override
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
}
// update label visibility and text
private void refreshLabel() {
Object element = resolveSemanticElement();
if(element instanceof CombinedFragment) {
CombinedFragment combinedFragment = (CombinedFragment)element;
String name = combinedFragment.getName();
WrappingLabel label = getPrimaryShape().getTitleLabel();
label.setText(name);
ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.papyrus.infra.gmfdiag.preferences");
String visible = store.getString(getTitlePreferenceKey());
label.setVisible("true".equals(visible) );
}
}
private DirectEditManager manager;
private IParser parser;
protected DirectEditManager getManager() {
if(manager == null) {
WrappingLabel label = this.getPrimaryShape().getTitleLabel();
manager = new TextDirectEditManager(this, TextCellEditorEx.class, new UMLEditPartFactory.TextCellEditorLocator(label){
public void relocate(CellEditor celleditor) {
Text text = (Text)celleditor.getControl();
Rectangle rect = getWrapLabel().getBounds().getCopy();
getWrapLabel().translateToAbsolute(rect);
Point right = rect.getRight();
if(!text.getFont().isDisposed()) {
if(getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
} else {
int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
}
if(rect.getRight().x > right.x){ // should not exceed right border
rect.translate(right.x - rect.getRight().x, 0);
}
}
if(!rect.equals(new Rectangle(text.getBounds()))) {
text.setBounds(rect.x, rect.y, rect.width, rect.height);
}
}
});
}
return manager;
}
protected void performDirectEditRequest(Request request) {
if(request instanceof DirectEditRequest){
WrappingLabel label = getPrimaryShape().getTitleLabel();
Point location = ((DirectEditRequest)request).getLocation().getCopy();
label.translateToRelative(location); // convert request location to relative
if(label.containsPoint(location)) // check if mouse click on label
getManager().show();
}
}
protected EObject getParserElement() {
return resolveSemanticElement();
}
public IParser getParser() {
if(parser == null) {
parser = new CombinedFragmentTitleParser();
}
return parser;
}
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
public IContentAssistProcessor getCompletionProcessor() {
if(getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
}
public String getEditText() {
if(getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
}
public void setLabelText(String text) {
WrappingLabel label = this.getPrimaryShape().getTitleLabel();
label.setText(text);
}
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
public String isValid(final Object value) {
if(value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
if(element != null && parser != null){
try {
IParserEditStatus valid = (IParserEditStatus)getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
public void run() {
setResult(parser.isValidEditString(new EObjectAdapter(element), (String)value));
}
});
return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
} catch (InterruptedException ie) {
}
}
}
return null;
}
};
}
class CombinedFragmentDirectEditPolicy extends DirectEditPolicy{
@Override
protected Command getDirectEditCommand(DirectEditRequest edit) {
String labelText = (String) edit.getCellEditor().getValue();
//for CellEditor, null is always returned for invalid values
if (labelText == null) {
return null;
}
ITextAwareEditPart compartment = (ITextAwareEditPart) getHost();
EObject model = (EObject)compartment.getModel();
EObjectAdapter elementAdapter = null ;
if (model instanceof View) {
View view = (View)model;
elementAdapter = new EObjectAdapterEx(ViewUtil.resolveSemanticElement(view),
view);
}
else
elementAdapter = new EObjectAdapterEx(model, null);
String prevText = compartment.getParser().getEditString(elementAdapter,
compartment.getParserOptions().intValue());
// check to make sure an edit has occurred before returning a command.
if (!prevText.equals(labelText)) {
ICommand iCommand =
compartment.getParser().getParseCommand(elementAdapter, labelText, 0);
return new ICommandProxy(iCommand);
}
return null;
}
@Override
protected void showCurrentEditValue(DirectEditRequest request) {
String value = (String) request.getCellEditor().getValue();
WrappingLabel label = getPrimaryShape().getTitleLabel();
label.setText(value);
}
}
static class CombinedFragmentTitleParser extends MessageFormatParser implements ISemanticParser {
public CombinedFragmentTitleParser() {
super(new EAttribute[]{ UMLPackage.eINSTANCE.getNamedElement_Name()});
}
public List getSemanticElementsBeingParsed(EObject element) {
List<Element> semanticElementsBeingParsed = new ArrayList<Element>();
if(element instanceof CombinedFragment) {
CombinedFragment cf = (CombinedFragment)element;
semanticElementsBeingParsed.add(cf);
}
return semanticElementsBeingParsed;
}
public boolean areSemanticElementsAffected(EObject listener, Object notification) {
EStructuralFeature feature = getEStructuralFeature(notification);
return isValidFeature(feature);
}
public boolean isAffectingEvent(Object event, int flags) {
EStructuralFeature feature = getEStructuralFeature(event);
return isValidFeature(feature);
}
public String getPrintString(IAdaptable element, int flags) {
Object adapter = element.getAdapter(EObject.class);
if(adapter instanceof CombinedFragment) {
CombinedFragment cf = (CombinedFragment)adapter;
return cf.getName();
}
return "";
}
@Override
public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
return ParserEditStatus.EDITABLE_STATUS;
}
@Override
public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
EObject element = (EObject)adapter.getAdapter(EObject.class);
TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
if(editingDomain == null || !(element instanceof CombinedFragment )) {
return UnexecutableCommand.INSTANCE;
}
SetRequest request = new SetRequest(element, UMLPackage.eINSTANCE.getNamedElement_Name(), newString);
return new SetValueCommand(request);
}
@Override
public String getEditString(IAdaptable element, int flags) {
Object adapter = element.getAdapter(EObject.class);
if(adapter instanceof CombinedFragment) {
CombinedFragment cf = (CombinedFragment)adapter;
return cf.getName();
}
return "";
}
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;
}
private boolean isValidFeature(EStructuralFeature feature) {
return UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature);
}
}
static class EObjectAdapterEx extends EObjectAdapter {
private View view = null;
/**
* constructor
* @param element element to be wrapped
* @param view view to be wrapped
*/
public EObjectAdapterEx(EObject element, View view) {
super(element);
this.view = view;
}
public Object getAdapter(Class adapter) {
Object o = super.getAdapter(adapter);
if (o != null)
return o;
if (adapter.equals(View.class)) {
return view;
}
return null;
}
}
}