Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationBehaviorEditPart.java148
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java612
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomBehaviorExecutionSpecificationEditPart.java342
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java319
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DisplayBehaviorContributionItem.java112
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/BehaviorDisplayHelper.java183
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/ui/DisplayBehaviorSection.xwt11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml4
11 files changed, 1662 insertions, 107 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationBehaviorEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationBehaviorEditPart.java
new file mode 100644
index 00000000000..e719a6342f8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationBehaviorEditPart.java
@@ -0,0 +1,148 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Soyatec - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.VisibilityComponentEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.commands.wrappers.EMFtoGEFCommandWrapper;
+import org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser;
+import org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper;
+import org.eclipse.uml2.uml.BehaviorExecutionSpecification;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Add new Label EditPart for display behavior of an
+ * BehaviorExecutionSpecification.
+ *
+ * @author Jin Liu (jin.liu@soyatec.com)
+ */
+public class BehaviorExecutionSpecificationBehaviorEditPart extends
+ BorderItemLabelEditPart {
+
+ public static final String BEHAVIOR_TYPE = "BehaviorExecutionSpecification_Behavior";
+ static {
+ registerSnapBackPosition(BEHAVIOR_TYPE, new Point(16, 16));
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public BehaviorExecutionSpecificationBehaviorEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected EObject getParserElement() {
+ EObject parserElement = super.getParserElement();
+ if (parserElement instanceof BehaviorExecutionSpecification) {
+ return ((BehaviorExecutionSpecification) parserElement)
+ .getBehavior();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BorderItemLabelEditPart#createFigurePrim()
+ *
+ * @return
+ */
+
+ @Override
+ protected IFigure createFigurePrim() {
+ WrappingLabel label = new WrappingLabel();
+ label.setTextWrap(true);
+ return label;
+ }
+
+ @Override
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BorderItemLabelEditPart#createParser()
+ *
+ * @return
+ */
+ @Override
+ protected IParser createParser() {
+ return new MessageFormatParser(
+ new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }) {
+
+ @Override
+ public String getPrintString(IAdaptable adapter, int flags) {
+ String printString = super.getPrintString(adapter, flags);
+ EObject obj = (EObject) adapter.getAdapter(EObject.class);
+ if (obj instanceof OpaqueBehavior) {
+ OpaqueBehavior opaque = (OpaqueBehavior) obj;
+ if (opaque.isSetLanguages()) {
+ StringBuffer buf = new StringBuffer(printString);
+ buf.append("{");
+ EList<String> languages = opaque.getLanguages();
+ EList<String> bodies = opaque.getBodies();
+ for (int i = 0; i < languages.size(); i++) {
+ if (i != 0) {
+ buf.append(", ");
+ }
+ buf.append("{");
+ buf.append(languages.get(i));
+ buf.append("}");
+ if (i < bodies.size()) {
+ String body = bodies.get(i);
+ if (body != null) {
+ buf.append(body);
+ }
+ }
+ }
+ buf.append("}");
+ return new String(buf);
+ }
+ }
+ return printString;
+ }
+ };
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ removeEditPolicy(EditPolicy.COMPONENT_ROLE);
+ installEditPolicy(EditPolicy.COMPONENT_ROLE,
+ new VisibilityComponentEditPolicy() {
+ @Override
+ protected Command createDeleteViewCommand(
+ GroupRequest deleteRequest) {
+ org.eclipse.emf.common.command.Command cmd = BehaviorDisplayHelper
+ .getChangeDisplayBehaviorCommand(
+ getEditingDomain(), getPrimaryView(),
+ false);
+ return new EMFtoGEFCommandWrapper(cmd);
+ }
+ });
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java
new file mode 100644
index 00000000000..b81d47bceb0
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BorderItemLabelEditPart.java
@@ -0,0 +1,612 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Soyatec - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+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.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+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.ui.editparts.IBorderItemEditPart;
+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.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
+import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
+import org.eclipse.papyrus.uml.diagram.sequence.Activator;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Feature;
+
+
+/**
+ * Abstract LabelEditPart which should be located around of BorderedNodeFigure.
+ *
+ * @author Jin Liu (jin.liu@soyatec.com)
+ */
+public abstract class BorderItemLabelEditPart extends LabelEditPart implements ITextAwareEditPart, IBorderItemEditPart {
+
+ private DirectEditManager manager;
+
+ private IParser parser;
+
+ private List<?> parserElements;
+
+ private String defaultText;
+
+ protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
+
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public BorderItemLabelEditPart(View view) {
+ super(view);
+ }
+
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new BorderItemSelectionEditPolicy() {
+
+ protected List createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+ });
+ }
+
+ public IBorderItemLocator getBorderItemLocator() {
+ IFigure parentFigure = getFigure().getParent();
+ if(parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (IBorderItemLocator)constraint;
+ }
+ return null;
+ }
+
+ public void refreshBounds() {
+ Point location = getLocation();
+ if(location == null) {
+ location = new Point();
+ }
+ Dimension size = getSize();
+ if(size == null) {
+ size = new Dimension();
+ }
+ IBorderItemLocator borderItemLocator = getBorderItemLocator();
+ if(borderItemLocator != null) {
+ borderItemLocator.setConstraint(new Rectangle(location, size));
+ }
+ }
+
+ protected Point getLocation() {
+ Point point = new Point();
+ point.x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ point.y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ return point;
+ }
+
+ protected Dimension getSize() {
+ Dimension size = new Dimension();
+ size.width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ size.height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ return size;
+ }
+
+ public int getKeyPoint() {
+ return ConnectionLocator.MIDDLE;
+ }
+
+ protected String getLabelTextHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getText();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getText();
+ } else {
+ return ((Label)figure).getText();
+ }
+ }
+
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setText(text);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setText(text);
+ } else {
+ ((Label)figure).setText(text);
+ }
+ }
+
+ protected Image getLabelIconHelper(IFigure figure) {
+ if(figure instanceof WrappingLabel) {
+ return ((WrappingLabel)figure).getIcon();
+ } else if(figure instanceof ILabelFigure) {
+ return ((ILabelFigure)figure).getIcon();
+ } else {
+ return ((Label)figure).getIcon();
+ }
+ }
+
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if(figure instanceof WrappingLabel) {
+ ((WrappingLabel)figure).setIcon(icon);
+ } else if(figure instanceof ILabelFigure) {
+ ((ILabelFigure)figure).setIcon(icon);
+ } else {
+ ((Label)figure).setIcon(icon);
+ }
+ }
+
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if(parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if(text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ }
+
+ public String getEditText() {
+ if(getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if(value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ 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) {
+ ie.printStackTrace();
+ }
+ }
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ public IContentAssistProcessor getCompletionProcessor() {
+ if(getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ public final IParser getParser() {
+ if(parser == null) {
+ parser = createParser();
+ }
+ return parser;
+ }
+
+ protected abstract IParser createParser();
+
+ protected DirectEditManager getManager() {
+ if(manager == null) {
+ setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ protected void performDirectEdit(Point eventLocation) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ private void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch(directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ protected void refreshLabel() {
+ EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
+ if(maskLabelPolicy == null) {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ }
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy)pdEditPolicy).refreshFeedback();
+ }
+ Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
+ if(sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
+ ((UMLTextSelectionEditPolicy)sfEditPolicy).refreshFeedback();
+ }
+ refreshBounds();
+ }
+
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextUnderline(style.isUnderline());
+ }
+ if(resolveSemanticElement() instanceof Feature) {
+ if(((Feature)resolveSemanticElement()).isStatic()) {
+ ((WrappingLabel)getFigure()).setTextUnderline(true);
+ } else {
+ ((WrappingLabel)getFigure()).setTextUnderline(false);
+ }
+ }
+ }
+
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel)getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ protected void refreshFont() {
+ FontStyle style = (FontStyle)getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if(style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ protected void addSemanticListeners() {
+ if(getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser)getParser()).getSemanticElementsBeingParsed(element);
+ for(int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject)parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ protected void removeSemanticListeners() {
+ if(parserElements != null) {
+ for(int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if(accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ private View getFontStyleOwnerView() {
+ return (View)getModel();
+ }
+
+ public int getDirectEditionType() {
+ if(checkExtendedEditor()) {
+ initExtendedEditorConfiguration();
+ return IDirectEdition.EXTENDED_DIRECT_EDITOR;
+ }
+ if(checkDefaultEdition()) {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+ // not a named element. no specific editor => do nothing
+ return IDirectEdition.NO_DIRECT_EDITION;
+ }
+
+ protected boolean checkExtendedEditor() {
+ if(resolveSemanticElement() != null) {
+ return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ return false;
+ }
+
+ protected boolean checkDefaultEdition() {
+ return (getParser() != null);
+ }
+
+ protected void initExtendedEditorConfiguration() {
+ if(configuration == null) {
+ final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("")) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else {
+ configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
+ }
+ }
+ }
+
+ protected void updateExtendedEditorConfiguration() {
+ String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
+ if(languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
+ } else if(IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
+ configuration = null;
+ }
+ }
+
+ protected void performDefaultDirectEditorEdit(final Request theRequest) {
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if(NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer)event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if(NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if(NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if(getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if(getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser)getParser();
+ if(modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if(resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ protected IFigure createFigure() {
+ final IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomBehaviorExecutionSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomBehaviorExecutionSpecificationEditPart.java
index 6845c29c349..f0e0f71e7fa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomBehaviorExecutionSpecificationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomBehaviorExecutionSpecificationEditPart.java
@@ -13,26 +13,88 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.DelegatingLayout;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+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.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper;
+import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ExecutionSpecificationEndEditPart.DummyCommand;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionGraphicalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.semantic.CustomBehaviorExecutionSpecificationItemSemanticEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehaviorExecutionSpecification;
+import org.eclipse.uml2.uml.UMLPackage;
/**
+ * Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=417376. Display the behavior of an BehaviorExecutionSpecification as a Label.
+ *
+ * IMPORTANT, the new behavior label was added to the BorderedNodeFigure of Interaction, it seems there are some problems about moving when it was
+ * added
+ * on the BorderedNodeFigure of current BehaviorExecutionSpecification EditPart.
+ *
* @author Jin Liu (jin.liu@soyatec.com)
*/
public class CustomBehaviorExecutionSpecificationEditPart extends BehaviorExecutionSpecificationEditPart {
+ private NotificationHelper helper = new NotificationHelper(new UIAdapterImpl() {
+
+ @Override
+ protected void safeNotifyChanged(Notification msg) {
+ handleNotificationEvent(msg);
+ }
+ });
+
+ /**
+ * Registered a removing listener in parent editpart, this can help us to remove the behavior label(tips: behavior label was added to interaction
+ * figure.).
+ */
+ private EditPartListener selfRemovingListener;
+
/**
* Constructor.
*
@@ -54,6 +116,60 @@ public class CustomBehaviorExecutionSpecificationEditPart extends BehaviorExecut
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ExecutionGraphicalNodeEditPolicy());
}
+ @Override
+ 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) {
+ if(child instanceof BehaviorExecutionSpecificationBehaviorEditPart) {
+ return new BorderItemSelectionEditPolicy() {
+
+ protected List createSelectionHandles() {
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
+ mh.setBorder(null);
+ return Collections.singletonList(mh);
+ }
+
+ protected Command getMoveCommand(ChangeBoundsRequest request) {
+ IBorderItemEditPart borderItemEP = (IBorderItemEditPart)getHost();
+ IBorderItemLocator borderItemLocator = borderItemEP.getBorderItemLocator();
+
+ if(borderItemLocator != null) {
+ LayoutConstraint layout = ((Node)getHost().getModel()).getLayoutConstraint();
+ Point location = new Point();
+ if(layout instanceof Location) {
+ location.x = ((Location)layout).getX();
+ location.y = ((Location)layout).getY();
+ }
+ location.translate(request.getMoveDelta());
+
+ ICommand moveCommand = new SetBoundsCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View)getHost().getModel()), location);
+ return new ICommandProxy(moveCommand);
+ }
+ return null;
+ }
+
+
+ };
+ }
+ 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;
+ }
+
/**
* Overrides to disable the defaultAnchorArea. The edge is no more stuck with the middle of the
* figure.
@@ -108,6 +224,50 @@ public class CustomBehaviorExecutionSpecificationEditPart extends BehaviorExecut
}
/**
+ * We did NOT use a BorderedNodeFigure in current EditPart. There are some problems about moving external labels.
+ *
+ * We just find and use the root(Interaction) BorderedNodeFigure.
+ */
+ private BorderedNodeFigure getBorderedFigure() {
+ EditPart parent = getParent();
+ while(parent != null && !(parent instanceof CustomInteractionEditPart)) {
+ parent = parent.getParent();
+ }
+ if(parent != null) {
+ return ((CustomInteractionEditPart)parent).getBorderedFigure();
+ }
+ return null;
+ }
+
+ @Override
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if(childEditPart instanceof BehaviorExecutionSpecificationBehaviorEditPart) {
+ IFigure childFigure = ((BehaviorExecutionSpecificationBehaviorEditPart)childEditPart).getFigure();
+ BorderedNodeFigure borderedFigure = getBorderedFigure();
+ final IFigure figure = getFigure();
+ BehaviorLabelLocator locator = new BehaviorLabelLocator(figure);
+ if(borderedFigure != null) {
+ borderedFigure.getBorderItemContainer().add(childFigure, locator);
+ }
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ @Override
+ protected void removeChildVisual(EditPart childEditPart) {
+ if(childEditPart instanceof BehaviorExecutionSpecificationBehaviorEditPart) {
+ IFigure childFigure = ((BehaviorExecutionSpecificationBehaviorEditPart)childEditPart).getFigure();
+ BorderedNodeFigure borderedFigure = getBorderedFigure();
+ if(borderedFigure != null) {
+ borderedFigure.getBorderItemContainer().remove(childFigure);
+ }
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
* @see org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart#setLineWidth(int)
*
* @param width
@@ -116,4 +276,186 @@ public class CustomBehaviorExecutionSpecificationEditPart extends BehaviorExecut
protected void setLineWidth(int width) {
// super.setLineWidth(width);
}
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBehavior();
+ }
+
+ @Override
+ protected void refreshBounds() {
+ super.refreshBounds();
+ refreshBehavior();
+ }
+
+ protected void refreshBehavior() {
+ if(!BehaviorDisplayHelper.shouldDisplayBehavior(getNotationView())) {
+ return;
+ }
+ List children = getChildren();
+ for(Object child : children) {
+ if(child instanceof BehaviorExecutionSpecificationBehaviorEditPart) {
+ ((BehaviorExecutionSpecificationBehaviorEditPart)child).refresh();
+ }
+ }
+ }
+
+ @Override
+ public void activate() {
+ super.activate();
+ EObject elt = resolveSemanticElement();
+ if(elt instanceof BehaviorExecutionSpecification) {
+ Behavior behavior = ((BehaviorExecutionSpecification)elt).getBehavior();
+ if(behavior != null) {
+ helper.listenObject(behavior);
+ }
+ }
+ if(getParent() != null) {
+ getParent().addEditPartListener(selfRemovingListener = new EditPartListener.Stub() {
+
+ @Override
+ public void removingChild(EditPart child, int index) {
+ if(child == CustomBehaviorExecutionSpecificationEditPart.this) {
+ List children = new ArrayList(getChildren());
+ for(Object object : children) {
+ if(object instanceof BehaviorExecutionSpecificationBehaviorEditPart) {
+ removeChild((EditPart)object);
+ break;
+ }
+ }
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ public void deactivate() {
+ helper.unlistenAll();
+ if(getParent() != null) {
+ getParent().removeEditPartListener(selfRemovingListener);
+ }
+ super.deactivate();
+ }
+
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+ super.handleNotificationEvent(event);
+ Object feature = event.getFeature();
+ Object notifier = event.getNotifier();
+ if(UMLPackage.eINSTANCE.getBehaviorExecutionSpecification_Behavior() == feature) {
+ helper.unlistenObject((Notifier)event.getOldValue());
+ helper.listenObject((Notifier)event.getNewValue());
+ refreshBehavior();
+ } else if(notifier != null) {
+ EObject elt = resolveSemanticElement();
+ if(elt instanceof BehaviorExecutionSpecification && notifier == ((BehaviorExecutionSpecification)elt).getBehavior()) {
+ refreshBehavior();
+ }
+ }
+ if(BehaviorDisplayHelper.isDisplayBehaviorChanged(event)) {
+ refreshChildren();
+ }
+ }
+
+ @Override
+ protected List getModelChildren() {
+ List modelChildren = new ArrayList(super.getModelChildren());
+ boolean displayBehavior = BehaviorDisplayHelper.shouldDisplayBehavior(getNotationView());
+ //Lazy check and create behavior label model.
+ boolean hasBehaviorLabel = false;
+ final View view = getNotationView();
+ for(Object object : view.getChildren()) {
+ if(object instanceof View && BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE.equals(((View)object).getType())) {
+ hasBehaviorLabel = true;
+ if(!displayBehavior) {
+ modelChildren.remove(object);
+ }
+ break;
+ }
+ }
+ if(!hasBehaviorLabel && displayBehavior) {
+ final DecorationNode behaviorLabel = NotationFactory.eINSTANCE.createDecorationNode();
+ Location location = NotationFactory.eINSTANCE.createLocation();
+ location.setX(16);
+ location.setY(16);
+ behaviorLabel.setLayoutConstraint(location);
+ behaviorLabel.setType(BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE);
+ CommandHelper.executeCommandWithoutHistory(getEditingDomain(), new DummyCommand() {
+
+ @Override
+ public void execute() {
+ ViewUtil.insertChildView(view, behaviorLabel, ViewUtil.APPEND, true);
+ }
+ }, true);
+ modelChildren.add(behaviorLabel);
+ }
+ return modelChildren;
+ }
+
+ private static class BehaviorLabelLocator implements IBorderItemLocator {
+
+ private IFigure referenceFigure;
+
+ private Rectangle constraint = new Rectangle();
+
+
+ /**
+ * Constructor.
+ *
+ */
+ public BehaviorLabelLocator(IFigure referenceFigure) {
+ this.referenceFigure = referenceFigure;
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#setConstraint(org.eclipse.draw2d.geometry.Rectangle)
+ *
+ * @param constraint
+ */
+
+ public void setConstraint(Rectangle constraint) {
+ this.constraint = constraint;
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getValidLocation(org.eclipse.draw2d.geometry.Rectangle,
+ * org.eclipse.draw2d.IFigure)
+ *
+ * @param proposedLocation
+ * @param borderItem
+ * @return
+ */
+
+ public Rectangle getValidLocation(Rectangle proposedLocation, IFigure borderItem) {
+ return new Rectangle(proposedLocation);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.draw2d.ui.figures.IBorderItemLocator#getCurrentSideOfParent()
+ *
+ * @return
+ */
+
+ public int getCurrentSideOfParent() {
+ return 0;
+ }
+
+ /**
+ * @see org.eclipse.draw2d.Locator#relocate(org.eclipse.draw2d.IFigure)
+ *
+ * @param target
+ */
+
+ public void relocate(IFigure target) {
+ Rectangle ref = referenceFigure.getBounds().getCopy();
+ referenceFigure.translateToAbsolute(ref);
+ Rectangle bounds = constraint.getTranslated(ref.getLocation());
+ bounds.setSize(target.getPreferredSize());
+ target.translateToRelative(bounds);
+ target.setBounds(bounds);
+ }
+
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
index 546c24f04c3..2bb1b3a380f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
@@ -41,6 +41,8 @@ public class CustomEditPartProvider extends UMLEditPartProvider {
return new GateNameEditPart(view);
} else if(InteractionOperandGuardEditPart.GUARD_TYPE.equals(view.getType())) {
return new InteractionOperandGuardEditPart(view);
+ } else if(BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE.equals(view.getType())) {
+ return new BehaviorExecutionSpecificationBehaviorEditPart(view);
}
if(view instanceof Connector) {
if(((Connector)view).getType().equals(SequenceUtil.OBSERVATION_LINK_TYPE))
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
index d19b87b3f6f..88437eb3196 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
@@ -33,6 +33,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationBehaviorEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentAnnotatedElementEditPart;
@@ -62,65 +63,94 @@ import org.eclipse.uml2.uml.InteractionOperand;
public class CustomViewProvider extends UMLViewProvider {
protected boolean provides(CreateNodeViewOperation op) {
- if(op.getContainerView() == null) {
+ if (op.getContainerView() == null) {
return false;
}
int visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
- if(visualID == DurationConstraintEditPart.VISUAL_ID) { // avoid to modify UMLVisualIDRegistry.getNodeVisualID(View, EObject)
- if(InteractionInteractionCompartmentEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(op.getContainerView()))
+ if (visualID == DurationConstraintEditPart.VISUAL_ID) { // avoid to
+ // modify
+ // UMLVisualIDRegistry.getNodeVisualID(View,
+ // EObject)
+ if (InteractionInteractionCompartmentEditPart.VISUAL_ID == UMLVisualIDRegistry
+ .getVisualID(op.getContainerView()))
return true;
}
return super.provides(op);
}
protected boolean provides(CreateViewForKindOperation op) {
- if(op.getContainerView() == null) {
+ if (op.getContainerView() == null) {
return false;
}
int visualID = UMLVisualIDRegistry.getVisualID(op.getSemanticHint());
- if(visualID == DurationConstraintEditPart.VISUAL_ID) { // avoid to modify UMLVisualIDRegistry.getNodeVisualID(View, EObject)
- if(InteractionInteractionCompartmentEditPart.VISUAL_ID == UMLVisualIDRegistry.getVisualID(op.getContainerView()))
+ if (visualID == DurationConstraintEditPart.VISUAL_ID) { // avoid to
+ // modify
+ // UMLVisualIDRegistry.getNodeVisualID(View,
+ // EObject)
+ if (InteractionInteractionCompartmentEditPart.VISUAL_ID == UMLVisualIDRegistry
+ .getVisualID(op.getContainerView()))
return true;
}
return super.provides(op);
}
@Override
- public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
- Edge edge = super.createEdge(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
- if(edge != null) {
+ public Edge createEdge(IAdaptable semanticAdapter, View containerView,
+ String semanticHint, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
+ Edge edge = super.createEdge(semanticAdapter, containerView,
+ semanticHint, index, persisted, preferencesHint);
+ if (edge != null) {
edge.getStyles().add(NotationFactory.eINSTANCE.createLineStyle());
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Message");
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge,
+ prefStore, "Message");
}
return edge;
}
- public Node createTimeObservation_3020(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createTimeObservation_3020(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(TimeObservationEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(TimeObservationEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "TimeObservation");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "TimeObservation");
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "TimeObservation");
- Node label5010 = createLabel(node, UMLVisualIDRegistry.getType(TimeObservationLabelEditPart.VISUAL_ID), true);
- label5010.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5010 = (Location)label5010.getLayoutConstraint();
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node,
+ prefStore, "TimeObservation");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node,
+ prefStore, "TimeObservation");
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "TimeObservation");
+ Node label5010 = createLabel(node,
+ UMLVisualIDRegistry
+ .getType(TimeObservationLabelEditPart.VISUAL_ID), true);
+ label5010.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5010 = (Location) label5010.getLayoutConstraint();
location5010.setX(0);
location5010.setY(0);
- Node label5014 = createLabel(node, UMLVisualIDRegistry.getType(TimeObservationAppliedStereotypeEditPart.VISUAL_ID), true);
- label5014.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5014 = (Location)label5014.getLayoutConstraint();
+ Node label5014 = createLabel(
+ node,
+ UMLVisualIDRegistry
+ .getType(TimeObservationAppliedStereotypeEditPart.VISUAL_ID),
+ true);
+ label5014.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5014 = (Location) label5014.getLayoutConstraint();
location5014.setX(0);
location5014.setY(0);
return node;
}
- protected Node createLabel(View owner, String hint, boolean isTimeObservationLable) {
+ protected Node createLabel(View owner, String hint,
+ boolean isTimeObservationLable) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
node.setType(hint);
@@ -128,153 +158,250 @@ public class CustomViewProvider extends UMLViewProvider {
return node;
}
- public Node createDurationConstraint_3021(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createDurationConstraint_3021(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DurationConstraintEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(DurationConstraintEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "DurationConstraint");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DurationConstraint");
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DurationConstraint");
- Node label5011 = createLabel(node, UMLVisualIDRegistry.getType(DurationConstraintLabelEditPart.VISUAL_ID));
- label5011.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5011 = (Location)label5011.getLayoutConstraint();
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node,
+ prefStore, "DurationConstraint");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node,
+ prefStore, "DurationConstraint");
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "DurationConstraint");
+ Node label5011 = createLabel(node,
+ UMLVisualIDRegistry
+ .getType(DurationConstraintLabelEditPart.VISUAL_ID));
+ label5011.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5011 = (Location) label5011.getLayoutConstraint();
location5011.setX(25);
location5011.setY(0);
- Node label5015 = createLabel(node, UMLVisualIDRegistry.getType(DurationConstraintAppliedStereotypeEditPart.VISUAL_ID));
- label5015.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5015 = (Location)label5015.getLayoutConstraint();
+ Node label5015 = createLabel(
+ node,
+ UMLVisualIDRegistry
+ .getType(DurationConstraintAppliedStereotypeEditPart.VISUAL_ID));
+ label5015.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5015 = (Location) label5015.getLayoutConstraint();
location5015.setX(0);
location5015.setY(-22);
return node;
}
- public Node createCombinedFragment_3004(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createCombinedFragment_3004(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(CombinedFragmentEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(CombinedFragmentEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
// initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "CombinedFragment");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "CombinedFragment");
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "CombinedFragment");
- Node compartment = createCompartment(node, UMLVisualIDRegistry.getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID), false, false, true, true);
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node,
+ prefStore, "CombinedFragment");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node,
+ prefStore, "CombinedFragment");
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "CombinedFragment");
+ Node compartment = createCompartment(
+ node,
+ UMLVisualIDRegistry
+ .getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID),
+ false, false, true, true);
// Add by default InteractionOperand
- for(InteractionOperand interactionOperand : ((CombinedFragment)domainElement).getOperands()) {
- createInteractionOperand_3005(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement)
+ .getOperands()) {
+ createInteractionOperand_3005(interactionOperand, compartment, -1,
+ true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
}
- //initialization for the compartment visibility
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "CombinedFragment");
+ // initialization for the compartment visibility
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(
+ node, prefStore, "CombinedFragment");
return node;
}
- public Node createDurationConstraint_3023(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createDurationConstraint_3023(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
- node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
+ node.getStyles()
+ .add(NotationFactory.eINSTANCE.createDescriptionStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DurationConstraintInMessageEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(DurationConstraintInMessageEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
// custom layout for location
- Location location3023 = (Location)node.getLayoutConstraint();
+ Location location3023 = (Location) node.getLayoutConstraint();
location3023.setX(0);
location3023.setY(20);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DurationConstraint");
- Node label5018 = createLabel(node, UMLVisualIDRegistry.getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID));
- Node label5019 = createLabel(node, UMLVisualIDRegistry.getType(DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID));
- label5019.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5019 = (Location)label5019.getLayoutConstraint();
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "DurationConstraint");
+ Node label5018 = createLabel(
+ node,
+ UMLVisualIDRegistry
+ .getType(DurationConstraintInMessageLabelEditPart.VISUAL_ID));
+ Node label5019 = createLabel(
+ node,
+ UMLVisualIDRegistry
+ .getType(DurationConstraintInMessageAppliedStereotypeEditPart.VISUAL_ID));
+ label5019.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5019 = (Location) label5019.getLayoutConstraint();
location5019.setX(0);
location5019.setY(-22);
return node;
}
- public Node createDurationObservation_3024(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createDurationObservation_3024(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Node node = NotationFactory.eINSTANCE.createShape();
- node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
+ node.getStyles()
+ .add(NotationFactory.eINSTANCE.createDescriptionStyle());
node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(DurationObservationEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(DurationObservationEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
// custom layout for location
- Location location3024 = (Location)node.getLayoutConstraint();
+ Location location3024 = (Location) node.getLayoutConstraint();
location3024.setX(0);
location3024.setY(0);
- // initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "DurationObservation");
- Node label5016 = createLabel(node, UMLVisualIDRegistry.getType(DurationObservationLabelEditPart.VISUAL_ID));
- Node label5017 = createLabel(node, UMLVisualIDRegistry.getType(DurationObservationAppliedStereotypeEditPart.VISUAL_ID));
- label5017.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
- Location location5017 = (Location)label5017.getLayoutConstraint();
+ // initializeFromPreferences
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "DurationObservation");
+ Node label5016 = createLabel(node,
+ UMLVisualIDRegistry
+ .getType(DurationObservationLabelEditPart.VISUAL_ID));
+ Node label5017 = createLabel(
+ node,
+ UMLVisualIDRegistry
+ .getType(DurationObservationAppliedStereotypeEditPart.VISUAL_ID));
+ label5017.setLayoutConstraint(NotationFactory.eINSTANCE
+ .createLocation());
+ Location location5017 = (Location) label5017.getLayoutConstraint();
location5017.setX(0);
location5017.setY(0);
return node;
}
- public Node createConsiderIgnoreFragment_3007(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
+ public Node createConsiderIgnoreFragment_3007(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
Shape node = NotationFactory.eINSTANCE.createShape();
node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
- node.setType(UMLVisualIDRegistry.getType(ConsiderIgnoreFragmentEditPart.VISUAL_ID));
+ node.setType(UMLVisualIDRegistry
+ .getType(ConsiderIgnoreFragmentEditPart.VISUAL_ID));
ViewUtil.insertChildView(containerView, node, index, persisted);
node.setElement(domainElement);
// initializeFromPreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(node, prefStore, "ConsiderIgnoreFragment");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ConsiderIgnoreFragment");
- PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node, prefStore, "ConsiderIgnoreFragment");
- Node compartment = createCompartment(node, UMLVisualIDRegistry.getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID), false, false, true, true);
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(node,
+ prefStore, "ConsiderIgnoreFragment");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node,
+ prefStore, "ConsiderIgnoreFragment");
+ PreferenceInitializerForElementHelper.initBackgroundFromPrefs(node,
+ prefStore, "ConsiderIgnoreFragment");
+ Node compartment = createCompartment(
+ node,
+ UMLVisualIDRegistry
+ .getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID),
+ false, false, true, true);
// Add by default InteractionOperand
- for(InteractionOperand interactionOperand : ((CombinedFragment)domainElement).getOperands()) {
- createInteractionOperand_3005(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement)
+ .getOperands()) {
+ createInteractionOperand_3005(interactionOperand, compartment, -1,
+ true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
}
- //initialization for the compartment visibility
- PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(node, prefStore, "ConsiderIgnoreFragment");
+ // initialization for the compartment visibility
+ PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(
+ node, prefStore, "ConsiderIgnoreFragment");
return node;
}
- public Edge createCommentAnnotatedElement_4010(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Edge edge = NotationFactory.eINSTANCE.createEdge(); // override Connector
+ public Edge createCommentAnnotatedElement_4010(View containerView,
+ int index, boolean persisted, PreferencesHint preferencesHint) {
+ Edge edge = NotationFactory.eINSTANCE.createEdge(); // override
+ // Connector
edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
- RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
- ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
+ RelativeBendpoints bendpoints = NotationFactory.eINSTANCE
+ .createRelativeBendpoints();
+ ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(
+ 2);
points.add(new RelativeBendpoint());
points.add(new RelativeBendpoint());
bendpoints.setPoints(points);
edge.setBendpoints(bendpoints);
ViewUtil.insertChildView(containerView, edge, index, persisted);
- edge.setType(UMLVisualIDRegistry.getType(CommentAnnotatedElementEditPart.VISUAL_ID));
+ edge.setType(UMLVisualIDRegistry
+ .getType(CommentAnnotatedElementEditPart.VISUAL_ID));
edge.setElement(null);
// initializePreferences
- final IPreferenceStore prefStore = (IPreferenceStore)preferencesHint.getPreferenceStore();
- PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge, prefStore, "Undefined");
- PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge, prefStore, "Undefined");
- PreferenceInitializerForElementHelper.initRountingFromPrefs(edge, prefStore, "Undefined");
+ final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
+ .getPreferenceStore();
+ PreferenceInitializerForElementHelper.initForegroundFromPrefs(edge,
+ prefStore, "Undefined");
+ PreferenceInitializerForElementHelper.initFontStyleFromPrefs(edge,
+ prefStore, "Undefined");
+ PreferenceInitializerForElementHelper.initRountingFromPrefs(edge,
+ prefStore, "Undefined");
return edge;
}
- //Add Guard label support.
+ // Add Guard label support.
@Override
- public Node createInteractionOperand_3005(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
- Node node = super.createInteractionOperand_3005(domainElement, containerView, index, persisted, preferencesHint);
- DecorationNode guardNode = NotationFactory.eINSTANCE.createDecorationNode();
+ public Node createInteractionOperand_3005(EObject domainElement,
+ View containerView, int index, boolean persisted,
+ PreferencesHint preferencesHint) {
+ Node node = super.createInteractionOperand_3005(domainElement,
+ containerView, index, persisted, preferencesHint);
+ DecorationNode guardNode = NotationFactory.eINSTANCE
+ .createDecorationNode();
Bounds b = NotationFactory.eINSTANCE.createBounds();
b.setX(5);
b.setY(5);
guardNode.setLayoutConstraint(b);
guardNode.setType(InteractionOperandGuardEditPart.GUARD_TYPE);
- guardNode.setElement(((InteractionOperand)domainElement).getGuard());
+ guardNode.setElement(((InteractionOperand) domainElement).getGuard());
ViewUtil.insertChildView(node, guardNode, ViewUtil.APPEND, true);
return node;
}
+
+ @Override
+ public Node createBehaviorExecutionSpecification_3003(
+ EObject domainElement, View containerView, int index,
+ boolean persisted, PreferencesHint preferencesHint) {
+ Node node = super
+ .createBehaviorExecutionSpecification_3003(domainElement,
+ containerView, index, persisted, preferencesHint);
+ // Add a label for Behavior.
+ Node label = createLabel(node,
+ BehaviorExecutionSpecificationBehaviorEditPart.BEHAVIOR_TYPE);
+ Location location = NotationFactory.eINSTANCE.createLocation();
+ location.setX(18);
+ location.setY(18);
+ label.setLayoutConstraint(location);
+ return node;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DisplayBehaviorContributionItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DisplayBehaviorContributionItem.java
new file mode 100644
index 00000000000..7f7cd36d9b7
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DisplayBehaviorContributionItem.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Soyatec - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.providers;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationBehaviorEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+
+/**
+ * @author Jin Liu (jin.liu@soyatec.com)
+ */
+public class DisplayBehaviorContributionItem extends ContributionItem implements IWorkbenchContribution {
+
+ private IServiceLocator serviceLocator;
+
+ /**
+ * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
+ *
+ * @param serviceLocator
+ */
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+ private ISelection getSelection() {
+ if(serviceLocator == null) {
+ return null;
+ }
+ ISelectionService selectionService = (ISelectionService)serviceLocator.getService(ISelectionService.class);
+ if(selectionService != null) {
+ return selectionService.getSelection();
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Menu, int)
+ *
+ * @param menu
+ * @param index
+ */
+ @Override
+ public void fill(Menu menu, int index) {
+ super.fill(menu, index);
+ ISelection selection = getSelection();
+ if(selection == null || selection.isEmpty()) {
+ return;
+ }
+ if(selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection)selection).getFirstElement();
+ if(firstElement instanceof BehaviorExecutionSpecificationEditPart) {
+ final View view = ((BehaviorExecutionSpecificationEditPart)firstElement).getNotationView();
+ final TransactionalEditingDomain domain = ((BehaviorExecutionSpecificationEditPart)firstElement).getEditingDomain();
+ boolean displayBehavior = BehaviorDisplayHelper.shouldDisplayBehavior(view);
+ if(displayBehavior) {
+ MenuItem hide = new MenuItem(menu, SWT.NONE, 0);
+ hide.setText("Hide Behavior Label");
+ hide.addListener(SWT.Selection, new Listener() {
+
+ public void handleEvent(Event event) {
+ Command cmd = BehaviorDisplayHelper.getChangeDisplayBehaviorCommand(domain, view, false);
+ domain.getCommandStack().execute(cmd);
+ }
+ });
+ new MenuItem(menu, SWT.SEPARATOR, 1);
+ } else {
+ MenuItem show = new MenuItem(menu, SWT.NONE, 0);
+ show.setText("Display Behavior Label");
+ show.addListener(SWT.Selection, new Listener() {
+
+ public void handleEvent(Event event) {
+ Command cmd = BehaviorDisplayHelper.getChangeDisplayBehaviorCommand(domain, view, true);
+ domain.getCommandStack().execute(cmd);
+ }
+ });
+ new MenuItem(menu, SWT.SEPARATOR, 1);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/BehaviorDisplayHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/BehaviorDisplayHelper.java
new file mode 100644
index 00000000000..21598053031
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/BehaviorDisplayHelper.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Soyatec - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.sequence.util;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.util.Util;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.infra.emf.databinding.AnnotationObservableValue;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.views.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.views.properties.modelelement.AnnotationModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
+import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @author Jin Liu (jin.liu@soyatec.com)
+ */
+public class BehaviorDisplayHelper implements ModelElementFactory {
+
+ private static final String DISPLAY_BEHAVIOR = "displayBehavior";
+
+ /**
+ * @see org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory#createFromSource(java.lang.Object,
+ * org.eclipse.papyrus.views.properties.contexts.DataContextElement)
+ *
+ * @param sourceElement
+ * @param context
+ * @return
+ */
+
+ public ModelElement createFromSource(Object sourceElement,
+ DataContextElement context) {
+ View source = NotationHelper.findView(sourceElement);
+ if (source == null) {
+ Activator.log
+ .warn("Unable to resolve the selected element to an EObject"); //$NON-NLS-1$
+ return null;
+ }
+ EditingDomain domain = EMFHelper.resolveEditingDomain(source);
+ return new AnnotationModelElement(source, domain, DISPLAY_BEHAVIOR) {
+
+ @Override
+ public IObservable doGetObservable(String propertyPath) {
+ return new BehaviorObservableValue(source, domain,
+ DISPLAY_BEHAVIOR, DISPLAY_BEHAVIOR);
+ }
+ };
+ }
+
+ public static Command getChangeDisplayBehaviorCommand(
+ TransactionalEditingDomain domain, View source, final Object display) {
+ return new CreateEAnnotationCommand(
+ (TransactionalEditingDomain) domain, source, DISPLAY_BEHAVIOR) {
+
+ @Override
+ protected void doExecute() {
+ EAnnotation annotation = createEAnnotation();
+ replaceEannotation(annotation, getObject());
+ replaceEntry(annotation, DISPLAY_BEHAVIOR, display == null ? ""
+ : display.toString());
+ }
+ };
+ }
+
+ public static final boolean isDisplayBehaviorChanged(Notification msg) {
+ if (msg == null || !(msg.getNewValue() instanceof EAnnotation)) {
+ return false;
+ }
+ EAnnotation anno = (EAnnotation) msg.getNewValue();
+ return DISPLAY_BEHAVIOR.equals(anno.getSource());
+ }
+
+ public static final boolean shouldDisplayBehavior(View view) {
+ if (view != null) {
+ EAnnotation anno = view.getEAnnotation(DISPLAY_BEHAVIOR);
+ if (anno != null) {
+ return !"false".equalsIgnoreCase(anno.getDetails().get(
+ DISPLAY_BEHAVIOR));
+ }
+ }
+ return true;
+ }
+
+ private static class BehaviorObservableValue extends
+ AnnotationObservableValue {
+
+ private Object cacheValue = "true";
+ private Adapter sourceListener;
+
+ public BehaviorObservableValue(EModelElement source,
+ EditingDomain domain, String annotationName, String key) {
+ super(source, domain, annotationName, key);
+ source.eAdapters().add(getSourceListener());
+ }
+
+ public Adapter getSourceListener() {
+ if (sourceListener == null) {
+ sourceListener = new EContentAdapter() {
+ @Override
+ public void notifyChanged(Notification msg) {
+ super.notifyChanged(msg);
+ if (msg.getNotifier() instanceof EAnnotation) {
+ Object feature = msg.getFeature();
+ if (EcorePackage.eINSTANCE.getEAnnotation_Details() == feature
+ && DISPLAY_BEHAVIOR
+ .equals(((EAnnotation) msg
+ .getNotifier()).getSource())) {
+ setValue(shouldDisplayBehavior((View) source));
+ }
+ }
+ }
+ };
+ }
+ return sourceListener;
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ Object realValue = doGetValue();
+ if (!Util.equals(realValue, value)) {
+ source.eAdapters().remove(sourceListener);
+ super.doSetValue(value);
+ source.eAdapters().add(getSourceListener());
+ }
+ if (!Util.equals(cacheValue, value)) {
+ ValueDiff diff = Diffs.createValueDiff(cacheValue, value);
+ fireValueChange(diff);
+ cacheValue = value;
+ }
+ }
+
+ protected Command getCommand(final Object value) {
+ return getChangeDisplayBehaviorCommand(
+ (TransactionalEditingDomain) domain, (View) source, value);
+ }
+
+ @Override
+ protected Object doGetValue() {
+ Object value = super.doGetValue();
+ if (value == null) {
+ // By default, return true.
+ return "true";
+ }
+ return value;
+ }
+
+ @Override
+ public synchronized void dispose() {
+ if (source != null) {
+ source.eAdapters().remove(sourceListener);
+ }
+ super.dispose();
+ }
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi
index e8934cad6db..926e37b589b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi
@@ -5,5 +5,6 @@
<modelElementFactories name="Interaction Operand Factory" factoryClass="org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperandModelElementFactory"/>
<modelElementFactories name="Gate Factory" factoryClass="org.eclipse.papyrus.uml.diagram.sequence.util.GateModelElementFactory"/>
<modelElementFactories name="Link Route Factory" factoryClass="org.eclipse.papyrus.uml.diagram.sequence.util.LinkRouteModelElementFactory"/>
+ <modelElementFactories name="Behavior Factory" factoryClass="org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper"/>
<constraintTypes label="Duration Link Constraint" constraintClass="org.eclipse.papyrus.uml.diagram.sequence.util.DurationLinkConstraint"/>
</environment:Environment>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
index b174a33884b..52c1aa04741 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
@@ -14,11 +14,14 @@
<widget href="ui/InteractionOperandGuardVisibility.xwt#/"/>
</sections>
<sections name="LinkRoute" sectionFile="ui/LinkRoute.xwt">
- <widget href="ui/LinkRoute.xwt#/"/>
- </sections>
+ <widget href="ui/LinkRoute.xwt#/"/>
+ </sections>
<sections name="GateNameSection" sectionFile="ui/GateNameSection.xwt">
<widget href="ui/GateNameSection.xwt#/"/>
</sections>
+ <sections name="DisplayBehaviorSection" sectionFile="ui/DisplayBehaviorSection.xwt">
+ <widget href="ui/DisplayBehaviorSection.xwt#/"/>
+ </sections>
</tabs>
<views name="CombinedFragmentTitle" sections="//@tabs.0/@sections.0" automaticContext="true">
<constraints xsi:type="constraints:SimpleConstraint" name="isSingleCombinedFragment">
@@ -46,17 +49,23 @@
</constraints>
</views>
<views name="LinkRoute" sections="//@tabs.0/@sections.4">
- <constraints xsi:type="constraints:SimpleConstraint" name="isMLinkRoute">
- <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@constraintTypes.0"/>
- <properties xsi:type="constraints:ValueProperty" name="sourcePart" value="org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart"/>
- </constraints>
- </views>
+ <constraints xsi:type="constraints:SimpleConstraint" name="isMLinkRoute">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="sourcePart" value="org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart"/>
+ </constraints>
+ </views>
<views name="GateName" sections="//@tabs.0/@sections.5">
<constraints xsi:type="constraints:SimpleConstraint" name="isGate">
<constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
<properties xsi:type="constraints:ValueProperty" name="umlClassName" value="Gate"/>
</constraints>
</views>
+ <views name="DisplayBehavior" sections="//@tabs.0/@sections.6">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isBehaviorExecutionSpecification">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" name="umlClassName" value="BehaviorExecutionSpecification"/>
+ </constraints>
+ </views>
<dataContexts name="Preference" label="Preference">
<elements name="org.eclipse.papyrus.infra.gmfdiag.preferences">
<properties name="ELEMENT_PapyrusUMLSequenceDiagram_CombinedFragment_CombinedFragmentCompartment.compartment_name.visibility" label="Show name" type="Boolean" description="Show the Title in the diagram"/>
@@ -87,13 +96,17 @@
<modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@modelElementFactories.2"/>
</dataContexts>
<dataContexts name="LinkRoute" label="Link Route">
- <elements name="Routing">
- <properties name="style"/>
- </elements>
- <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@modelElementFactories.4"/>
+ <elements name="Routing">
+ <properties name="style"/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@modelElementFactories.4"/>
</dataContexts>
<dataContexts name="Gate" label="Gate">
<properties name="showName" label="Show Name" type="Boolean" description="Show name on diagram."/>
<modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@modelElementFactories.3"/>
</dataContexts>
+ <dataContexts name="Behavior" label="Behavior">
+ <properties name="displayBehavior" label="Display" type="Boolean" description="Display Behavior Label."/>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.uml.diagram.sequence/model/prop/Environment.xmi#//@modelElementFactories.5"/>
+ </dataContexts>
</contexts:Context>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/ui/DisplayBehaviorSection.xwt b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/ui/DisplayBehaviorSection.xwt
new file mode 100644
index 00000000000..61618138542
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/ui/DisplayBehaviorSection.xwt
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.views.properties.widgets.layout"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:ppe="clr-namespace:org.eclipse.papyrus.views.properties.widgets"
+ xmlns="http://www.eclipse.org/xwt/presentation">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanCheckbox input="{Binding}"
+ property="Behavior:displayBehavior" customLabel="Display Behavior Label."></ppe:BooleanCheckbox>
+</Composite> \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
index 1d7186360a2..74f8bd91ea0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml
@@ -2016,6 +2016,10 @@
class="org.eclipse.papyrus.uml.diagram.sequence.providers.DurationConstraintContributionItem"
id="org.eclipse.papyrus.sequence.duraitonconstraint.DynamicMenu">
</dynamic>
+ <dynamic
+ class="org.eclipse.papyrus.uml.diagram.sequence.providers.DisplayBehaviorContributionItem"
+ id="org.eclipse.papyrus.uml.diagram.sequence.displayBehaviorMenu">
+ </dynamic>
</menuContribution>
</extension>

Back to the top