11
11
*/
12
12
package org .obeonetwork .bpmn2 .design ;
13
13
14
- import java .util .Set ;
15
-
16
14
import org .eclipse .core .runtime .NullProgressMonitor ;
17
15
import org .eclipse .emf .common .util .EList ;
18
16
import org .eclipse .emf .ecore .EObject ;
19
17
import org .eclipse .emf .ecore .EStructuralFeature ;
20
18
import org .eclipse .gmf .runtime .notation .Bounds ;
21
19
import org .eclipse .gmf .runtime .notation .Node ;
22
- import org .eclipse .gmf .runtime .notation .View ;
23
20
import org .eclipse .sirius .business .api .dialect .DialectManager ;
24
21
import org .eclipse .sirius .diagram .DDiagramElement ;
25
22
import org .eclipse .sirius .diagram .DDiagramElementContainer ;
26
- import org .eclipse .sirius .diagram .DNode ;
27
- import org .eclipse .sirius .diagram .business .api .refresh .CanonicalSynchronizer ;
28
- import org .eclipse .sirius .diagram .business .api .refresh .CanonicalSynchronizerFactory ;
29
23
import org .eclipse .sirius .diagram .ui .business .api .view .SiriusGMFHelper ;
30
- import org .eclipse .sirius .diagram .ui .business .api .view .SiriusLayoutDataManager ;
31
24
import org .obeonetwork .dsl .bpmn2 .Lane ;
32
25
import org .obeonetwork .dsl .bpmn2 .LaneSet ;
33
26
@@ -53,40 +46,6 @@ public void down(Lane lane) {
53
46
}
54
47
}
55
48
56
- /**
57
- * This method fix the position of a new element created from contextual menu.
58
- *
59
- * @param currentNode the node where the contextual menu displayed
60
- * @param newNode the new element to create
61
- *
62
- * @author atakarabt
63
- */
64
- public void positionRelativeToCurrent (EObject currentNode , EObject newNode ) {
65
- if (currentNode instanceof DNode && newNode instanceof DNode ) {
66
- DNode currentDNode = (DNode ) currentNode ;
67
- DNode newDNode = (DNode ) newNode ;
68
- // Retrieve GMF nodes associated with our graphical nodes
69
- Node firstNode = SiriusGMFHelper .getGmfNode (currentDNode );
70
- Bounds firstBounds = (Bounds ) firstNode .getLayoutConstraint ();
71
- // Launch refresh so that GMF view corresponding to the newDNode are created
72
- CanonicalSynchronizer canonicalSynchronizer = CanonicalSynchronizerFactory .INSTANCE
73
- .createCanonicalSynchronizer (firstNode .getDiagram ());
74
- canonicalSynchronizer .synchronize ();
75
- Node secondNode = SiriusGMFHelper .getGmfNode (newDNode );
76
- Bounds secondBounds = (Bounds ) secondNode .getLayoutConstraint ();
77
- // Make sure that the created view will never be arranged
78
- Set <View > createdViewsToArrange = SiriusLayoutDataManager .INSTANCE .getCreatedViewWithCenterLayout ()
79
- .get (secondNode .getDiagram ());
80
- if (createdViewsToArrange != null ) {
81
- createdViewsToArrange .remove (secondNode );
82
- }
83
- // Set bounds for this new node
84
- secondBounds .setX (firstBounds .getX () + 150 );
85
- secondBounds .setY (firstBounds .getY ());
86
-
87
- }
88
- }
89
-
90
49
public DDiagramElementContainer lanesAutoSize (final DDiagramElementContainer laneSetContainer ) {
91
50
Node laneSetNode = SiriusGMFHelper .getGmfNode (laneSetContainer );
92
51
Bounds laneSetBounds = (Bounds ) laneSetNode .getLayoutConstraint ();
@@ -116,11 +75,11 @@ public EObject moveElement(EObject referenceOwner, String referenceName, final E
116
75
117
76
int relativeIndex = list .indexOf (relativeElement );
118
77
119
- list .move (relativeIndex + 1 , element );
78
+ list .move (relativeIndex + 1 , element );
120
79
121
80
return referenceOwner ;
122
81
}
123
-
82
+
124
83
public EObject moveElementFirstPosition (EObject referenceOwner , String referenceName , final EObject element ) {
125
84
EStructuralFeature feature = referenceOwner .eClass ().getEStructuralFeature (referenceName );
126
85
@ SuppressWarnings ("unchecked" )
0 commit comments