Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbrodt2014-07-30 14:55:53 -0400
committerrbrodt2014-07-30 14:55:53 -0400
commitac73199880ffb8c0d8b1c17f81a35c2e5696c911 (patch)
tree7dfa27374ee536550870f587ab54311e1ad31739
parent5d6e4c260d6722a0ee3ad2cf3da5817a691cbb93 (diff)
downloadorg.eclipse.bpmn2-modeler-ac73199880ffb8c0d8b1c17f81a35c2e5696c911.tar.gz
org.eclipse.bpmn2-modeler-ac73199880ffb8c0d8b1c17f81a35c2e5696c911.tar.xz
org.eclipse.bpmn2-modeler-ac73199880ffb8c0d8b1c17f81a35c2e5696c911.zip
Saving work recovered after PC crash
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIUtils.java35
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2AddFeature.java14
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2CreateConnectionFeature.java60
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ManhattanConnectionRouter.java26
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/containers/UpdateContainerLabelFeature.java5
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/flow/AbstractCreateFlowFeature.java53
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/AbstractAddLabelFeature.java2
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/UpdateLabelFeature.java11
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/ModelHandler.java19
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/FeatureSupport.java13
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/MessageFeatureContainer.java27
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java23
12 files changed, 190 insertions, 98 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIUtils.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIUtils.java
index dd7f9615..6e10cb89 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIUtils.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIUtils.java
@@ -351,25 +351,26 @@ public class DIUtils {
public static BPMNLabelStyle getOrCreateDILabelStyle(BaseElement element, ShapeStyle ss) {
BPMNLabelStyle bpmnStyle = null;
DiagramElement de = DIUtils.findDiagramElement(element);
- BPMNLabel bpmnLabel = getOrCreateDILabel(de);
- if (bpmnLabel!=null) {
- BPMNDiagram bpmnDiagram = (BPMNDiagram) de.eContainer().eContainer();
- for (BPMNLabelStyle ls : bpmnDiagram.getLabelStyle()) {
- if (ss.equals(ls)) {
- // found a BPMNLabelStyle that matches the given ShapeStyle
- // so we can reuse it for this BPMNShape or BPMNEdge object.
- bpmnStyle = ls;
+ if (de!=null) {
+ BPMNLabel bpmnLabel = getOrCreateDILabel(de);
+ if (bpmnLabel!=null) {
+ BPMNDiagram bpmnDiagram = (BPMNDiagram) de.eContainer().eContainer();
+ for (BPMNLabelStyle ls : bpmnDiagram.getLabelStyle()) {
+ if (ss.equals(ls)) {
+ // found a BPMNLabelStyle that matches the given ShapeStyle
+ // so we can reuse it for this BPMNShape or BPMNEdge object.
+ bpmnStyle = ls;
+ }
}
+ if (bpmnStyle==null) {
+ // create a new BPMNLabelStyle and add it to the BPMNDiagram
+ bpmnStyle = BpmnDiFactory.eINSTANCE.createBPMNLabelStyle();
+ bpmnStyle.setFont( ShapeStyle.toBPMNFont(ss.getLabelFont()) );
+ bpmnDiagram.getLabelStyle().add(bpmnStyle);
+ }
+ bpmnLabel.setLabelStyle(bpmnStyle);
}
- if (bpmnStyle==null) {
- // create a new BPMNLabelStyle and add it to the BPMNDiagram
- bpmnStyle = BpmnDiFactory.eINSTANCE.createBPMNLabelStyle();
- bpmnStyle.setFont( ShapeStyle.toBPMNFont(ss.getLabelFont()) );
- bpmnDiagram.getLabelStyle().add(bpmnStyle);
- }
- bpmnLabel.setLabelStyle(bpmnStyle);
- }
-
+ }
return bpmnStyle;
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2AddFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2AddFeature.java
index c1f74e15..495189ae 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2AddFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2AddFeature.java
@@ -280,8 +280,10 @@ public abstract class AbstractBpmn2AddFeature<T extends BaseElement>
return context.getHeight();
int h = getHeight();
int w = getWidth();
- if (!isHorizontal(context)) {
- return Math.max(w, h);
+ if (FeatureSupport.isTargetParticipant(context) || FeatureSupport.isTargetLane(context)) {
+ if (!isHorizontal(context)) {
+ return Math.max(w, h);
+ }
}
return Math.min(w, h);
}
@@ -304,10 +306,12 @@ public abstract class AbstractBpmn2AddFeature<T extends BaseElement>
return context.getWidth();
int h = getHeight();
int w = getWidth();
- if (isHorizontal(context)) {
- return Math.max(w, h);
+ if (FeatureSupport.isTargetParticipant(context) || FeatureSupport.isTargetLane(context)) {
+ if (!isHorizontal(context)) {
+ return Math.min(w, h);
+ }
}
- return Math.min(w, h);
+ return Math.max(w, h);
}
/**
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2CreateConnectionFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2CreateConnectionFeature.java
index 958f8ee6..200bffa9 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2CreateConnectionFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractBpmn2CreateConnectionFeature.java
@@ -19,7 +19,7 @@ import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.EndEvent;
import org.eclipse.bpmn2.Event;
import org.eclipse.bpmn2.Group;
-import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.Lane;
import org.eclipse.bpmn2.SequenceFlow;
import org.eclipse.bpmn2.modeler.core.LifecycleEvent;
import org.eclipse.bpmn2.modeler.core.LifecycleEvent.EventType;
@@ -156,7 +156,8 @@ public abstract class AbstractBpmn2CreateConnectionFeature<
*/
@Override
public boolean canStartConnection(ICreateConnectionContext context) {
- return getSourceBo(context) != null;
+ EObject o = getSourceBo(context);
+ return o != null && !(o instanceof Lane);
}
/**
@@ -173,38 +174,45 @@ public abstract class AbstractBpmn2CreateConnectionFeature<
public static boolean canCreateConnection(AnchorContainer sourceContainer, AnchorContainer targetContainer, EClass connectionClass, String reconnectType) {
if (sourceContainer instanceof Diagram || targetContainer instanceof Diagram)
return false;
+ if (sourceContainer == targetContainer)
+ return true;
if (sourceContainer!=null && targetContainer!=null) {
// Make sure only one connection of each type is created for the same
// source and target objects, i.e. you can't have two SequenceFlows
// with the same source and target objects.
- for (Anchor sourceAnchor : sourceContainer.getAnchors()) {
- for (Connection sourceConnection : sourceAnchor.getOutgoingConnections()) {
- EObject sourceObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceConnection);
- if (connectionClass==Bpmn2Package.eINSTANCE.getDataAssociation()) {
- // Ugh! Special case for DataAssociations: we may have
- // an Activity with both a DataOutputAssociation and a
- // DataInputAssociation to the same ItemAwareElement
- EObject o = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceContainer);
- if (o instanceof ItemAwareElement)
- connectionClass = Bpmn2Package.eINSTANCE.getDataInputAssociation();
- else
- connectionClass = Bpmn2Package.eINSTANCE.getDataOutputAssociation();
- }
- if (sourceObject!=null && sourceObject.eClass() == connectionClass) {
- if (sourceConnection.getEnd().getParent() == targetContainer)
- return false;
- }
- }
- }
+// for (Anchor sourceAnchor : sourceContainer.getAnchors()) {
+// for (Connection sourceConnection : sourceAnchor.getOutgoingConnections()) {
+// EObject sourceObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceConnection);
+// if (connectionClass==Bpmn2Package.eINSTANCE.getDataAssociation()) {
+// // Ugh! Special case for DataAssociations: we may have
+// // an Activity with both a DataOutputAssociation and a
+// // DataInputAssociation to the same ItemAwareElement
+// EObject o = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceContainer);
+// if (o instanceof ItemAwareElement)
+// connectionClass = Bpmn2Package.eINSTANCE.getDataInputAssociation();
+// else
+// connectionClass = Bpmn2Package.eINSTANCE.getDataOutputAssociation();
+// }
+// if (sourceObject!=null && sourceObject.eClass() == connectionClass) {
+// if (sourceConnection.getEnd().getParent() == targetContainer)
+// return false;
+// }
+// }
+// }
+ EObject sourceObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceContainer);
+ if (sourceObject instanceof Lane)
+ return false;
+ EObject targetObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(targetContainer);
+ if (targetObject instanceof Lane)
+ return false;
Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(sourceContainer);
if (!prefs.getAllowMultipleConnections() && connectionClass==Bpmn2Package.eINSTANCE.getSequenceFlow()) {
// if User Preferences don't allow multiple incoming/outgoing
// connections on Activities, enforce it here.
- EObject businessObject;
if (!ReconnectionContext.RECONNECT_TARGET.equals(reconnectType)) {
- businessObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceContainer);
- if (businessObject instanceof Activity || businessObject instanceof Event) {
+ sourceObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(sourceContainer);
+ if (sourceObject instanceof Activity || sourceObject instanceof Event) {
for (Anchor a : sourceContainer.getAnchors()) {
for (Connection c : a.getOutgoingConnections()) {
EObject o = BusinessObjectUtil.getBusinessObjectForPictogramElement(c);
@@ -217,8 +225,8 @@ public abstract class AbstractBpmn2CreateConnectionFeature<
}
if (!ReconnectionContext.RECONNECT_SOURCE.equals(reconnectType)) {
- businessObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(targetContainer);
- if (businessObject instanceof Activity || businessObject instanceof Event) {
+ targetObject = BusinessObjectUtil.getBusinessObjectForPictogramElement(targetContainer);
+ if (targetObject instanceof Activity || targetObject instanceof Event) {
for (Anchor a : targetContainer.getAnchors()) {
for (Connection c : a.getIncomingConnections()) {
EObject o = BusinessObjectUtil.getBusinessObjectForPictogramElement(c);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ManhattanConnectionRouter.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ManhattanConnectionRouter.java
index ca86c401..8703344c 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ManhattanConnectionRouter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ManhattanConnectionRouter.java
@@ -133,8 +133,12 @@ GraphicsUtil.debug = false;
AnchorSite targetSite = AnchorSite.getSite(targetAnchor);
AnchorSite initialSourceSite = sourceSite;
AnchorSite initialTargetSite = targetSite;
+ Point initialSourceLocation = GraphicsUtil.createPoint(sourceAnchor);
+ Point initialTargetLocation = GraphicsUtil.createPoint(targetAnchor);
for (int i=0; i<16; ++i) {
if (shouldCalculate(sourceSite, targetSite)) {
+ AnchorUtil.moveAnchor(sourceAnchor, initialSourceLocation);
+ AnchorUtil.moveAnchor(targetAnchor, initialTargetLocation);
AnchorSite.setSite(sourceAnchor, sourceSite);
AnchorUtil.adjustAnchors(source);
AnchorSite.setSite(targetAnchor, targetSite);
@@ -171,22 +175,26 @@ GraphicsUtil.debug = false;
// 3. the edge to which the Connection was attached has changed
if (initialUpdate || middle!=null ||
sourceSite!=initialSourceSite || targetSite!=initialTargetSite) {
- if (AnchorType.getType(sourceAnchor) == AnchorType.POOL) {
- if (middle!=null)
- AnchorUtil.moveAnchor(sourceAnchor, middle);
- else
- AnchorUtil.moveAnchor(sourceAnchor, targetAnchor);
- start = GraphicsUtil.createPoint(sourceAnchor);
- route.setRank(sourceSite!=initialSourceSite ? 3 : 0);
- }
+ int rank = 0;
if (AnchorType.getType(targetAnchor) == AnchorType.POOL) {
if (middle!=null)
AnchorUtil.moveAnchor(targetAnchor, middle);
else
AnchorUtil.moveAnchor(targetAnchor, sourceAnchor);
end = GraphicsUtil.createPoint(targetAnchor);
- route.setRank(targetSite!=initialTargetSite ? 3 : 0);
+ if (targetSite!=initialTargetSite)
+ ++rank;
+ }
+ if (AnchorType.getType(sourceAnchor) == AnchorType.POOL) {
+ if (middle!=null)
+ AnchorUtil.moveAnchor(sourceAnchor, middle);
+ else
+ AnchorUtil.moveAnchor(sourceAnchor, targetAnchor);
+ start = GraphicsUtil.createPoint(sourceAnchor);
+ if (sourceSite!=initialSourceSite)
+ ++rank;
}
+ route.setRank(rank);
}
route.setSourceAnchor(sourceAnchor);
route.setTargetAnchor(targetAnchor);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/containers/UpdateContainerLabelFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/containers/UpdateContainerLabelFeature.java
index 641131a9..f7d58285 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/containers/UpdateContainerLabelFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/containers/UpdateContainerLabelFeature.java
@@ -23,6 +23,7 @@ import org.eclipse.bpmn2.modeler.core.preferences.ShapeStyle.LabelPosition;
import org.eclipse.bpmn2.modeler.core.utils.FeatureSupport;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IUpdateContext;
import org.eclipse.graphiti.mm.algorithms.AbstractText;
@@ -73,7 +74,7 @@ public class UpdateContainerLabelFeature extends UpdateLabelFeature {
boolean isHorizontal = FeatureSupport.isHorizontal((ContainerShape)ownerPE);
Shape labelShape = FeatureSupport.getLabelShape(ownerPE);
AbstractText textGA = (AbstractText) labelShape.getGraphicsAlgorithm();
- textGA.setAngle(isHorizontal ? -90 : 0);
+ textGA.setRotation(isHorizontal ? -90.0 : 0.0);
ContainerShape rootContainer = FeatureSupport.getRootContainer((ContainerShape)ownerPE);
super.adjustLabelLocation(rootContainer, isAdding, offset);
@@ -97,7 +98,7 @@ public class UpdateContainerLabelFeature extends UpdateLabelFeature {
if (FeatureSupport.isLane(pe)) {
labelShape = FeatureSupport.getLabelShape(pe);
textGA = (AbstractText) labelShape.getGraphicsAlgorithm();
- textGA.setAngle(isHorizontal ? -90 : 0);
+ textGA.setRotation(isHorizontal ? -90.0 : 0.0);
super.adjustLabelLocation(pe, isAdding, offset);
}
else {
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/flow/AbstractCreateFlowFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/flow/AbstractCreateFlowFeature.java
index b301d95a..90083a76 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/flow/AbstractCreateFlowFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/flow/AbstractCreateFlowFeature.java
@@ -96,26 +96,49 @@ public abstract class AbstractCreateFlowFeature<
AnchorContainer target = (AnchorContainer) context.getTargetPictogramElement();
Anchor sourceAnchor = context.getSourceAnchor();
Anchor targetAnchor = context.getTargetAnchor();
- ILocation loc = context.getSourceLocation();
- if (loc==null) {
- if (sourceAnchor instanceof ChopboxAnchor) {
- Point p = GraphicsUtil.createPoint(context.getTargetAnchor());
- sourceAnchor = AnchorUtil.createAnchor(source, p);
+ ILocation sourceLoc = context.getSourceLocation();
+ ILocation targetLoc = context.getTargetLocation();
+ Point p;
+ // need to create a source anchor?
+ if (sourceAnchor==null || sourceAnchor instanceof ChopboxAnchor) {
+ if (sourceLoc!=null) {
+ // use the source location if available
+ p = GraphicsUtil.createPoint(sourceLoc);
}
+ else if (targetLoc!=null) {
+ // or the target location
+ p = GraphicsUtil.createPoint(targetLoc);
+ }
+ else if (targetAnchor!=null) {
+ // the target anchor as a reference point
+ p = GraphicsUtil.createPoint(targetAnchor);
+ }
+ else {
+ // fallback is to use the center point of the
+ // target PE as the reference point
+ p = GraphicsUtil.getShapeCenter(target);
+ }
+ sourceAnchor = AnchorUtil.createAnchor(source, p);
}
- else if (sourceAnchor==null || sourceAnchor instanceof ChopboxAnchor)
- sourceAnchor = AnchorUtil.createAnchor(source, loc.getX(), loc.getY());
- loc = context.getTargetLocation();
- if (loc==null) {
- if (targetAnchor instanceof ChopboxAnchor) {
- Point p = GraphicsUtil.createPoint(context.getSourceAnchor());
- targetAnchor = AnchorUtil.createAnchor(target, p);
+ // same thing for target anchor
+ if (targetAnchor==null || targetAnchor instanceof ChopboxAnchor) {
+ if (targetLoc!=null) {
+ p = GraphicsUtil.createPoint(targetLoc);
+ }
+ else if (sourceLoc!=null) {
+ p = GraphicsUtil.createPoint(sourceLoc);
}
+ else if (sourceAnchor!=null) {
+ // the target anchor as a reference point
+ p = GraphicsUtil.createPoint(sourceAnchor);
+ }
+ else {
+ p = GraphicsUtil.getShapeCenter(source);
+ }
+ targetAnchor = AnchorUtil.createAnchor(target, p);
}
- else if (targetAnchor==null || targetAnchor instanceof ChopboxAnchor)
- targetAnchor = AnchorUtil.createAnchor(target, loc.getX(), loc.getY());
-
+
((CreateConnectionContext)context).setSourceAnchor(sourceAnchor);
((CreateConnectionContext)context).setTargetAnchor(targetAnchor);
AddConnectionContext addContext = createAddConnectionContext(context, businessObject);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/AbstractAddLabelFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/AbstractAddLabelFeature.java
index 3d775e61..2ca09ce9 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/AbstractAddLabelFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/AbstractAddLabelFeature.java
@@ -57,6 +57,8 @@ abstract public class AbstractAddLabelFeature extends AbstractAddPictogramElemen
// the actual text will be set into the Text GA during the initial update()
// which is done immediately after the add()
AbstractText text = createText(labelShape, ""); //$NON-NLS-1$
+ text.setX(-1);
+ text.setY(-1);
applyStyle(text, businessObject);
peService.setPropertyValue(labelShape, GraphitiConstants.LABEL_SHAPE, Boolean.toString(true));
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/UpdateLabelFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/UpdateLabelFeature.java
index a1eb86c2..ae911c17 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/UpdateLabelFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/label/UpdateLabelFeature.java
@@ -33,6 +33,7 @@ import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.dd.dc.Bounds;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.graphiti.datatypes.IDimension;
import org.eclipse.graphiti.datatypes.ILocation;
import org.eclipse.graphiti.features.IFeatureProvider;
@@ -41,6 +42,7 @@ import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.IUpdateContext;
import org.eclipse.graphiti.features.impl.Reason;
import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
import org.eclipse.graphiti.mm.algorithms.styles.Font;
import org.eclipse.graphiti.mm.algorithms.styles.Point;
import org.eclipse.graphiti.mm.pictograms.Connection;
@@ -93,6 +95,15 @@ public class UpdateLabelFeature extends AbstractBpmn2UpdateFeature {
if (!newLabel.equals(oldLabel))
return Reason.createTrueReason(Messages.UpdateLabelFeature_TextChanged);
+ // Workaround for Bug 440796
+ GraphicsAlgorithm labelGA = labelShape.getGraphicsAlgorithm();
+ EStructuralFeature f = labelGA.eClass().getEStructuralFeature("x");
+ if (!labelGA.eIsSet(f)) {
+ Rectangle bounds = getLabelBounds(labelShape, false, null);
+ labelGA.eSetDeliver(false);
+ labelGA.setX(bounds.x);
+ labelGA.eSetDeliver(true);
+ }
}
return Reason.createFalseReason();
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/ModelHandler.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/ModelHandler.java
index 724dcc0e..bde82c34 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/ModelHandler.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/ModelHandler.java
@@ -288,14 +288,15 @@ public class ModelHandler {
if (horz) {
bounds.setX(100);
bounds.setY(100);
- bounds.setWidth(ss.getDefaultWidth());
- bounds.setHeight(ss.getDefaultHeight());
+ bounds.setHeight(ss.getDefaultWidth());
+ bounds.setWidth(ss.getDefaultHeight());
}
- else {
+ else
+ {
bounds.setX(100);
bounds.setY(100);
- bounds.setWidth(ss.getDefaultHeight());
- bounds.setHeight(ss.getDefaultWidth());
+ bounds.setHeight(ss.getDefaultHeight());
+ bounds.setWidth(ss.getDefaultWidth());
}
shape.setBounds(bounds);
shape.setIsHorizontal(horz);
@@ -311,14 +312,14 @@ public class ModelHandler {
if (horz) {
bounds.setX(100);
bounds.setY(350);
- bounds.setWidth(ss.getDefaultWidth());
- bounds.setHeight(ss.getDefaultHeight());
+ bounds.setHeight(ss.getDefaultWidth());
+ bounds.setWidth(ss.getDefaultHeight());
}
else {
bounds.setX(350);
bounds.setY(100);
- bounds.setWidth(ss.getDefaultHeight());
- bounds.setHeight(ss.getDefaultWidth());
+ bounds.setHeight(ss.getDefaultHeight());
+ bounds.setWidth(ss.getDefaultWidth());
}
shape.setBounds(bounds);
shape.setIsHorizontal(horz);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/FeatureSupport.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/FeatureSupport.java
index 17561c9d..b11f8d3a 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/FeatureSupport.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/FeatureSupport.java
@@ -982,6 +982,19 @@ public class FeatureSupport {
de = BusinessObjectUtil.getFirstElementOfType(cs, DiagramElement.class);
if (de!=null)
return cs;
+
+ // Messages attached to MessageFlows do not have a BPMNShape element, their
+ // visibility is controlled by a setting on the BPMNEdge for the MessageFlow
+ Message msg = BusinessObjectUtil.getFirstElementOfType(cs, Message.class);
+ if (msg!=null)
+ return cs;
+ // If this is the ContainerShape of the MessageFlow Message, then it is the label owner.
+ if (pe instanceof ContainerShape) {
+ Shape labelShape = BusinessObjectUtil.getFirstElementOfType(pe, Shape.class);
+ if (FeatureSupport.isLabelShape(labelShape))
+ return pe;
+ }
+
Connection c = BusinessObjectUtil.getFirstElementOfType(pe, Connection.class);
de = BusinessObjectUtil.getFirstElementOfType(c, DiagramElement.class);
if (de!=null)
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/MessageFeatureContainer.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/MessageFeatureContainer.java
index 706d7e75..50660a20 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/MessageFeatureContainer.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/MessageFeatureContainer.java
@@ -52,6 +52,7 @@ import org.eclipse.graphiti.features.IUpdateFeature;
import org.eclipse.graphiti.features.context.IAddContext;
import org.eclipse.graphiti.features.context.IContext;
import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.context.IDeleteContext;
import org.eclipse.graphiti.features.context.IMoveShapeContext;
import org.eclipse.graphiti.features.context.IPictogramElementContext;
import org.eclipse.graphiti.features.context.IResizeShapeContext;
@@ -84,8 +85,8 @@ public class MessageFeatureContainer extends BaseElementFeatureContainer {
public Object getApplyObject(IContext context) {
Object object = super.getApplyObject(context);
if (object instanceof Message &&
- !isChoreographyMessage(context) &&
- !isMessageFlowMessage(context)) {
+ !isChoreographyMessage(context)) { // &&
+// !isMessageFlowMessage(context)) {
return object;
}
return null;
@@ -354,6 +355,13 @@ public class MessageFeatureContainer extends BaseElementFeatureContainer {
}
@Override
+ public boolean canMoveShape(IMoveShapeContext context) {
+ if (isMessageFlowMessage(context))
+ return false;
+ return super.canMoveShape(context);
+ }
+
+ @Override
protected void postMoveShape(IMoveShapeContext context) {
super.postMoveShape(context);
@@ -382,6 +390,21 @@ public class MessageFeatureContainer extends BaseElementFeatureContainer {
}
@Override
+ public boolean canDelete(IDeleteContext context) {
+ if (isMessageFlowMessage(context))
+ return false;
+ return super.canDelete(context);
+ }
+
+ @Override
+ protected void deletePeEnvironment(PictogramElement pictogramElement) {
+ PictogramElement labelShape = FeatureSupport.getLabelShape(pictogramElement);
+ if (labelShape!=null)
+ Graphiti.getPeService().deletePictogramElement(labelShape);
+ super.deletePeEnvironment(pictogramElement);
+ }
+
+ @Override
protected void deleteBusinessObject(Object bo) {
if (bo instanceof Message) {
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java
index 436f5777..67ba4d5e 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java
@@ -30,10 +30,12 @@ import org.eclipse.bpmn2.ServiceTask;
import org.eclipse.bpmn2.StartEvent;
import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.di.DIImport;
+import org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2AddFeature;
import org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2UpdateFeature;
import org.eclipse.bpmn2.modeler.core.features.BaseElementConnectionFeatureContainer;
import org.eclipse.bpmn2.modeler.core.features.DefaultDeleteBPMNShapeFeature;
import org.eclipse.bpmn2.modeler.core.features.DefaultLayoutBPMNConnectionFeature;
+import org.eclipse.bpmn2.modeler.core.features.GraphitiConstants;
import org.eclipse.bpmn2.modeler.core.features.MultiUpdateFeature;
import org.eclipse.bpmn2.modeler.core.features.choreography.ChoreographyUtil;
import org.eclipse.bpmn2.modeler.core.features.flow.AbstractAddFlowFeature;
@@ -291,8 +293,11 @@ public class MessageFlowFeatureContainer extends BaseElementConnectionFeatureCon
addContext.setX(x);
addContext.setY(y);
addContext.setTargetContainer(diagram);
- IAddFeature addFeature = fp.getAddFeature(addContext);
- messageShape = (Shape) addFeature.add(addContext);
+ // adds the Label to the Message:
+ messageShape = (Shape) fp.addIfPossible(addContext);
+ // use this instead if Message labels are not desired (possible User Preference?)
+// IAddFeature addFeature = fp.getAddFeature(addContext);
+// messageShape = (Shape) addFeature.add(addContext);
}
else {
MoveShapeContext moveContext = new MoveShapeContext(messageShape);
@@ -471,6 +476,8 @@ public class MessageFlowFeatureContainer extends BaseElementConnectionFeatureCon
@Override
public boolean canStartConnection(ICreateConnectionContext context) {
+ if (!super.canStartConnection(context))
+ return false;
if (ChoreographyUtil.isChoreographyParticipantBand(context.getSourcePictogramElement()))
return false;
return true;
@@ -597,17 +604,7 @@ public class MessageFlowFeatureContainer extends BaseElementConnectionFeatureCon
EcoreUtil.delete(message, true);
}
- ConnectionDecorator decorator = findMessageDecorator(messageFlowConnection);
- if (decorator!=null) {
- ContainerShape messageShape = BusinessObjectUtil.getFirstElementOfType(decorator, ContainerShape.class);
- if (messageShape!=null) {
- ContainerShape labelShape = BusinessObjectUtil.getFirstElementOfType(messageShape, ContainerShape.class);
- if (labelShape!=null)
- peService.deletePictogramElement(labelShape);
- peService.deletePictogramElement(messageShape);
- }
- peService.deletePictogramElement(decorator);
- }
+ removeMessageDecorator(getFeatureProvider(), messageFlowConnection);
}
super.delete(context);

Back to the top