Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Le Menez2017-08-24 13:36:50 +0000
committerQuentin Le Menez2017-08-25 07:29:37 +0000
commit506aba029700c33524807a8fa3167a8b9fa99dbb (patch)
treefb84aca71627d4f1ab2a71ced6e8180d944d5ed2
parentb9185064e9e8cd6074dc65011b4be1d9451cf11f (diff)
downloadorg.eclipse.papyrus-506aba029700c33524807a8fa3167a8b9fa99dbb.tar.gz
org.eclipse.papyrus-506aba029700c33524807a8fa3167a8b9fa99dbb.tar.xz
org.eclipse.papyrus-506aba029700c33524807a8fa3167a8b9fa99dbb.zip
Bug 516438 - [InteractionOverviewDiagram] make this diagram independent from other diagrams
- removed the sequence dependencies - duplicated the necessary attributes to do so and added the tags @since and nls when necessary - corrected some warnings Change-Id: I2acce9e58d927804c474f523b084244a66d9e59a Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF1
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromRefreshCommand.java22
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromViewDescriptorCommand.java23
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/provider/DiagramContentProvider.java13
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/utils/CreateDiagramImage.java43
5 files changed, 59 insertions, 43 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF
index 4ff8d8eeb09..fdc908c8f6a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/META-INF/MANIFEST.MF
@@ -17,7 +17,6 @@ Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="[1.
org.eclipse.papyrus.uml.diagram.activity;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)",
org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="[1.7.0,2.0.0)",
- org.eclipse.papyrus.uml.diagram.sequence;bundle-version="[3.0.0,4.0.0)";resolution:=optional,
org.eclipse.papyrus.uml.diagram.stereotype.edition;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.uml.diagram.modelexplorer;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.uml.diagram.communication;bundle-version="[3.0.0,4.0.0)",
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromRefreshCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromRefreshCommand.java
index 3723a2e5e9d..b7f3882714a 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromRefreshCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromRefreshCommand.java
@@ -39,8 +39,6 @@ import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.CallBehaviorUti
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.CreateDiagramImage;
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.DiagramUtils;
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.URIUtils;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.CallBehaviorAction;
@@ -51,12 +49,22 @@ public class CreateSnapshotForInteractionFromRefreshCommand extends AbstractTran
/**
* @since 3.0
*/
- protected static final String ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING = "org.eclipse.papyrus.uml.diagram.timing";
+ protected static final String ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING = "org.eclipse.papyrus.uml.diagram.timing"; //$NON-NLS-1$
/**
* @since 3.0
*/
- protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram";
+ protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ protected final static String PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID = "PapyrusUMLSequenceDiagram"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ protected static final PreferencesHint PAPYRUS_SEQUENCE_DIAGRAM_PREFERENCES_HINT = new PreferencesHint("org.eclipse.papyrus.uml.diagram.sequence"); //$NON-NLS-1$
protected View callBehaviorView;
@@ -131,10 +139,10 @@ public class CreateSnapshotForInteractionFromRefreshCommand extends AbstractTran
}
protected PreferencesHint getReferenceHint(final String type) {
- if (SequenceDiagramEditPart.MODEL_ID.equals(type)) {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ if (PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID.equals(type)) {
+ return PAPYRUS_SEQUENCE_DIAGRAM_PREFERENCES_HINT;
} else if (PAPYRUS_UML_TIMING_DIAGRAM.equals(type)) {
- return new PreferencesHint(ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING);
+ return new PreferencesHint(ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING);
} else if (InteractionOverviewDiagramEditPart.MODEL_ID.equals(type)) {
return Activator.DIAGRAM_PREFERENCES_HINT;
} else if (ModelEditPart.MODEL_ID.equals(type)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromViewDescriptorCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromViewDescriptorCommand.java
index 62235496fef..0f02ddbd9db 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromViewDescriptorCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/CreateSnapshotForInteractionFromViewDescriptorCommand.java
@@ -46,8 +46,6 @@ import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.DiagramConte
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.CallBehaviorUtil;
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.CreateDiagramImage;
import org.eclipse.papyrus.uml.diagram.interactionoverview.utils.URIUtils;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
@@ -61,12 +59,22 @@ public class CreateSnapshotForInteractionFromViewDescriptorCommand extends Abstr
/**
* @since 3.0
*/
- protected static final String ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING = "org.eclipse.papyrus.uml.diagram.timing";
+ protected static final String ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING = "org.eclipse.papyrus.uml.diagram.timing"; //$NON-NLS-1$
/**
* @since 3.0
*/
- protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram";
+ protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ protected final static String PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID = "PapyrusUMLSequenceDiagram"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ protected static final PreferencesHint PAPYRUS_SEQUENCE_DIAGRAM_PREFERENCES_HINT = new PreferencesHint("org.eclipse.papyrus.uml.diagram.sequence"); //$NON-NLS-1$
protected ICommand createElementCommand;
@@ -150,8 +158,8 @@ public class CreateSnapshotForInteractionFromViewDescriptorCommand extends Abstr
}
protected PreferencesHint getReferenceHint(final String type) {
- if (SequenceDiagramEditPart.MODEL_ID.equals(type)) {
- return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ if (PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID.equals(type)) {
+ return PAPYRUS_SEQUENCE_DIAGRAM_PREFERENCES_HINT;
} else if (PAPYRUS_UML_TIMING_DIAGRAM.equals(type)) {
return new PreferencesHint(ORG_ECLIPSE_PAPYRUS_UML_DIAGRAM_TIMING);
} else if (InteractionOverviewDiagramEditPart.MODEL_ID.equals(type)) {
@@ -206,8 +214,7 @@ public class CreateSnapshotForInteractionFromViewDescriptorCommand extends Abstr
dialog.setTitle(Messages.CreateSnapshotForInteractionFromViewDescriptorCommand_DiagramSelectorTitle);
if (dialog.open() == org.eclipse.jface.window.Window.OK) {
final Object[] result = dialog.getResult();
- if (result != null && result.length > 0)
- {
+ if (result != null && result.length > 0) {
return (Diagram) EMFHelper.getEObject(result[0]);// (Diagram)(((ModelElementItem)result[0]).getEObject());
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/provider/DiagramContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/provider/DiagramContentProvider.java
index 93105bbe2d3..5dd31ae0e31 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/provider/DiagramContentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/provider/DiagramContentProvider.java
@@ -24,7 +24,6 @@ import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
import org.eclipse.papyrus.uml.diagram.communication.edit.parts.ModelEditPart;
import org.eclipse.papyrus.uml.diagram.interactionoverview.Activator;
import org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.InteractionOverviewDiagramEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.SequenceDiagramEditPart;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Interaction;
@@ -39,7 +38,13 @@ public class DiagramContentProvider extends MoDiscoContentProvider implements IH
/**
* @since 3.0
*/
- protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram";
+ protected static final String PAPYRUS_UML_TIMING_DIAGRAM = "PapyrusUMLTimingDiagram"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ protected final static String PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID = "PapyrusUMLSequenceDiagram"; //$NON-NLS-1$
+
private final Interaction interaction;
public DiagramContentProvider(final Interaction interation) {
@@ -60,7 +65,7 @@ public class DiagramContentProvider extends MoDiscoContentProvider implements IH
modelSet = ModelUtils.getModelSetChecked(servicesRegistry);
pageMngr = servicesRegistry.getService(IPageManager.class);
- final ArrayList<EObject> result = new ArrayList<EObject>();
+ final ArrayList<EObject> result = new ArrayList<>();
final List<Object> list = pageMngr.allPages();
for (int i = 0; i < list.size(); i++) {
final Object element = pageMngr.allPages().get(i);
@@ -81,7 +86,7 @@ public class DiagramContentProvider extends MoDiscoContentProvider implements IH
private boolean isValidDiagram(final Diagram diagram) {
// seqDiagram or comDiagram
- if (diagram.getType().equals(SequenceDiagramEditPart.MODEL_ID) || diagram.getType().equals(ModelEditPart.MODEL_ID)) {
+ if (diagram.getType().equals(PAPYRUS_SEQUENCE_DIAGRAM_MODEL_ID) || diagram.getType().equals(ModelEditPart.MODEL_ID)) {
if (diagram.getElement().equals(interaction)) {
return true;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/utils/CreateDiagramImage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/utils/CreateDiagramImage.java
index d0e06d7a900..b6b3f8dab2b 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/utils/CreateDiagramImage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/utils/CreateDiagramImage.java
@@ -40,10 +40,8 @@ import org.eclipse.papyrus.infra.widgets.providers.FilteredContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
-import org.eclipse.papyrus.uml.diagram.communication.edit.parts.LifelineEditPartCN;
import org.eclipse.papyrus.uml.diagram.interactionoverview.Activator;
import org.eclipse.papyrus.uml.diagram.interactionoverview.part.Messages;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
@@ -78,29 +76,28 @@ public class CreateDiagramImage {
if (CallBehaviorUtil.isBehaviorNew(callBehaviorActionView)) {
CallBehaviorUtil.setBehaviorAsNonNew(callBehaviorActionView);
- final List selectedLifelines = Arrays.asList(selectLifelines(lifelines));
- final List removedLifeline = new ArrayList(lifelines);
+ final List<Object> selectedLifelines = Arrays.asList(selectLifelines(lifelines));
+ final List<GraphicalEditPart> removedLifeline = new ArrayList<>(lifelines);
removedLifeline.removeAll(selectedLifelines);
- final List removedLifelineCopyForIterate = new ArrayList(removedLifeline);
- for (final Iterator iterator = removedLifelineCopyForIterate.iterator(); iterator.hasNext();) {
+ final List<GraphicalEditPart> removedLifelineCopyForIterate = new ArrayList<>(removedLifeline);
+ for (final Iterator<GraphicalEditPart> iterator = removedLifelineCopyForIterate.iterator(); iterator.hasNext();) {
final Object object = iterator.next();
getAllChildren((GraphicalEditPart) object, removedLifeline);
}
- final List<GraphicalEditPart> filteredEditParts = new ArrayList<GraphicalEditPart>(editParts);
- for (final Iterator iterator = editParts.iterator(); iterator.hasNext();) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) iterator.next();
+ for (final Iterator<GraphicalEditPart> iterator = editParts.iterator(); iterator.hasNext();) {
+ final GraphicalEditPart graphicalEditPart = iterator.next();
if (removedLifeline.contains(graphicalEditPart)) {
graphicalEditPart.getFigure().setVisible(false);
final View view = (View) graphicalEditPart.getModel();
if (view.getElement() != null && view.getElement() instanceof NamedElement) {
CallBehaviorUtil.addLifelineQualifiedNames(callBehaviorActionView, ((NamedElement) (view.getElement())).getQualifiedName());
}
- for (final Iterator iterator2 = graphicalEditPart.getSourceConnections().iterator(); iterator2.hasNext();) {
+ for (final Iterator<?> iterator2 = graphicalEditPart.getSourceConnections().iterator(); iterator2.hasNext();) {
final GraphicalEditPart source = (GraphicalEditPart) iterator2.next();
source.getFigure().setVisible(false);
}
- for (final Iterator iterator2 = graphicalEditPart.getTargetConnections().iterator(); iterator2.hasNext();) {
+ for (final Iterator<?> iterator2 = graphicalEditPart.getTargetConnections().iterator(); iterator2.hasNext();) {
final GraphicalEditPart source = (GraphicalEditPart) iterator2.next();
source.getFigure().setVisible(false);
}
@@ -108,18 +105,18 @@ public class CreateDiagramImage {
}
} else {
final List<String> qualifiedNames = CallBehaviorUtil.getRemovedLifelinesQualifiedNames(callBehaviorActionView);
- for (final Iterator iterator = editParts.iterator(); iterator.hasNext();) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) iterator.next();
+ for (final Iterator<GraphicalEditPart> iterator = editParts.iterator(); iterator.hasNext();) {
+ final GraphicalEditPart graphicalEditPart = iterator.next();
final View view = (View) graphicalEditPart.getModel();
if (view.getElement() != null && view.getElement() instanceof Lifeline) {
final String qualifiedName = ((Lifeline) (view.getElement())).getQualifiedName();
if (qualifiedNames.contains(qualifiedName)) {
graphicalEditPart.getFigure().setVisible(false);
- for (final Iterator iterator2 = graphicalEditPart.getSourceConnections().iterator(); iterator2.hasNext();) {
+ for (final Iterator<?> iterator2 = graphicalEditPart.getSourceConnections().iterator(); iterator2.hasNext();) {
final GraphicalEditPart source = (GraphicalEditPart) iterator2.next();
source.getFigure().setVisible(false);
}
- for (final Iterator iterator2 = graphicalEditPart.getTargetConnections().iterator(); iterator2.hasNext();) {
+ for (final Iterator<?> iterator2 = graphicalEditPart.getTargetConnections().iterator(); iterator2.hasNext();) {
final GraphicalEditPart source = (GraphicalEditPart) iterator2.next();
source.getFigure().setVisible(false);
}
@@ -173,14 +170,14 @@ public class CreateDiagramImage {
}
private static List<GraphicalEditPart> getAllLifeline(final List<GraphicalEditPart> editParts) {
- final List<GraphicalEditPart> allChild = new ArrayList<GraphicalEditPart>();
- for (final Iterator iterator = editParts.iterator(); iterator.hasNext();) {
- final GraphicalEditPart editPart = (GraphicalEditPart) iterator.next();
+ final List<GraphicalEditPart> allChild = new ArrayList<>();
+ for (final Iterator<GraphicalEditPart> iterator = editParts.iterator(); iterator.hasNext();) {
+ final GraphicalEditPart editPart = iterator.next();
getAllChildren(editPart, allChild);
}
- final List<GraphicalEditPart> lifelines = new ArrayList<GraphicalEditPart>();
- for (final Iterator iterator = allChild.iterator(); iterator.hasNext();) {
- final GraphicalEditPart graphicalEditPart = (GraphicalEditPart) iterator.next();
+ final List<GraphicalEditPart> lifelines = new ArrayList<>();
+ for (final Iterator<GraphicalEditPart> iterator = allChild.iterator(); iterator.hasNext();) {
+ final GraphicalEditPart graphicalEditPart = iterator.next();
if (isValidLifelineEditPart(graphicalEditPart)) {
lifelines.add(graphicalEditPart);
}
@@ -189,8 +186,8 @@ public class CreateDiagramImage {
}
private static boolean isValidLifelineEditPart(final GraphicalEditPart graphicalEditPart) {
- if(graphicalEditPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart ) {
- if(((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) graphicalEditPart).resolveSemanticElement() instanceof Lifeline){
+ if (graphicalEditPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) {
+ if (((org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart) graphicalEditPart).resolveSemanticElement() instanceof Lifeline) {
return true;
}
}

Back to the top