Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2015-12-02 14:45:38 +0000
committerGerrit Code Review @ Eclipse.org2015-12-04 12:59:05 +0000
commitf8dedc59a0e9bc39beaa61b7a8c2cad1252c9438 (patch)
tree0e03fa04aaa10fd1c0c48028dec5a61b64bd06c9 /extraplugins
parent1f171bd0213d10d1d791f622e7ebf0b6484c40c5 (diff)
downloadorg.eclipse.papyrus-f8dedc59a0e9bc39beaa61b7a8c2cad1252c9438.tar.gz
org.eclipse.papyrus-f8dedc59a0e9bc39beaa61b7a8c2cad1252c9438.tar.xz
org.eclipse.papyrus-f8dedc59a0e9bc39beaa61b7a8c2cad1252c9438.zip
Bug 477384: [Canonical] Should not use drop requests to create views
https://bugs.eclipse.org/bugs/show_bug.cgi?id=477384 Changes to core APIs to remove PapyrusCanonicalEditPolicy's dependence on the generated diagram drag-and-drop behavior: * extract the CommonDiagramDragDropEditPolicy's abstract API for information about diagram-specific view types into a new service * update the canonical edit-policy and diagram-to-diagram synchronization infrastructure to use the new VisualTypeService to obtain information about the diagram's specific view types to then let the view service create views without resorting to drop commands * update extensions of various canonical strategies in the UML diagrams to adapt to the new drop-free synchronization mechanism Update the Papyrus Diagram GMFGen extensions and code generation templates to add generation of the IVisualTypeProvider that plugs into the new VisualTypeService to support canonical synchronization and drag-and-drop. Includes regeneration of the GMFGen extension model using EMF's most recent templates, which result in minor changes to most model source files. Regenerate all UML diagrams to create and register the visual type provider extensions. Also update the BREE for diagrams to 1.8 because at least one of them requires Java 8 to compile properly. * Note that the interaction overview diagram uses a code generator that is not published on Eclipse.org, so I had to emulate the code generation step for this one * Note also that the SysML 1.1 diagrams likewise cannot be re-generated but, moreover, they do not implement the common pattern for Visual ID Registry, so they are also updated "by hand" for parity with the Mars implementation of drag-and-drop (which had gaps) Deprecate the ICreationTargetStrategy extension API which was only needed to redirect drag-and-drop requests, but these are no longer employed in the canonical synchronization. Also some fixes for region layout problems in the State Machine Diagram: * update custom creation edit policies to re-use the commands used by drag-and-drop and untargeted creation that perform initial placement of new regions * fix the GMFGen to register the custom creation edit policy for the state machine compartment Change-Id: I3afc68d6f0f1bfe05e336c9138a7f1acbc8f643b
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineRegionsSyncFeature.java25
-rw-r--r--extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineTransitionsSyncFeature.java23
2 files changed, 12 insertions, 36 deletions
diff --git a/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineRegionsSyncFeature.java b/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineRegionsSyncFeature.java
index cef6baea4be..85d72e8f3cc 100644
--- a/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineRegionsSyncFeature.java
+++ b/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineRegionsSyncFeature.java
@@ -16,8 +16,6 @@ package org.eclipse.papyrus.umlrt.ui.internal.sync.statemachine;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.papyrus.infra.sync.SyncBucket;
import org.eclipse.papyrus.umlrt.ui.internal.sync.UMLRTChildNodesSyncFeature;
import org.eclipse.papyrus.umlrt.ui.internal.sync.UMLRTSyncRegistry;
@@ -26,8 +24,6 @@ import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.StateMachine;
-import com.google.common.collect.Iterables;
-
/**
* Synchronization feature for the edit-parts visualizing the regions of a state machine
*/
@@ -55,25 +51,4 @@ public class StateMachineRegionsSyncFeature<M extends Element> extends UMLRTChil
? ((State) model).getRegions()
: ECollections.<Region> emptyEList();
}
-
- /**
- * Regions fill the entire contents of a state machine or composite state, so new regions must be dropped
- * on the shape compartment of some existing region because there is no state machine or state
- * area uncovered on which they could be dropped.
- */
- @Override
- protected EditPart getTargetEditPart(EditPart parentEditPart, DropObjectsRequest dropObjectsRequest) {
- EditPart result;
-
- if (getModelOf(parentEditPart) instanceof StateMachine) {
- // Have to dig in through the initial region
- parentEditPart = (EditPart) parentEditPart.getChildren().get(0);
- result = Iterables.getFirst(Iterables.filter(parentEditPart.getChildren(), ShapeCompartmentEditPart.class), parentEditPart);
- } else {
- // The state-machine diagram expects to drop on the State, not its compartment
- result = parentEditPart.getParent();// super.getTargetEditPart(parentEditPart, dropObjectsRequest);
- }
-
- return result;
- }
}
diff --git a/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineTransitionsSyncFeature.java b/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineTransitionsSyncFeature.java
index 437a101eed1..16f5f1327b5 100644
--- a/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineTransitionsSyncFeature.java
+++ b/extraplugins/umlrt/org.eclipse.papyrus.umlrt.ui/src/org/eclipse/papyrus/umlrt/ui/internal/sync/statemachine/StateMachineTransitionsSyncFeature.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.infra.sync.SyncBucket;
@@ -31,7 +30,6 @@ import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.State;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.Transition;
-import org.eclipse.uml2.uml.Vertex;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Iterables;
@@ -57,15 +55,6 @@ public class StateMachineTransitionsSyncFeature extends UMLRTDiagramEdgesSyncFea
}
@Override
- protected EditPart getTargetEditPart(EditPart parentEditPart, DropObjectsRequest dropObjectsRequest) {
- // Get the parent edit-part of the source vertex's edit-part
- Transition transition = (Transition) dropObjectsRequest.getObjects().get(0);
- Vertex source = transition.getSource();
- EditPart sourceEditPart = findEditPart(parentEditPart, source);
- return sourceEditPart.getParent();
- }
-
- @Override
protected Iterable<? extends Transition> getModelContents(final StateMachine model) {
return new Iterable<Transition>() {
@Override
@@ -130,4 +119,16 @@ public class StateMachineTransitionsSyncFeature extends UMLRTDiagramEdgesSyncFea
return result;
}
+
+ @Override
+ protected EObject getSourceElement(EObject connectionElement) {
+ return ((Transition) connectionElement).getSource();
+ }
+
+ @Override
+ protected EObject getTargetElement(EObject connectionElement) {
+ return ((Transition) connectionElement).getTarget();
+ }
+
+
}

Back to the top