summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-06-24 08:44:58 (EDT)
committerBenoit Maggi2014-06-24 08:51:11 (EDT)
commitac2dd093bf2104ddf58ff4ddc376d9d7c2272d64 (patch)
tree188503fc2fa5978be7706f6f3a6829f87253850d
parenta72d17ac6495c592a4104c7afa3be504c4319680 (diff)
downloadorg.eclipse.papyrus-ac2dd093bf2104ddf58ff4ddc376d9d7c2272d64.zip
org.eclipse.papyrus-ac2dd093bf2104ddf58ff4ddc376d9d7c2272d64.tar.gz
org.eclipse.papyrus-ac2dd093bf2104ddf58ff4ddc376d9d7c2272d64.tar.bz2
Bug 431169 - [Activity Diagram] almost impossible to getrefs/changes/17/28917/2
callBehaviorAction nodes out of a structuredActivity - the callbehaviorActionToInteractionStrategy should be available only on interaction overview diagram Change-Id: I25a342f294896b3c0c312a10e82d998c835989b3 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/DiagramsUtil.java103
-rwxr-xr-xplugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java380
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/TreeSelectorDialog.java527
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CallBehaviorActionToInteractionDropStrategy.java214
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java2
5 files changed, 645 insertions, 581 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/DiagramsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/DiagramsUtil.java
index cb0d93b..17c92d5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/DiagramsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/DiagramsUtil.java
@@ -1,76 +1,27 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.common;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
-
-
-public class DiagramsUtil {
-
- /**
- * Gets the diagrams associated to element.
- *
- * @param element
- * @param resourceSet
- * can be null, it will then try to retrieve it from the element.
- * @return the list of diagrams associated with the given element
- */
- public static List<Diagram> getAssociatedDiagrams(EObject element, ResourceSet resourceSet) {
- if(resourceSet == null) {
- if(element != null && element.eResource() != null) {
- resourceSet = element.eResource().getResourceSet();
- }
- }
-
- if(resourceSet instanceof ModelSet) {
- Resource notationResource = NotationUtils.getNotationResource((ModelSet)resourceSet);
- return getAssociatedDiagramsFromNotationResource(element, notationResource);
- }
-
- return Collections.emptyList();
- }
-
- /**
- * Gets the diagrams associated to element.
- *
- * @param element
- * @param notationResource
- * the notation resource where to look for diagrams
- * @return the list of diagrams associated with the given element
- */
- public static List<Diagram> getAssociatedDiagramsFromNotationResource(EObject element, Resource notationResource) {
- if(notationResource != null) {
- LinkedList<Diagram> diagrams = new LinkedList<Diagram>();
- for(EObject eObj : notationResource.getContents()) {
- if(eObj instanceof Diagram) {
- Diagram diagram = (Diagram)eObj;
- if(element.equals(diagram.getElement())) {
- diagrams.add(diagram);
- }
- }
- }
- return diagrams;
- }
- return Collections.emptyList();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010 Atos Origin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common;
+
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
+
+/**
+ * Use the standard utils
+ * {@link DiagramUtils}
+ *
+ */
+@Deprecated // use DiagramUtils
+public class DiagramsUtil extends DiagramUtils{
+
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
index bc35604..6f59d1f 100755
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
@@ -1,146 +1,234 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.common.utils;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Style;
-import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-import org.eclipse.papyrus.infra.viewpoints.style.PapyrusViewStyle;
-import org.eclipse.papyrus.infra.viewpoints.style.StylePackage;
-
-/**
- * Utilities for the management of configuration-related data on views and diagrams
- *
- * @author Laurent Wouters
- */
-public class DiagramUtils {
-
- /**
- * Gets the diagram associated to the given edit part
- *
- * @param part
- * The edit part
- * @return The diagram associated to the edit part, or <code>null</code> if none is found
- */
- public static Diagram getDiagramFrom(EditPart part) {
- EditPart current = part;
- while (current != null) {
- Object model = current.getModel();
- if (model instanceof Diagram)
- return (Diagram) model;
- if (current.getParent() != null) {
- current = current.getParent();
- } else {
- // No more parent, assume this is a RenderedDiagramRootEditPart
- if (current.getChildren().size() == 0)
- return null;
- current = (EditPart) current.getChildren().get(0);
- model = current.getModel();
- return (model instanceof Diagram) ? (Diagram) model : null;
- }
- }
- return null;
- }
-
- /**
- * Gets the owner of a diagram as it will appear in the model explorer.
- * In the case where the diagram does not yet have a defined owner, the diagram's root element will be returned instead.
- *
- * @param diagram
- * A diagram
- * @return The diagram's owner
- */
- public static EObject getOwner(Diagram diagram) {
- Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- if (style != null) {
- PapyrusViewStyle pvs = (PapyrusViewStyle) style;
- EObject value = pvs.getOwner();
- if (value != null)
- return value;
- }
- // This is the legacy fallback for old diagrams
- return diagram.getElement();
- }
-
- /**
- * Sets the owner of a diagram as it will appear in the model explorer
- *
- * @param diagram
- * A diagram
- * @param owner
- * The new diagram's owner
- */
- public static void setOwner(Diagram diagram, EObject owner) {
- Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- if (style != null) {
- PapyrusViewStyle pvs = (PapyrusViewStyle) style;
- pvs.setOwner(owner);
- } else {
- PapyrusViewStyle pvs = (PapyrusViewStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- pvs.setOwner(owner);
- }
- }
-
- /**
- * Gets the prototype of a diagram
- *
- * @param diagram
- * A diagram
- * @return The diagram's prototype
- */
- public static ViewPrototype getPrototype(Diagram diagram) {
- Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- if (style != null) {
- PapyrusViewStyle pvs = (PapyrusViewStyle) style;
- PapyrusView config = pvs.getConfiguration();
- if (config != null) {
- if (PolicyChecker.getCurrent().isInViewpoint(config))
- return ViewPrototype.get(config);
- return ViewPrototype.UNAVAILABLE_DIAGRAM;
- }
- return ViewPrototype.get(diagram.getType(), pvs.getOwner(), diagram.getElement());
- }
- // This is the legacy fallback for old diagrams
- if ("Package".equals(diagram.getType())) {
- for (ViewPrototype prototype : PolicyChecker.getCurrent().getAllPrototypes()) {
- if ("UML Package Diagram".equals(prototype.getLabel()))
- return prototype;
- }
- }
- return ViewPrototype.get(diagram.getType(), diagram.getElement(), diagram.getElement());
- }
-
- /**
- * Sets the prototype of a diagram
- *
- * @param diagram
- * A diagram
- * @param configuration
- * The new diagram's prototype
- */
- public static void setPrototype(Diagram diagram, ViewPrototype prototype) {
- Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- if (style != null) {
- PapyrusViewStyle pvs = (PapyrusViewStyle) style;
- pvs.setConfiguration(prototype.getConfiguration());
- } else {
- PapyrusViewStyle pvs = (PapyrusViewStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
- pvs.setConfiguration(prototype.getConfiguration());
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ * Benoit Maggi (Cea) benoit.maggi@cea.fr - Add utility to get the containing diagram
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.common.utils;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Style;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.papyrus.infra.viewpoints.style.PapyrusViewStyle;
+import org.eclipse.papyrus.infra.viewpoints.style.StylePackage;
+
+/**
+ * Utilities for the management of configuration-related data on views and diagrams
+ *
+ * @author Laurent Wouters
+ */
+public class DiagramUtils {
+
+ /**
+ * Gets the diagram associated to the given edit part
+ *
+ * @param part
+ * The edit part
+ * @return The diagram associated to the edit part, or <code>null</code> if none is found
+ */
+ public static Diagram getDiagramFrom(EditPart part) {
+ EditPart current = part;
+ while (current != null) {
+ Object model = current.getModel();
+ if (model instanceof Diagram)
+ return (Diagram) model;
+ if (current.getParent() != null) {
+ current = current.getParent();
+ } else {
+ // No more parent, assume this is a RenderedDiagramRootEditPart
+ if (current.getChildren().size() == 0)
+ return null;
+ current = (EditPart) current.getChildren().get(0);
+ model = current.getModel();
+ return (model instanceof Diagram) ? (Diagram) model : null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the owner of a diagram as it will appear in the model explorer.
+ * In the case where the diagram does not yet have a defined owner, the diagram's root element will be returned instead.
+ *
+ * @param diagram
+ * A diagram
+ * @return The diagram's owner
+ */
+ public static EObject getOwner(Diagram diagram) {
+ Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ if (style != null) {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) style;
+ EObject value = pvs.getOwner();
+ if (value != null)
+ return value;
+ }
+ // This is the legacy fallback for old diagrams
+ return diagram.getElement();
+ }
+
+ /**
+ * Sets the owner of a diagram as it will appear in the model explorer
+ *
+ * @param diagram
+ * A diagram
+ * @param owner
+ * The new diagram's owner
+ */
+ public static void setOwner(Diagram diagram, EObject owner) {
+ Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ if (style != null) {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) style;
+ pvs.setOwner(owner);
+ } else {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ pvs.setOwner(owner);
+ }
+ }
+
+ /**
+ * Gets the prototype of a diagram
+ *
+ * @param diagram
+ * A diagram
+ * @return The diagram's prototype
+ */
+ public static ViewPrototype getPrototype(Diagram diagram) {
+ Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ if (style != null) {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) style;
+ PapyrusView config = pvs.getConfiguration();
+ if (config != null) {
+ if (PolicyChecker.getCurrent().isInViewpoint(config))
+ return ViewPrototype.get(config);
+ return ViewPrototype.UNAVAILABLE_DIAGRAM;
+ }
+ return ViewPrototype.get(diagram.getType(), pvs.getOwner(), diagram.getElement());
+ }
+ // This is the legacy fallback for old diagrams
+ if ("Package".equals(diagram.getType())) {
+ for (ViewPrototype prototype : PolicyChecker.getCurrent().getAllPrototypes()) {
+ if ("UML Package Diagram".equals(prototype.getLabel()))
+ return prototype;
+ }
+ }
+ return ViewPrototype.get(diagram.getType(), diagram.getElement(), diagram.getElement());
+ }
+
+ /**
+ * Sets the prototype of a diagram
+ *
+ * @param diagram
+ * A diagram
+ * @param configuration
+ * The new diagram's prototype
+ */
+ public static void setPrototype(Diagram diagram, ViewPrototype prototype) {
+ Style style = diagram.getStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ if (style != null) {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) style;
+ pvs.setConfiguration(prototype.getConfiguration());
+ } else {
+ PapyrusViewStyle pvs = (PapyrusViewStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_VIEW_STYLE);
+ pvs.setConfiguration(prototype.getConfiguration());
+ }
+ }
+
+
+ /**
+ * Gets the diagrams associated to element.
+ *
+ * @param element
+ * @param resourceSet
+ * can be null, it will then try to retrieve it from the element.
+ * @return the list of diagrams associated with the given element
+ */
+ public static List<Diagram> getAssociatedDiagrams(EObject element, ResourceSet resourceSet) {
+ if(resourceSet == null) {
+ if(element != null && element.eResource() != null) {
+ resourceSet = element.eResource().getResourceSet();
+ }
+ }
+
+ if(resourceSet instanceof ModelSet) {
+ Resource notationResource = NotationUtils.getNotationResource((ModelSet)resourceSet);
+ return getAssociatedDiagramsFromNotationResource(element, notationResource);
+ }
+
+ return Collections.emptyList();
+ }
+
+ /**
+ * Gets the diagrams associated to element.
+ *
+ * @param element
+ * @param notationResource
+ * the notation resource where to look for diagrams
+ * @return the list of diagrams associated with the given element
+ */
+ public static List<Diagram> getAssociatedDiagramsFromNotationResource(EObject element, Resource notationResource) {
+ if(notationResource != null) {
+ LinkedList<Diagram> diagrams = new LinkedList<Diagram>();
+ for(EObject eObj : notationResource.getContents()) {
+ if(eObj instanceof Diagram) {
+ Diagram diagram = (Diagram)eObj;
+ if(element.equals(diagram.getElement())) {
+ diagrams.add(diagram);
+ }
+ }
+ }
+ return diagrams;
+ }
+ return Collections.emptyList();
+ }
+
+
+ /**
+ * Return the diagram containing this view
+ * @param view
+ * @return
+ */
+ public static Diagram getContainingDiagram(final View view) {
+ if(view instanceof Diagram) {
+ return (Diagram)view;
+ }
+ final EObject eContainer = view.eContainer();
+ if(eContainer instanceof View) {
+ return getContainingDiagram((View)eContainer);
+ }
+ return null;
+ }
+
+ /**
+ * Return the type of the diagram containing this view
+ * @param view
+ * @return
+ */
+ public static String getContainingDiagramType(final View view) {
+ Diagram containingDiagram = getContainingDiagram(view);
+ if (containingDiagram != null){
+ return containingDiagram.getType();
+ }
+ return null;
+ }
+}
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/TreeSelectorDialog.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/TreeSelectorDialog.java
index 180995f..9652c92 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/TreeSelectorDialog.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/TreeSelectorDialog.java
@@ -1,263 +1,264 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 408491
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.widgets.editors;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.papyrus.infra.widgets.Activator;
-import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
-import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-/**
- * A Dialog for selecting values. The values are displayed as a Tree. If only
- * some of the values of this Tree should be selectable, you should pass a {@link IHierarchicContentProvider} to this dialog.
- *
- * @author Camille Letavernier
- *
- */
-public class TreeSelectorDialog extends SelectionDialog implements ITreeSelectorDialog {
-
- private ILabelProvider labelProvider;
-
- private ITreeContentProvider contentProvider;
-
- private TreeViewer treeViewer;
-
- private String description;
-
- private Label descriptionLabel;
-
- private Object input = null;
-
- private final Set<ICommitListener> commitListeners = new HashSet<ICommitListener>();
-
- /**
- *
- * Constructor.
- *
- * @param parentShell
- * The parent shell in which this dialog will be opened
- */
- public TreeSelectorDialog(Shell parentShell) {
- super(parentShell);
- }
-
- /**
- * Sets the label provider for this dialog
- *
- * @param provider
- */
- public void setLabelProvider(ILabelProvider provider) {
- labelProvider = provider;
- if(treeViewer != null) {
- treeViewer.setLabelProvider(labelProvider);
- }
- }
-
- /**
- * Sets the ContentProvider for this dialog
- * The ContentProvider may be a {@link IHierarchicContentProvider}
- *
- * @param provider
- * The content provider for this dialog. May be a {@link IHierarchicContentProvider}
- */
- public void setContentProvider(ITreeContentProvider provider) {
- contentProvider = provider;
- if(treeViewer != null) {
- initViewerAndProvider();
- }
- if(contentProvider instanceof ICommitListener) {
- commitListeners.add((ICommitListener)contentProvider);
- }
- }
-
- protected void initViewerAndProvider() {
- treeViewer.setContentProvider(contentProvider);
- if(treeViewer.getInput() == null) {
- doSetInput();
- }
- }
-
- @Override
- protected Composite getDialogArea() {
- return (Composite)super.getDialogArea();
- }
-
- @Override
- public void create() {
- super.create();
-
- descriptionLabel = new Label(getDialogArea(), SWT.WRAP);
- descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- if(description != null) {
- descriptionLabel.setText(description);
- }
-
- treeViewer = new TreeViewer(getDialogArea(), SWT.BORDER);
- // treeViewer.setFilters(new ViewerFilter[]{ new PatternFilter() });
-
- if(labelProvider != null) {
- treeViewer.setLabelProvider(labelProvider);
- }
- if(contentProvider != null) {
- initViewerAndProvider();
- }
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
-
- Object selectedElement = null;
- if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- selectedElement = sSelection.getFirstElement();
- }
-
- if(contentProvider instanceof IHierarchicContentProvider) {
- boolean isValidValue = ((IHierarchicContentProvider)contentProvider).isValidValue(selectedElement);
- if(contentProvider instanceof IAdaptableContentProvider) {
- selectedElement = ((IAdaptableContentProvider)contentProvider).getAdaptedValue(selectedElement);
- }
- if(isValidValue) {
- setResult(Collections.singletonList(selectedElement));
- } else {
- setResult(Collections.EMPTY_LIST);
- }
- getOkButton().setEnabled(isValidValue);
- }
- }
- });
-
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- if(getOkButton().isEnabled()) {
- okPressed();
- }
- }
-
- });
-
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- data.minimumHeight = 300;
- data.minimumWidth = 300;
- treeViewer.getTree().setLayoutData(data);
-
- if(contentProvider instanceof IGraphicalContentProvider) {
- IGraphicalContentProvider graphicalContentProvider = (IGraphicalContentProvider)contentProvider;
-
- Composite beforeTreeComposite = new Composite(getDialogArea(), SWT.NONE);
- beforeTreeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- beforeTreeComposite.setLayout(new FillLayout());
- graphicalContentProvider.createBefore(beforeTreeComposite);
-
- beforeTreeComposite.moveAbove(treeViewer.getTree());
-
- Composite afterTreeComposite = new Composite(getDialogArea(), SWT.NONE);
- afterTreeComposite.setLayout(new FillLayout());
- afterTreeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- graphicalContentProvider.createAfter(afterTreeComposite);
- }
-
- List<?> initialSelection = getInitialElementSelections();
- if(contentProvider instanceof IRevealSemanticElement) {
- ((IRevealSemanticElement)contentProvider).revealSemanticElement(initialSelection);
- } else if(!initialSelection.isEmpty()) {
- //FIXME : When we use an EncapsulatedContentProvider, we'll not get into this case,
- //even if the encapsulated provider is not a IRevealSemanticElement
- treeViewer.setSelection(new StructuredSelection(initialSelection.get(0)), true);
- }
-
- getShell().setDefaultButton(null);
- getButton(OK).setFocus();
- getShell().setImage(Activator.getDefault().getImage("/icons/papyrus.png")); //$NON-NLS-1$
- getShell().pack();
- }
-
- /**
- * Sets the description for this Dialog. The description is displayed on
- * top of the dialog
- *
- * @param description
- * The description for this dialog
- */
- public void setDescription(String description) {
- this.description = description;
-
- if((descriptionLabel != null) && !descriptionLabel.isDisposed()) {
- descriptionLabel.setText(description == null ? "" : description); //$NON-NLS-1$
- }
- }
-
- /**
- * Get the TreeViewer used by this dialog
- *
- * @return
- * The TreeViewer associated to this dialog
- */
- protected TreeViewer getViewer() {
- return treeViewer;
- }
-
- /**
- * Sets the input object for this dialog's TreeViewer
- *
- * @param input
- */
- public void setInput(Object input) {
- this.input = input;
- }
-
- private void doSetInput() {
- if(input == null) {
- //Default non-null input for IStaticContentProvider (input-independent)
- treeViewer.setInput(""); //$NON-NLS-1$
- } else {
- treeViewer.setInput(input);
- }
- }
-
- @Override
- public void okPressed() {
- for(ICommitListener listener : commitListeners) {
- listener.commit(null);
- }
- super.okPressed();
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 408491
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.widgets.editors;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IGraphicalContentProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
+import org.eclipse.papyrus.infra.widgets.util.IRevealSemanticElement;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * A Dialog for selecting values. The values are displayed as a Tree. If only
+ * some of the values of this Tree should be selectable, you should pass a {@link IHierarchicContentProvider} to this dialog.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class TreeSelectorDialog extends SelectionDialog implements ITreeSelectorDialog {
+
+ private ILabelProvider labelProvider;
+
+ private ITreeContentProvider contentProvider;
+
+ private TreeViewer treeViewer;
+
+ private String description;
+
+ private Label descriptionLabel;
+
+ private Object input = null;
+
+ private final Set<ICommitListener> commitListeners = new HashSet<ICommitListener>();
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell
+ * The parent shell in which this dialog will be opened
+ */
+ public TreeSelectorDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ /**
+ * Sets the label provider for this dialog
+ *
+ * @param provider
+ */
+ public void setLabelProvider(ILabelProvider provider) {
+ labelProvider = provider;
+ if(treeViewer != null) {
+ treeViewer.setLabelProvider(labelProvider);
+ }
+ }
+
+ /**
+ * Sets the ContentProvider for this dialog
+ * The ContentProvider may be a {@link IHierarchicContentProvider}
+ *
+ * @param provider
+ * The content provider for this dialog. May be a {@link IHierarchicContentProvider}
+ */
+ public void setContentProvider(ITreeContentProvider provider) {
+ contentProvider = provider;
+ if(treeViewer != null) {
+ initViewerAndProvider();
+ }
+ if(contentProvider instanceof ICommitListener) {
+ commitListeners.add((ICommitListener)contentProvider);
+ }
+ }
+
+ protected void initViewerAndProvider() {
+ treeViewer.setContentProvider(contentProvider);
+ if(treeViewer.getInput() == null) {
+ doSetInput();
+ }
+ }
+
+ @Override
+ protected Composite getDialogArea() {
+ return (Composite)super.getDialogArea();
+ }
+
+ @Override
+ public void create() {
+ super.create();
+
+ descriptionLabel = new Label(getDialogArea(), SWT.WRAP);
+ descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ if(description != null) {
+ descriptionLabel.setText(description);
+ }
+
+ treeViewer = new TreeViewer(getDialogArea(), SWT.BORDER);
+ // treeViewer.setFilters(new ViewerFilter[]{ new PatternFilter() });
+
+ if(labelProvider != null) {
+ treeViewer.setLabelProvider(labelProvider);
+ }
+ if(contentProvider != null) {
+ initViewerAndProvider();
+ }
+
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+
+ Object selectedElement = null;
+ if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ IStructuredSelection sSelection = (IStructuredSelection)selection;
+ selectedElement = sSelection.getFirstElement();
+ }
+
+ if(contentProvider instanceof IHierarchicContentProvider) {
+ boolean isValidValue = ((IHierarchicContentProvider)contentProvider).isValidValue(selectedElement);
+ if(contentProvider instanceof IAdaptableContentProvider) {
+ selectedElement = ((IAdaptableContentProvider)contentProvider).getAdaptedValue(selectedElement);
+ }
+ if(isValidValue) {
+ setResult(Collections.singletonList(selectedElement));
+ } else {
+ setResult(Collections.EMPTY_LIST);
+ }
+ getOkButton().setEnabled(isValidValue);
+ }
+ }
+ });
+
+ treeViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ if(getOkButton().isEnabled()) {
+ okPressed();
+ }
+ }
+
+ });
+
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.minimumHeight = 300;
+ data.minimumWidth = 300;
+ treeViewer.getTree().setLayoutData(data);
+
+ if(contentProvider instanceof IGraphicalContentProvider) {
+ IGraphicalContentProvider graphicalContentProvider = (IGraphicalContentProvider)contentProvider;
+
+ Composite beforeTreeComposite = new Composite(getDialogArea(), SWT.NONE);
+ beforeTreeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ beforeTreeComposite.setLayout(new FillLayout());
+ graphicalContentProvider.createBefore(beforeTreeComposite);
+
+ beforeTreeComposite.moveAbove(treeViewer.getTree());
+
+ Composite afterTreeComposite = new Composite(getDialogArea(), SWT.NONE);
+ afterTreeComposite.setLayout(new FillLayout());
+ afterTreeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ graphicalContentProvider.createAfter(afterTreeComposite);
+ }
+
+ List<?> initialSelection = getInitialElementSelections();
+ if(contentProvider instanceof IRevealSemanticElement) {
+ ((IRevealSemanticElement)contentProvider).revealSemanticElement(initialSelection);
+ } else if(!initialSelection.isEmpty()) {
+ //FIXME : When we use an EncapsulatedContentProvider, we'll not get into this case,
+ //even if the encapsulated provider is not a IRevealSemanticElement
+ treeViewer.setSelection(new StructuredSelection(initialSelection.get(0)), true);
+ }
+
+ getShell().setDefaultButton(null);
+ getButton(OK).setFocus();
+ getShell().setImage(Activator.getDefault().getImage("/icons/papyrus.png")); //$NON-NLS-1$
+ getShell().pack();
+
+ }
+
+ /**
+ * Sets the description for this Dialog. The description is displayed on
+ * top of the dialog
+ *
+ * @param description
+ * The description for this dialog
+ */
+ public void setDescription(String description) {
+ this.description = description;
+
+ if((descriptionLabel != null) && !descriptionLabel.isDisposed()) {
+ descriptionLabel.setText(description == null ? "" : description); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Get the TreeViewer used by this dialog
+ *
+ * @return
+ * The TreeViewer associated to this dialog
+ */
+ protected TreeViewer getViewer() {
+ return treeViewer;
+ }
+
+ /**
+ * Sets the input object for this dialog's TreeViewer
+ *
+ * @param input
+ */
+ public void setInput(Object input) {
+ this.input = input;
+ }
+
+ private void doSetInput() {
+ if(input == null) {
+ //Default non-null input for IStaticContentProvider (input-independent)
+ treeViewer.setInput(""); //$NON-NLS-1$
+ } else {
+ treeViewer.setInput(input);
+ }
+ }
+
+ @Override
+ public void okPressed() {
+ for(ICommitListener listener : commitListeners) {
+ listener.commit(null);
+ }
+ super.okPressed();
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CallBehaviorActionToInteractionDropStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CallBehaviorActionToInteractionDropStrategy.java
index 7d14669..babe38d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CallBehaviorActionToInteractionDropStrategy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CallBehaviorActionToInteractionDropStrategy.java
@@ -1,95 +1,119 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.TransactionalDropStrategy;
-import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.Activator;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
-import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.CallBehaviorAction;
-import org.eclipse.uml2.uml.UMLPackage;
-
-public class CallBehaviorActionToInteractionDropStrategy extends
- TransactionalDropStrategy {
-
- private static final EStructuralFeature feature = UMLPackage.eINSTANCE.getActivity_Node();
-
- public String getLabel() {
- return "CallBehaviorAction drop into Interaction with snapshot";
- }
-
- public String getDescription() {
- return "CallBehaviorAction drop into Interaction with snapshot";
- }
-
- public Image getImage() {
- return null;
- }
-
- public String getID() {
- return Activator.PLUGIN_ID + ".callBehaviorActionDrop";
- }
-
- public int getPriority() {
- return 0;
- }
-
- @Override
- protected Command doGetCommand(Request request, EditPart targetEditPart) {
- if( request instanceof CreateAspectUnspecifiedTypeConnectionRequest){
- return null;
- }
- CompositeCommand cc = new CompositeCommand(getLabel());
-
- EObject semanticElement = getTargetSemanticElement(targetEditPart);
- List<EObject> sourceElements = getSourceEObjects(request);
- List<CallBehaviorAction> valuesToAdd = new ArrayList<CallBehaviorAction>(sourceElements.size());
- for(EObject sourceElement : sourceElements) {
- if(!(sourceElement instanceof CallBehaviorAction)) {
- return null;
- }
- valuesToAdd.add((CallBehaviorAction)sourceElement);
- }
-
- if(!(semanticElement instanceof Activity)) {
- return null;
- }
- for (CallBehaviorAction callBehaviorAction : valuesToAdd) {
- cc.add(new CommandProxy(new RefreshCommandForUndo((GraphicalEditPart)targetEditPart)));
- ICommand dropCommand = new DropInteractionWithSnapshotCommand(getTransactionalEditingDomain(targetEditPart), (IGraphicalEditPart)targetEditPart, callBehaviorAction, "Drop CallBehaviorAction as Interaction");
- cc.add(dropCommand);
- CreateSnapshotForInteractionFromViewDescriptorCommand snapshotCommand = new CreateSnapshotForInteractionFromViewDescriptorCommand(getTransactionalEditingDomain(targetEditPart), dropCommand, (GraphicalEditPart)targetEditPart);
- cc.add(snapshotCommand);
- cc.add(new AddHyperlinkDiagram(dropCommand, snapshotCommand));
- cc.add(new CommandProxy(new RefreshCommandForDo((GraphicalEditPart)targetEditPart)));
- }
-
- return cc.canExecute() ? new ICommandProxy(cc.reduce()) : null;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.TransactionalDropStrategy;
+import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.Activator;
+import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
+import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.CallBehaviorAction;
+
+public class CallBehaviorActionToInteractionDropStrategy extends TransactionalDropStrategy {
+
+ public String getLabel() {
+ return "CallBehaviorAction drop into Interaction with snapshot";
+ }
+
+ public String getDescription() {
+ return "CallBehaviorAction drop into Interaction with snapshot";
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public String getID() {
+ return Activator.PLUGIN_ID + ".callBehaviorActionDrop";
+ }
+
+ public int getPriority() {
+ return 0;
+ }
+
+ @Override
+ protected Command doGetCommand(Request request, EditPart targetEditPart) {
+ if(request instanceof CreateAspectUnspecifiedTypeConnectionRequest) {
+ return null;
+ }
+ View targetView = getTargetView(targetEditPart);
+ String containingDiagramType = org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getContainingDiagramType(targetView);
+
+ if(!ElementTypes.DIAGRAM_ID.equals(containingDiagramType)) {
+ return null; // Strategy available only for Interaction Overview
+ }
+ EObject semanticElement = getTargetSemanticElement(targetEditPart);
+ if(!(semanticElement instanceof Activity)) {
+ return null;
+ }
+ CompositeCommand cc = new CompositeCommand(getLabel());
+ List<EObject> sourceElements = getSourceEObjects(request);
+ List<CallBehaviorAction> callBehaviorActionToDrop = new ArrayList<CallBehaviorAction>(sourceElements.size());
+ for(EObject sourceElement : sourceElements) {
+ if(!(sourceElement instanceof CallBehaviorAction)) {
+ return null;
+ }
+ callBehaviorActionToDrop.add((CallBehaviorAction)sourceElement);
+ }
+ for(CallBehaviorAction callBehaviorAction : callBehaviorActionToDrop) {
+ if (callBehaviorAction.getBehavior() != null){ // Strategy available only for Interaction Overview
+ CompositeCommand callBehaviorActionToInteractionDropCommand = callBehaviorActionToInteractionDropCommand((GraphicalEditPart)targetEditPart, callBehaviorAction);
+ cc.add(callBehaviorActionToInteractionDropCommand);
+ }
+ }
+ return cc.canExecute() ? new ICommandProxy(cc.reduce()) : null;
+ }
+
+ protected CompositeCommand callBehaviorActionToInteractionDropCommand(GraphicalEditPart targetEditPart, CallBehaviorAction callBehaviorAction) {
+ CompositeCommand cc = new CompositeCommand(getLabel()+" for "+callBehaviorAction.getName());
+ cc.add(new CommandProxy(new RefreshCommandForUndo(targetEditPart)));
+ ICommand dropCommand = new DropInteractionWithSnapshotCommand(getTransactionalEditingDomain(targetEditPart), (IGraphicalEditPart)targetEditPart, callBehaviorAction, "Drop CallBehaviorAction as Interaction");
+ cc.add(dropCommand);
+ CreateSnapshotForInteractionFromViewDescriptorCommand snapshotCommand = new CreateSnapshotForInteractionFromViewDescriptorCommand(getTransactionalEditingDomain(targetEditPart), dropCommand, (GraphicalEditPart)targetEditPart);
+ cc.add(snapshotCommand);
+ cc.add(new AddHyperlinkDiagram(dropCommand, snapshotCommand));
+ cc.add(new CommandProxy(new RefreshCommandForDo(targetEditPart)));
+ return cc;
+ }
+
+ public static String getContainingDiagramType(final View view) {
+ if(view instanceof Diagram) {
+ final Diagram diagram = (Diagram)view;
+ return diagram.getType();
+ }
+ final EObject eContainer = view.eContainer();
+ if(eContainer instanceof View) {
+ final View parentView = (View)eContainer;
+ return getContainingDiagramType(parentView);
+ }
+ return null;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
index ac92647..ce157ae 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview.tests/src/org/eclipse/papyrus/uml/diagram/interactionoverview/tests/canonical/AbstractInteractionOverviewDiagramTestCase.java
@@ -57,7 +57,7 @@ import org.eclipse.papyrus.diagram.tests.canonical.AbstractPapyrusTestCase;
import org.eclipse.papyrus.diagram.tests.canonical.TestChildNode;
import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityActivityContentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.common.command.wrappers.GEFtoEMFCommandWrapper;
+import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart;
import org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor;
import org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand;