Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Brodt2014-07-10 21:06:12 -0400
committerBob Brodt2014-07-10 21:06:12 -0400
commit538a72dcb573a60bd464601cfea63f8466dd22da (patch)
treed70f2eeb43c8974d8dede2b61e0ce15ad8cb4f6c
parente506896fec3934b639499d2d91fe04148211f896 (diff)
downloadorg.eclipse.bpmn2-modeler-538a72dcb573a60bd464601cfea63f8466dd22da.tar.gz
org.eclipse.bpmn2-modeler-538a72dcb573a60bd464601cfea63f8466dd22da.tar.xz
org.eclipse.bpmn2-modeler-538a72dcb573a60bd464601cfea63f8466dd22da.zip
Added Resolve Externals user preference.
Partial fix for Send/Receive/Service Task message connection rules.
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java81
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/messages.properties2
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java18
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Messages.java1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties2
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/plugin.properties1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Messages.java4
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/MessageFlowPropertiesAdapter.java18
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ReceiveTaskPropertiesAdapter.java60
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/SendTaskPropertiesAdapter.java51
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ServiceTaskPropertiesAdapter.java27
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/TaskPropertiesAdapter.java91
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/DataAssociationFeatureContainer.java135
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/MessageFlowFeatureContainer.java50
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/messages.properties3
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java15
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java24
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencesHelper.java4
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java127
20 files changed, 483 insertions, 232 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
index 7c7181be..23673993 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
@@ -405,7 +405,7 @@ public class Bpmn2ModelerResourceImpl extends Bpmn2ResourceImpl {
*/
protected static class Bpmn2ModelerXmlHandler extends BpmnXmlHandler {
- Bpmn2Preferences prefs = null;
+ Bpmn2Preferences preferences = null;
ImportUtil importHandler = new ImportUtil();
String targetNamespace = null;
@@ -417,6 +417,7 @@ public class Bpmn2ModelerResourceImpl extends Bpmn2ResourceImpl {
public void startDocument() {
super.startDocument();
Bpmn2ModelerFactory.setEnableModelExtensions(false);
+ preferences = Bpmn2Preferences.getInstance(xmlResource);
}
@Override
@@ -460,40 +461,24 @@ public class Bpmn2ModelerResourceImpl extends Bpmn2ResourceImpl {
if (isEndDocument) {
List<SingleReference> resolved = new ArrayList<SingleReference>();
for (SingleReference ref : forwardSingleReferences) {
- EObject obj = null;
- RuntimeException cause = null;
+ EObject referencedObject = null;
try {
- obj = xmlResource.getEObject((String) ref.getValue());
- } catch (RuntimeException exception) {
- cause = exception;
- }
- if (obj==null) {
+ referencedObject = xmlResource.getEObject((String) ref.getValue());
+ } catch (RuntimeException exception) {}
+ if (referencedObject==null) {
// The forward reference may be in an external document.
// Check the reference type and its owner, then search
// external documents contained in the same project.
- EObject ro = ref.getObject();
- EStructuralFeature rf = ref.getFeature();
+ EObject referencingObject = ref.getObject();
+ EStructuralFeature referencingFeature = ref.getFeature();
String id = (String) ref.getValue();
- obj = importHandler.resolveExternalReference(ro, rf, id);
- if (obj != null) {
+ referencedObject = importHandler.resolveExternalReference(referencingObject, referencingFeature, id);
+ if (referencedObject != null) {
resolved.add(ref);
- Resource r = obj.eResource();
- IPath path = new Path(r.getURI().toPlatformString(true));
- boolean doit = MessageDialog.openQuestion(new Shell(),
- Messages.Bpmn2ModelerResourceSetImpl_External_Reference_Found_Title,
- NLS.bind(
- Messages.Bpmn2ModelerResourceSetImpl_External_Reference_Found_Message,
- new Object[] {
- obj.eClass().getName(),
- id,
- ModelUtil.getLabel(ro)+" \""+ModelUtil.getName((BaseElement)ro)+"\"",
- path.toString()}
- )
- );
- if (doit) {
- importHandler.addImport(xmlResource, ModelUtil.getDefinitions(obj));
- xmlResource.getResourceSet().getResources().add(obj.eResource());
- setFeatureValue(ro, rf, obj, ref.getPosition());
+ if (shouldResolveExternals(referencingObject, referencedObject, id)) {
+ importHandler.addImport(xmlResource, ModelUtil.getDefinitions(referencedObject));
+ xmlResource.getResourceSet().getResources().add(referencedObject.eResource());
+ setFeatureValue(referencingObject, referencingFeature, referencedObject, ref.getPosition());
}
}
}
@@ -504,6 +489,42 @@ public class Bpmn2ModelerResourceImpl extends Bpmn2ResourceImpl {
super.handleForwardReferences(isEndDocument);
}
+ /**
+ * Check if the loader should allow external references to other files
+ * in the project. This is controlled by a User Preference setting.
+ *
+ * @param referencingObject the object referencing an external object.
+ * @param referencedObject the referenced object contained in another
+ * file in the project.
+ * @param id the ID string of the referenced object.
+ * @return true if externals should be resolved, false to cause an error
+ * for missing references.
+ */
+ private boolean shouldResolveExternals(EObject referencingObject, EObject referencedObject, String id) {
+ if (preferences.getResolveExternals()==0)
+ return false;
+ if (preferences.getResolveExternals()==1)
+ return true;
+ try {
+ Resource resource = referencedObject.eResource();
+ IPath path = new Path(resource.getURI().toPlatformString(true));
+ boolean doit = MessageDialog.openQuestion(new Shell(),
+ Messages.Bpmn2ModelerResourceSetImpl_External_Reference_Found_Title,
+ NLS.bind(
+ Messages.Bpmn2ModelerResourceSetImpl_External_Reference_Found_Message,
+ new Object[] {
+ referencedObject.eClass().getName(),
+ id,
+ ModelUtil.getLabel(referencingObject)+" \""+ModelUtil.getName((BaseElement)referencingObject)+"\"",
+ path.toString()}
+ )
+ );
+ return doit;
+ }
+ catch (Exception e) {}
+ return true;
+ }
+
@Override
protected EStructuralFeature getFeature(EObject object, String prefix, String name, boolean isElement) {
EStructuralFeature feature = null;
@@ -643,7 +664,7 @@ public class Bpmn2ModelerResourceImpl extends Bpmn2ResourceImpl {
String value = attribs.getValue(i);
map.put(key, value);
}
- Bpmn2Preferences.getInstance(this.resourceURI).applyBPMNDIDefaults(bpmnShape, map);
+ preferences.applyBPMNDIDefaults(bpmnShape, map);
}
}
else if (obj instanceof ItemDefinition) {
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/messages.properties b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/messages.properties
index 2f36509c..38b06daa 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/messages.properties
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/messages.properties
@@ -14,7 +14,7 @@ Bpmn2ModelerResourceSetImpl_Loading_Error_Message=Loading Resource {0} failed\!
Bpmn2ModelerResourceSetImpl_Loading_Error=Cannot load Resource
Bpmn2ModelerResourceSetImpl_Loading_Resource_Not_Found=Resource not found
Bpmn2ModelerResourceSetImpl_Loading_Title=Loading Resource
-Bpmn2ModelerResourceSetImpl_External_Reference_Found_Title=
+Bpmn2ModelerResourceSetImpl_External_Reference_Found_Title=External Reference Found
Bpmn2ModelerResourceSetImpl_External_Reference_Found_Message=An external {0} with ID "{1}"\n\
which is referenced by {2}\n\
was found in the file "{3}"\n\
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
index cb6f803f..f0ea8ff9 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
@@ -149,6 +149,9 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
public final static String PREF_ALLOW_MULTIPLE_CONNECTIONS_LABEL = Messages.Bpmn2Preferences_Allow_Mutliple_Connections;
public final static String PREF_SERVICE_IMPLEMENTATIONS = "service.implementations"; //$NON-NLS-1$
+ public final static String PREF_RESOLVE_EXTERNALS = "resolve.externals"; //$NON-NLS-1$
+ public final static String PREF_RESOLVE_EXTERNALS_LABEL = Messages.Bpmn2Preferences_Resolve_Externals;
+
private static Hashtable<IProject,Bpmn2Preferences> projectPreferenceCacheMap = null;
private static Bpmn2Preferences instancePreferenceCache = null;
private static IProject activeProject;
@@ -188,6 +191,7 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
private int connectionTimeout;
private int popupConfigDialog;
private boolean popupConfigDialogFor[] = new boolean[6];
+ private int resolveExternals;
private HashMap<String, ShapeStyle> shapeStyles = new HashMap<String, ShapeStyle>();
@@ -365,7 +369,8 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
defaultPreferences.putBoolean(PREF_PROPAGATE_GROUP_CATEGORIES, true);
defaultPreferences.putBoolean(PREF_ALLOW_MULTIPLE_CONNECTIONS, false);
- defaultPreferences.put(PREF_CONNECTION_TIMEOUT, "1000"); //$NON-NLS-1$
+ defaultPreferences.putInt(PREF_CONNECTION_TIMEOUT, 60000);
+ defaultPreferences.putInt(PREF_RESOLVE_EXTERNALS, 2);
loadDefaults(PREF_TOOL_PROFILE);
loadDefaults(PREF_MODEL_ENABLEMENT);
@@ -482,6 +487,7 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
isMarkerVisible = getBPMNDIAttributeDefault(PREF_IS_MARKER_VISIBLE, BPMNDIAttributeDefault.USE_DI_VALUE);
saveBPMNLabels = getBoolean(PREF_SAVE_BPMNLABELS, true);
connectionTimeout = getInt(PREF_CONNECTION_TIMEOUT, 60000); //$NON-NLS-1$
+ resolveExternals = getInt(PREF_RESOLVE_EXTERNALS, 2); //$NON-NLS-1$
popupConfigDialog = getInt(PREF_POPUP_CONFIG_DIALOG, 0); // tri-state checkbox
popupConfigDialogFor[0] = getBoolean(PREF_POPUP_CONFIG_DIALOG_FOR_ACTIVITIES, false);
@@ -522,6 +528,7 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
putBoolean(PREF_SAVE_BPMNLABELS, saveBPMNLabels);
putInt(PREF_CONNECTION_TIMEOUT, connectionTimeout);
+ putInt(PREF_RESOLVE_EXTERNALS, resolveExternals);
putInt(PREF_POPUP_CONFIG_DIALOG, popupConfigDialog);
putBoolean(PREF_POPUP_CONFIG_DIALOG_FOR_ACTIVITIES, popupConfigDialogFor[0]);
@@ -1195,6 +1202,15 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
putInt(PREF_CONNECTION_TIMEOUT, value);
connectionTimeout = value;
}
+
+ public int getResolveExternals() {
+ return resolveExternals;
+ }
+
+ public void setResolveExternals(int value) {
+ putInt(PREF_RESOLVE_EXTERNALS, value);
+ resolveExternals = value;
+ }
// this is temporary until the connection routing has been proven reliable
static boolean enableConnectionRouting = true;
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Messages.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Messages.java
index e149b657..01f74ffd 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Messages.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Messages.java
@@ -45,6 +45,7 @@ public class Messages extends NLS {
public static String Bpmn2Preferences_Target_Runtime;
public static String Bpmn2Preferences_Timeout;
public static String Bpmn2Preferences_True_if_not_set;
+ public static String Bpmn2Preferences_Resolve_Externals;
public static String ShapeStyle_Category_Connections;
public static String ShapeStyle_Category_Shapes;
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
index 85a7b296..034090ee 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
@@ -38,7 +38,7 @@ Bpmn2Preferences_Simplify_Lists=Simplify Documentation lists
Bpmn2Preferences_Target_Runtime=Target &Runtime
Bpmn2Preferences_Timeout=Connection Timeout for resolving remote objects (milliseconds)
Bpmn2Preferences_True_if_not_set=True if not set
-
+Bpmn2Preferences_Resolve_Externals=Attempt to resolve external references from other files in Project
ShapeStyle_Category_Connections=Connections
ShapeStyle_Category_Other=Containers and Artifacts
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/plugin.properties b/plugins/org.eclipse.bpmn2.modeler.ui/plugin.properties
index f6b7c288..714f860f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/plugin.properties
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/plugin.properties
@@ -127,3 +127,4 @@ label.position = Label Position
label.position.values = Below Figure,Above Figure,Left of Figure,Right of Figure,Top Inside Figure,Center of Figure,Bottom Inside Figure,Left Inside Figure,Right Inside Figure,Movable
routing.style = Routing Style
routing.style.values = Direct Automatic Manhattan
+dummy.label = Dummy \ No newline at end of file
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Messages.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Messages.java
index 0787fa9e..628ea03f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Messages.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Messages.java
@@ -101,6 +101,10 @@ public class Messages extends NLS {
public static String Bpmn2HomePreferencePage_Default_DI_Values_Title;
public static String Bpmn2PreferencePage_HomePage_Description;
public static String Bpmn2PropertyPage_HomePage_Description;
+ public static String Bpmn2PreferencePage_HomePage_Resolve_Externals_Always;
+ public static String Bpmn2PreferencePage_HomePage_Resolve_Externals_Never;
+ public static String Bpmn2PreferencePage_HomePage_Resolve_Externals_Prompt;
+
public static String CommonLabels_Data_Type;
public static String DefaultSchemaImportDialog_All;
public static String DefaultSchemaImportDialog_BPMN2_Filter_1;
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/MessageFlowPropertiesAdapter.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/MessageFlowPropertiesAdapter.java
index 9a635a58..c5851391 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/MessageFlowPropertiesAdapter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/MessageFlowPropertiesAdapter.java
@@ -15,6 +15,7 @@ package org.eclipse.bpmn2.modeler.ui.adapters.properties;
import java.util.List;
+import org.eclipse.bpmn2.BaseElement;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Message;
import org.eclipse.bpmn2.MessageFlow;
@@ -27,11 +28,8 @@ import org.eclipse.bpmn2.modeler.core.di.DIUtils;
import org.eclipse.bpmn2.modeler.core.features.choreography.ChoreographyUtil;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.graphiti.mm.pictograms.Connection;
/**
@@ -62,13 +60,15 @@ public class MessageFlowPropertiesAdapter extends ExtendedPropertiesAdapter<Mess
// or ReceiveTask make sure the messageRef is the same as ours
List<Connection> connections = DIUtils.getConnections(resourceSet, messageFlow);
for (Connection connection : connections) {
- Object o = BusinessObjectUtil.getFirstBaseElement(connection.getEnd().getParent());
- if (o instanceof ReceiveTask) {
- ((ReceiveTask)o).setMessageRef(message);
+ BaseElement source = BusinessObjectUtil.getFirstBaseElement(connection.getStart().getParent());
+ BaseElement target = BusinessObjectUtil.getFirstBaseElement(connection.getEnd().getParent());
+ if (source instanceof SendTask) {
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(source);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getSendTask_MessageRef()).setValue(message);
}
- o = BusinessObjectUtil.getFirstBaseElement(connection.getStart().getParent());
- if (o instanceof SendTask) {
- ((SendTask)o).setMessageRef(message);
+ if (target instanceof ReceiveTask) {
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(target);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getReceiveTask_MessageRef()).setValue(message);
}
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ReceiveTaskPropertiesAdapter.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ReceiveTaskPropertiesAdapter.java
index fe8efce2..6871731c 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ReceiveTaskPropertiesAdapter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ReceiveTaskPropertiesAdapter.java
@@ -13,32 +13,20 @@
package org.eclipse.bpmn2.modeler.ui.adapters.properties;
-import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.List;
-import java.util.Map.Entry;
import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Definitions;
-import org.eclipse.bpmn2.Interface;
import org.eclipse.bpmn2.Message;
import org.eclipse.bpmn2.MessageFlow;
import org.eclipse.bpmn2.Operation;
-import org.eclipse.bpmn2.Process;
import org.eclipse.bpmn2.ReceiveTask;
-import org.eclipse.bpmn2.RootElement;
import org.eclipse.bpmn2.SendTask;
+import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.di.DIUtils;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
@@ -93,32 +81,38 @@ public class ReceiveTaskPropertiesAdapter extends TaskPropertiesAdapter<ReceiveT
ResourceSet resourceSet = receiveTask.eResource().getResourceSet();
// first change the MessageRef on the ReceiveTask
- receiveTask.setMessageRef(message);
-
- // If there are any INCOMING Message Flows attached to this SendTask figure,
- // make sure the MessageFlow.messageRef is the same as ours
- List<ContainerShape> shapes = DIUtils.getContainerShapes(resourceSet, receiveTask);
- for (ContainerShape shape : shapes) {
- for (Anchor a : shape.getAnchors()) {
- for (Connection c : a.getIncomingConnections()) {
- Object o = BusinessObjectUtil.getFirstBaseElement(c);
- if (o instanceof MessageFlow) {
- ((MessageFlow)o).setMessageRef(message);
- }
- // also set the "messageRef" on the source of this Message Flow
- // (the source should be a SendTask)
- o = BusinessObjectUtil.getFirstBaseElement(c.getStart().getParent());
- if (o instanceof SendTask) {
- ((SendTask)o).setMessageRef(message);
+ if (receiveTask.getMessageRef()!=message) {
+ receiveTask.setMessageRef(message);
+
+ // If there are any INCOMING Message Flows attached to this SendTask figure,
+ // make sure the MessageFlow.messageRef is the same as ours
+ List<ContainerShape> shapes = DIUtils.getContainerShapes(resourceSet, receiveTask);
+ for (ContainerShape shape : shapes) {
+ for (Anchor a : shape.getAnchors()) {
+ for (Connection c : a.getIncomingConnections()) {
+ Object o = BusinessObjectUtil.getFirstBaseElement(c);
+ if (o instanceof MessageFlow && ((MessageFlow)o).getMessageRef()!=message) {
+ ((MessageFlow)o).setMessageRef(message);
+ }
+ // also set the "messageRef" on the source of this Message Flow
+ // (the source should be a SendTask)
+ o = BusinessObjectUtil.getFirstBaseElement(c.getStart().getParent());
+ if (o instanceof SendTask && ((SendTask)o).getMessageRef()!=message) {
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(o);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getSendTask_MessageRef()).setValue(message);
+ }
}
}
}
+ fixDataOutputs(receiveTask, message);
}
}
private void setOperationRef(ReceiveTask receiveTask, Operation operation) {
- receiveTask.setOperationRef(operation);
- Message message = operation==null ? null : operation.getInMessageRef();
- setMessageRef(receiveTask, message);
+ if (receiveTask.getOperationRef()!=operation) {
+ receiveTask.setOperationRef(operation);
+ Message message = operation==null ? null : operation.getInMessageRef();
+ setMessageRef(receiveTask, message);
+ }
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/SendTaskPropertiesAdapter.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/SendTaskPropertiesAdapter.java
index af006ae6..a6cf0682 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/SendTaskPropertiesAdapter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/SendTaskPropertiesAdapter.java
@@ -21,14 +21,12 @@ import org.eclipse.bpmn2.MessageFlow;
import org.eclipse.bpmn2.Operation;
import org.eclipse.bpmn2.ReceiveTask;
import org.eclipse.bpmn2.SendTask;
+import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.di.DIUtils;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
@@ -83,32 +81,39 @@ public class SendTaskPropertiesAdapter extends TaskPropertiesAdapter<SendTask> {
ResourceSet resourceSet = sendTask.eResource().getResourceSet();
// first change the MessageRef on the SendTask
- sendTask.setMessageRef(message);
-
- // If there are any OUTGOING Message Flows attached to this SendTask figure,
- // make sure the MessageFlow.messageRef is the same as ours
- List<ContainerShape> shapes = DIUtils.getContainerShapes(resourceSet, sendTask);
- for (ContainerShape shape : shapes) {
- for (Anchor a : shape.getAnchors()) {
- for (Connection c : a.getOutgoingConnections()) {
- Object o = BusinessObjectUtil.getFirstBaseElement(c);
- if (o instanceof MessageFlow) {
- ((MessageFlow)o).setMessageRef(message);
- }
- // also set the "messageRef" on the target of this Message Flow
- // (the target should be a ReceiveTask)
- o = BusinessObjectUtil.getFirstBaseElement(c.getEnd().getParent());
- if (o instanceof ReceiveTask) {
- ((ReceiveTask)o).setMessageRef(message);
+ if (sendTask.getMessageRef()!=message) {
+ sendTask.setMessageRef(message);
+
+ // If there are any OUTGOING Message Flows attached to this SendTask figure,
+ // make sure the MessageFlow.messageRef is the same as ours
+ List<ContainerShape> shapes = DIUtils.getContainerShapes(resourceSet, sendTask);
+ for (ContainerShape shape : shapes) {
+ for (Anchor a : shape.getAnchors()) {
+ for (Connection c : a.getOutgoingConnections()) {
+ Object o = BusinessObjectUtil.getFirstBaseElement(c);
+ if (o instanceof MessageFlow && ((MessageFlow)o).getMessageRef()!=message) {
+ ((MessageFlow)o).setMessageRef(message);
+ }
+ // also set the "messageRef" on the target of this Message Flow
+ // (the target should be a ReceiveTask)
+ o = BusinessObjectUtil.getFirstBaseElement(c.getEnd().getParent());
+ if (o instanceof ReceiveTask && ((ReceiveTask)o).getMessageRef()!=message) {
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(o);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getReceiveTask_MessageRef()).setValue(message);
+ }
}
}
}
+
+ fixDataInputs(sendTask, message);
}
}
private void setOperationRef(SendTask sendTask, Operation operation) {
- sendTask.setOperationRef(operation);
- Message message = operation==null ? null : operation.getOutMessageRef();
- setMessageRef(sendTask, message);
+ if (sendTask.getOperationRef()!=operation) {
+ sendTask.setOperationRef(operation);
+ Message message = operation==null ? null : operation.getOutMessageRef();
+ setMessageRef(sendTask, message);
+ }
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ServiceTaskPropertiesAdapter.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ServiceTaskPropertiesAdapter.java
index 65b02e04..e73a32aa 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ServiceTaskPropertiesAdapter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ServiceTaskPropertiesAdapter.java
@@ -17,6 +17,8 @@ import java.util.Hashtable;
import java.util.Map.Entry;
import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.Operation;
import org.eclipse.bpmn2.ServiceTask;
import org.eclipse.bpmn2.modeler.core.adapters.FeatureDescriptor;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
@@ -47,7 +49,16 @@ public class ServiceTaskPropertiesAdapter extends TaskPropertiesAdapter<ServiceT
setProperty(feature, UI_CAN_EDIT, Boolean.TRUE);
setProperty(feature, UI_IS_MULTI_CHOICE, Boolean.TRUE);
- setFeatureDescriptor(feature, new OperationRefFeatureDescriptor<ServiceTask>(this,object,feature));
+ setFeatureDescriptor(feature, new OperationRefFeatureDescriptor<ServiceTask>(this,object,feature) {
+
+ @Override
+ protected void internalSet(ServiceTask serviceTask, EStructuralFeature feature, Object value, int index) {
+ if (value instanceof Operation || value==null) {
+ setOperationRef(serviceTask, (Operation)value);
+ }
+ }
+
+ });
feature = Bpmn2Package.eINSTANCE.getServiceTask_Implementation();
setProperty(feature, UI_IS_MULTI_CHOICE, Boolean.TRUE);
@@ -78,4 +89,18 @@ public class ServiceTaskPropertiesAdapter extends TaskPropertiesAdapter<ServiceT
}
return choices;
}
+
+ private void setOperationRef(ServiceTask serviceTask, Operation operation) {
+ if (serviceTask.getOperationRef()!=operation) {
+ serviceTask.setOperationRef(operation);
+ if (operation!=null) {
+ fixDataInputs(serviceTask, operation.getInMessageRef());
+ fixDataOutputs(serviceTask, operation.getOutMessageRef());
+ }
+ else {
+ fixDataInputs(serviceTask, null);
+ fixDataOutputs(serviceTask, null);
+ }
+ }
+ }
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/TaskPropertiesAdapter.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/TaskPropertiesAdapter.java
index 1ee6ad7e..8a381f7f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/TaskPropertiesAdapter.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/TaskPropertiesAdapter.java
@@ -13,7 +13,17 @@
package org.eclipse.bpmn2.modeler.ui.adapters.properties;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.DataInputAssociation;
+import org.eclipse.bpmn2.DataOutputAssociation;
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Message;
import org.eclipse.bpmn2.Task;
import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.emf.common.notify.AdapterFactory;
@@ -34,4 +44,85 @@ public class TaskPropertiesAdapter<T extends Task> extends ActivityPropertiesAda
setProperty(Bpmn2Package.eINSTANCE.getInteractionNode_OutgoingConversationLinks(), UI_CAN_CREATE_NEW, Boolean.FALSE);
}
+ private static boolean typesEqual(ItemDefinition i1, ItemDefinition i2) {
+ if (i1==i2)
+ return true;
+ if (i1==null) {
+ if (i2==null)
+ return true;
+ return false;
+ }
+ if (i2==null) {
+ return false;
+ }
+ return i1.equals(i2);
+ }
+
+ protected static void fixDataInputs(Task activity, Message message) {
+ // try to match up the given Message data type with one of the
+ // Input Association types.
+ ItemDefinition messageType = null;
+ if (message!=null)
+ messageType = message.getItemRef();
+ for (DataInputAssociation dia : activity.getDataInputAssociations()) {
+ for (ItemAwareElement e : dia.getSourceRef()) {
+ ItemDefinition inputType = e.getItemSubjectRef();
+ if (typesEqual(messageType, inputType)) {
+ return;
+ }
+ }
+ }
+ clearDataInputs(activity);
+ }
+
+ protected static void clearDataInputs(Task activity) {
+ List<DataAssociation> deletedAssociations = new ArrayList<DataAssociation>();
+ deletedAssociations.addAll(activity.getDataInputAssociations());
+ for (DataAssociation da : deletedAssociations) {
+ // we can delete the connection line by simply setting either the source
+ // or target of the DataAssociation to null
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(da);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef()).setValue(null);
+ }
+ activity.getDataInputAssociations().clear();
+ InputOutputSpecification ioSpec = activity.getIoSpecification();
+ if (ioSpec!=null) {
+ ioSpec.getDataInputs().clear();
+ ioSpec.getInputSets().get(0).getDataInputRefs().clear();
+ }
+ }
+
+ protected static void fixDataOutputs(Task activity, Message message) {
+ // try to match up the given Message data type with one of the
+ // Output Association types.
+ ItemDefinition messageType = null;
+ if (message!=null)
+ messageType = message.getItemRef();
+ for (DataOutputAssociation doa : activity.getDataOutputAssociations()) {
+ ItemAwareElement e = doa.getTargetRef();
+ ItemDefinition inputType = e.getItemSubjectRef();
+ if (typesEqual(messageType, inputType)) {
+ return;
+ }
+ }
+ clearDataOutputs(activity);
+ }
+
+ protected static void clearDataOutputs(Task activity) {
+ // we need to delete the existing Data Associations along with their visuals
+ List<DataAssociation> deletedAssociations = new ArrayList<DataAssociation>();
+ deletedAssociations.addAll(activity.getDataOutputAssociations());
+ for (DataAssociation da : deletedAssociations) {
+ // we can delete the connection line by simply setting either the source
+ // or target of the DataAssociation to null
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(da);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef()).setValue(null);
+ }
+ activity.getDataOutputAssociations().clear();
+ InputOutputSpecification ioSpec = activity.getIoSpecification();
+ if (ioSpec!=null) {
+ ioSpec.getDataOutputs().clear();
+ ioSpec.getOutputSets().get(0).getDataOutputRefs().clear();
+ }
+ }
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/DataAssociationFeatureContainer.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/DataAssociationFeatureContainer.java
index 91f3fe01..2dddf3c6 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/DataAssociationFeatureContainer.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/DataAssociationFeatureContainer.java
@@ -29,6 +29,9 @@ import org.eclipse.bpmn2.InputOutputSpecification;
import org.eclipse.bpmn2.InputSet;
import org.eclipse.bpmn2.ItemAwareElement;
import org.eclipse.bpmn2.OutputSet;
+import org.eclipse.bpmn2.ReceiveTask;
+import org.eclipse.bpmn2.SendTask;
+import org.eclipse.bpmn2.ServiceTask;
import org.eclipse.bpmn2.ThrowEvent;
import org.eclipse.bpmn2.di.BPMNEdge;
import org.eclipse.bpmn2.modeler.core.Activator;
@@ -69,7 +72,6 @@ import org.eclipse.graphiti.features.context.IReconnectionContext;
import org.eclipse.graphiti.features.context.IUpdateContext;
import org.eclipse.graphiti.features.context.impl.DeleteContext;
import org.eclipse.graphiti.features.context.impl.ReconnectionContext;
-import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
import org.eclipse.graphiti.features.impl.Reason;
import org.eclipse.graphiti.mm.algorithms.Polyline;
import org.eclipse.graphiti.mm.algorithms.styles.LineStyle;
@@ -196,20 +198,15 @@ public class DataAssociationFeatureContainer extends BaseElementConnectionFeatur
// if this new DataAssociation replaces another one, delete it
if (newAssociation instanceof DataInputAssociation) {
DataInputAssociation dia = BusinessObjectUtil.getFirstElementOfType(c, DataInputAssociation.class);
- if (dia!=null) {
- if (newAssociation.getTargetRef() == dia.getTargetRef())
- return c;
+ if (dia==newAssociation) {
+ return c;
}
}
else {
DataOutputAssociation doa = BusinessObjectUtil.getFirstElementOfType(c, DataOutputAssociation.class);
- if (doa!=null) {
- for (ItemAwareElement d : newAssociation.getSourceRef()) {
- if (doa.getSourceRef().contains(d)) {
- return c;
- }
- }
+ if (doa==newAssociation) {
+ return c;
}
}
}
@@ -232,32 +229,43 @@ public class DataAssociationFeatureContainer extends BaseElementConnectionFeatur
targetFeature = Bpmn2Package.eINSTANCE.getThrowEvent_DataInputAssociation();
}
- // allow user to select a dataInput:
- // create a throw away object as a placeholder in our popup list
- DataInput dataInput = Bpmn2Factory.eINSTANCE.createDataInput();
- dataInput.setName(
- NLS.bind(
- Messages.DataAssociationFeatureContainer_New_Input_For,
- ExtendedPropertiesProvider.getTextValue(target)
- )
- );
- DataInput result = dataInput;
- // build the popup list
- List<DataInput> list = new ArrayList<DataInput>();
- list.add(dataInput);
- list.addAll(dataInputs);
- if (list.size()>1) {
- PopupMenu popupMenu = new PopupMenu(list, labelProvider);
- boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
- if (b) {
- result = (DataInput) popupMenu.getResult();
- }
- else {
- EcoreUtil.delete(dataInput);
- return null;
- }
+ DataInput result = null;
+ DataInput dataInput = null;
+ if (target instanceof SendTask || target instanceof ReceiveTask || target instanceof ServiceTask) {
+ // don't create a new Data Input/Output for these types of tasks if
+ // they already have one
+ if (dataInputs.size()>0)
+ result = dataInputs.get(0);
}
+ if (result==null) {
+ // allow user to select a dataInput:
+ // create a throw away object as a placeholder in our popup list
+ dataInput = Bpmn2Factory.eINSTANCE.createDataInput();
+ dataInput.setName(
+ NLS.bind(
+ Messages.DataAssociationFeatureContainer_New_Input_For,
+ ExtendedPropertiesProvider.getTextValue(target)
+ )
+ );
+ result = dataInput;
+ // build the popup list
+ List<DataInput> list = new ArrayList<DataInput>();
+ list.add(dataInput);
+ list.addAll(dataInputs);
+ if (list.size()>1) {
+ PopupMenu popupMenu = new PopupMenu(list, labelProvider);
+ boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
+ if (b) {
+ result = (DataInput) popupMenu.getResult();
+ }
+ else {
+ EcoreUtil.delete(dataInput);
+ return null;
+ }
+ }
+ }
+
DataInputAssociation dataInputAssoc = null;
if (result == dataInput) {
// create the new one
@@ -300,32 +308,43 @@ public class DataAssociationFeatureContainer extends BaseElementConnectionFeatur
sourceFeature = Bpmn2Package.eINSTANCE.getCatchEvent_DataOutputAssociation();
}
- // allow user to select a dataOutput:
- // create a throw away object as a placeholder in our popup list
- DataOutput dataOutput = Bpmn2Factory.eINSTANCE.createDataOutput();
- dataOutput.setName(
- NLS.bind(
- Messages.DataAssociationFeatureContainer_New_Output_For,
- ExtendedPropertiesProvider.getTextValue(source)
- )
- );
- DataOutput result = dataOutput;
- // build the popup list
- List<DataOutput> list = new ArrayList<DataOutput>();
- list.add(dataOutput);
- list.addAll(dataOutputs);
- if (list.size()>1) {
- PopupMenu popupMenu = new PopupMenu(list, labelProvider);
- boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
- if (b) {
- result = (DataOutput) popupMenu.getResult();
- }
- else {
- EcoreUtil.delete(dataOutput);
- return null;
+ DataOutput result = null;
+ DataOutput dataOutput = null;
+ if (source instanceof SendTask || source instanceof ReceiveTask || source instanceof ServiceTask) {
+ // don't create a new Data Input/Output for these types of tasks if
+ // they already have one
+ if (dataOutputs.size()>0)
+ result = dataOutputs.get(0);
+ }
+
+ if (result==null) {
+ // allow user to select a dataOutput:
+ // create a throw away object as a placeholder in our popup list
+ dataOutput = Bpmn2Factory.eINSTANCE.createDataOutput();
+ dataOutput.setName(
+ NLS.bind(
+ Messages.DataAssociationFeatureContainer_New_Output_For,
+ ExtendedPropertiesProvider.getTextValue(source)
+ )
+ );
+ result = dataOutput;
+ // build the popup list
+ List<DataOutput> list = new ArrayList<DataOutput>();
+ list.add(dataOutput);
+ list.addAll(dataOutputs);
+ if (list.size()>1) {
+ PopupMenu popupMenu = new PopupMenu(list, labelProvider);
+ boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
+ if (b) {
+ result = (DataOutput) popupMenu.getResult();
+ }
+ else {
+ EcoreUtil.delete(dataOutput);
+ return null;
+ }
}
}
-
+
DataOutputAssociation dataOutputAssoc = null;
if (result == dataOutput) {
// create the new one
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 40ed4598..88c51829 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
@@ -22,8 +22,14 @@ import org.eclipse.bpmn2.InteractionNode;
import org.eclipse.bpmn2.Message;
import org.eclipse.bpmn2.MessageEventDefinition;
import org.eclipse.bpmn2.MessageFlow;
+import org.eclipse.bpmn2.Operation;
import org.eclipse.bpmn2.Participant;
+import org.eclipse.bpmn2.ReceiveTask;
+import org.eclipse.bpmn2.SendTask;
+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.BaseElementConnectionFeatureContainer;
import org.eclipse.bpmn2.modeler.core.features.DefaultDeleteBPMNShapeFeature;
import org.eclipse.bpmn2.modeler.core.features.MultiUpdateFeature;
@@ -336,6 +342,46 @@ public class MessageFlowFeatureContainer extends BaseElementConnectionFeatureCon
}
@Override
+ public PictogramElement add(IAddContext context) {
+ Connection connection = (Connection)super.add(context);
+ if (!DIImport.isImporting(context)) {
+ // take a SWAG at the Message type by looking at the source and target figures:
+ // if the source is a SendTask, use the Message from the SendTask
+ // if the target is a ReceiveTask, use the Message from that
+ // if the source or target is a ServiceTask use the input or output Message from its Operation
+ BaseElement source = BusinessObjectUtil.getFirstBaseElement(connection.getStart().getParent());
+ BaseElement target = BusinessObjectUtil.getFirstBaseElement(connection.getEnd().getParent());
+ Message message = null;
+ if (source instanceof SendTask) {
+ message = ((SendTask)source).getMessageRef();
+ }
+ else if (target instanceof ReceiveTask) {
+ message = ((ReceiveTask)target).getMessageRef();
+ }
+ else if (source instanceof ServiceTask) {
+ Operation operation = ((ServiceTask)source).getOperationRef();
+ if (operation!=null)
+ message = operation.getInMessageRef();
+ }
+ else if (target instanceof ServiceTask) {
+ Operation operation = ((ServiceTask)target).getOperationRef();
+ if (operation!=null)
+ message = operation.getOutMessageRef();
+ }
+
+ if (message!=null) {
+ // Set the Message type. The ExtendedPropertiesAdapter will
+ // handle the setting of Message types in the source and target
+ // nodes as required.
+ MessageFlow mf = BusinessObjectUtil.getFirstElementOfType(connection, MessageFlow.class);
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(mf);
+ adapter.getFeatureDescriptor(Bpmn2Package.eINSTANCE.getMessageFlow_MessageRef()).setValue(message);
+ }
+ }
+ return connection;
+ }
+
+ @Override
protected Polyline createConnectionLine(final Connection connection) {
MessageFlow messageFlow = (MessageFlow) BusinessObjectUtil.getFirstBaseElement(connection);
@@ -434,6 +480,10 @@ public class MessageFlowFeatureContainer extends BaseElementConnectionFeatureCon
return false;
}
InteractionNode target = getTargetBo(context);
+ if (source instanceof ReceiveTask)
+ return false;
+ if (target instanceof SendTask)
+ return false;
return super.canCreate(context) && isDifferentParticipants(source, target);
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/messages.properties b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/messages.properties
index b19ed7ab..afdbd75c 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/messages.properties
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/messages.properties
@@ -88,6 +88,9 @@ Bpmn2EditorPreferencePage_Label_Location_Label=Location relative to Figure:
Bpmn2EditorPreferencePage_Selected_Color_Label=&Selected Color:
Bpmn2HomePreferencePage_Default_DI_Values_Title=Default values for BPMN Diagram Interchange (DI) optional attributes
Bpmn2PreferencePage_HomePage_Description=General settings for the BPMN2 Modeler
+Bpmn2PreferencePage_HomePage_Resolve_Externals_Always=Always
+Bpmn2PreferencePage_HomePage_Resolve_Externals_Never=Never
+Bpmn2PreferencePage_HomePage_Resolve_Externals_Prompt=Prompt
Bpmn2PropertyPage_HomePage_Description=Project specific settings for the BPMN2 Modeler
#
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
index 08c7cb25..8315bf91 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
@@ -15,11 +15,10 @@ import java.util.List;
import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
-import org.eclipse.bpmn2.modeler.core.preferences.TristateCheckboxFieldEditor;
-import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.bpmn2.modeler.help.IHelpContexts;
import org.eclipse.bpmn2.modeler.ui.Messages;
import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.IPreferencePage;
@@ -27,13 +26,11 @@ import org.eclipse.jface.preference.IPreferencePageContainer;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
@@ -115,6 +112,16 @@ public class Bpmn2HomePreferencePage
getFieldEditorParent());
addField(saveBPMNLabels);
+ ComboFieldEditor resolveExternals = new ComboFieldEditor(
+ Bpmn2Preferences.PREF_RESOLVE_EXTERNALS,
+ Bpmn2Preferences.PREF_RESOLVE_EXTERNALS_LABEL,
+ new String[][] {
+ {Messages.Bpmn2PreferencePage_HomePage_Resolve_Externals_Always, "1"},
+ {Messages.Bpmn2PreferencePage_HomePage_Resolve_Externals_Never, "0"},
+ {Messages.Bpmn2PreferencePage_HomePage_Resolve_Externals_Prompt, "2"} },
+ getFieldEditorParent());
+ addField(resolveExternals);
+
IntegerFieldEditor connectionTimeout = new IntegerFieldEditor(
Bpmn2Preferences.PREF_CONNECTION_TIMEOUT,
Bpmn2Preferences.PREF_CONNECTION_TIMEOUT_LABEL,
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
index 43c7058a..c42d97f7 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencePage.java
@@ -477,12 +477,12 @@ public class ToolProfilesPreferencePage extends PreferencePage implements IWorkb
bpmnTreeViewer.setInput(bpmnEntries);
extensionTreeViewer.setInput(extensionEntries);
- if (TargetRuntime.DEFAULT_RUNTIME_ID.equals(currentRuntime.getId())) {
- extensionTreeViewer.setVisible(false);
- }
- else {
- extensionTreeViewer.setVisible(true);
- }
+// if (TargetRuntime.DEFAULT_RUNTIME_ID.equals(currentRuntime.getId())) {
+// extensionTreeViewer.setVisible(false);
+// }
+// else {
+// extensionTreeViewer.setVisible(true);
+// }
}
private boolean isEnabled(ToolDescriptor td) {
@@ -726,13 +726,13 @@ public class ToolProfilesPreferencePage extends PreferencePage implements IWorkb
ArrayList<ModelEnablementTreeEntry> enabled = new ArrayList<ModelEnablementTreeEntry>();
for (ModelEnablementTreeEntry entry : entries) {
- if (entry.getEnabled()) {
- enabled.add(entry);
- }
ArrayList<ModelEnablementTreeEntry> children = entry.getChildren();
- for (ModelEnablementTreeEntry t : children) {
- if (t.getEnabled()) {
- enabled.add(t);
+ if (entry.getEnabled() && !children.isEmpty()) {
+ enabled.add(entry);
+ for (ModelEnablementTreeEntry t : children) {
+ if (t.getEnabled()) {
+ enabled.add(t);
+ }
}
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencesHelper.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencesHelper.java
index 206af25b..14ed775a 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencesHelper.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/ToolProfilesPreferencesHelper.java
@@ -276,7 +276,9 @@ public class ToolProfilesPreferencesHelper {
runtimeModelExtensionsRoot.setChildren(runtimeModelExtensions);
ArrayList<ModelEnablementTreeEntry> allExtensions = new ArrayList<ModelEnablementTreeEntry>();
- allExtensions.add(bpmnModelExtensionsRoot);
+ if (!bpmnModelExtensionsRoot.getChildren().isEmpty())
+ allExtensions.add(bpmnModelExtensionsRoot);
+ if (!runtimeModelExtensionsRoot.getChildren().isEmpty())
allExtensions.add(runtimeModelExtensionsRoot);
return allExtensions;
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
index 85b4f7bc..80fa3f4b 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
@@ -15,7 +15,6 @@ package org.eclipse.bpmn2.modeler.ui.property.connectors;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractPropertiesProvider;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.widgets.Composite;
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
index cfac7157..0671ac6e 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
@@ -14,19 +14,25 @@
package org.eclipse.bpmn2.modeler.ui.property.tasks;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.bpmn2.Activity;
import org.eclipse.bpmn2.BaseElement;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.CallableElement;
import org.eclipse.bpmn2.Choreography;
import org.eclipse.bpmn2.Collaboration;
+import org.eclipse.bpmn2.DataAssociation;
import org.eclipse.bpmn2.DataInput;
import org.eclipse.bpmn2.DataOutput;
import org.eclipse.bpmn2.Definitions;
import org.eclipse.bpmn2.InputOutputSpecification;
import org.eclipse.bpmn2.InputSet;
+import org.eclipse.bpmn2.InteractionNode;
import org.eclipse.bpmn2.LoopCharacteristics;
import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.MessageFlow;
import org.eclipse.bpmn2.MultiInstanceLoopCharacteristics;
import org.eclipse.bpmn2.Operation;
import org.eclipse.bpmn2.OutputSet;
@@ -35,9 +41,11 @@ import org.eclipse.bpmn2.ReceiveTask;
import org.eclipse.bpmn2.SendTask;
import org.eclipse.bpmn2.ServiceTask;
import org.eclipse.bpmn2.StandardLoopCharacteristics;
+import org.eclipse.bpmn2.Task;
import org.eclipse.bpmn2.di.BPMNDiagram;
import org.eclipse.bpmn2.di.BPMNPlane;
import org.eclipse.bpmn2.di.BpmnDiFactory;
+import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.adapters.InsertionAdapter;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
@@ -55,6 +63,14 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.graphiti.features.IDeleteFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IDeleteContext;
+import org.eclipse.graphiti.features.context.impl.DeleteContext;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -406,13 +422,14 @@ public class ActivityDetailComposite extends DefaultDetailComposite {
Operation oldOperation = (Operation) activity.eGet(operationRef);
boolean operationChanged = (oldOperation != operation);
boolean messageChanged = false;
+ ExtendedPropertiesAdapter activityAdapter = ExtendedPropertiesAdapter.adapt(activity);
if (operationChanged) {
- activity.eSet(operationRef, operation);
+ activityAdapter.getFeatureDescriptor(operationRef).setValue(operation);
if (operation!=null) {
if (activity instanceof ReceiveTask)
- activity.eSet(messageRef, operation.getInMessageRef());
+ activityAdapter.getFeatureDescriptor(messageRef).setValue(operation.getInMessageRef());
else if (activity instanceof SendTask)
- activity.eSet(messageRef, operation.getOutMessageRef());
+ activityAdapter.getFeatureDescriptor(messageRef).setValue(operation.getOutMessageRef());
}
}
@@ -420,17 +437,19 @@ public class ActivityDetailComposite extends DefaultDetailComposite {
Message oldMessage = (Message) activity.eGet(messageRef);
messageChanged = (oldMessage != message);
if (messageChanged)
- activity.eSet(messageRef, message);
+ activityAdapter.getFeatureDescriptor(messageRef).setValue(message);
}
- if (inputComposite==null) {
- inputComposite = new DataAssociationDetailComposite(container, SWT.NONE);
- inputComposite.setShowToGroup(false);
- }
-
- if (outputComposite==null) {
- outputComposite = new DataAssociationDetailComposite(container, SWT.NONE);
- outputComposite.setShowFromGroup(false);
+ if (container!=null) {
+ if (inputComposite==null) {
+ inputComposite = new DataAssociationDetailComposite(container, SWT.NONE);
+ inputComposite.setShowToGroup(false);
+ }
+
+ if (outputComposite==null) {
+ outputComposite = new DataAssociationDetailComposite(container, SWT.NONE);
+ outputComposite.setShowFromGroup(false);
+ }
}
Resource resource = activity.eResource();
@@ -466,15 +485,6 @@ public class ActivityDetailComposite extends DefaultDetailComposite {
}
DataInput input = null;
DataOutput output = null;
- if (operationChanged || messageChanged) {
- activity.getDataInputAssociations().clear();
- activity.getDataOutputAssociations().clear();
- ioSpec.getDataInputs().clear();
- ioSpec.getDataOutputs().clear();
- ioSpec.getInputSets().get(0).getDataInputRefs().clear();
- ioSpec.getOutputSets().get(0).getDataOutputRefs().clear();
- }
-
Message inMessage = null;
Message outMessage = null;
if (operation!=null) {
@@ -489,9 +499,9 @@ public class ActivityDetailComposite extends DefaultDetailComposite {
}
else {
if (activity instanceof SendTask)
- inMessage = ((SendTask) activity).getMessageRef();
+ message = inMessage = ((SendTask) activity).getMessageRef();
else if (activity instanceof ReceiveTask)
- outMessage = ((ReceiveTask) activity).getMessageRef();
+ message = outMessage = ((ReceiveTask) activity).getMessageRef();
}
if (activity instanceof SendTask)
@@ -574,45 +584,48 @@ public class ActivityDetailComposite extends DefaultDetailComposite {
InsertionAdapter.add(activity, Bpmn2Package.eINSTANCE.getActivity_IoSpecification(), ioSpec);
}
- if (activity instanceof ServiceTask) {
- if (inMessage!=null) {
- // display the "From" association widgets
- inputComposite.setVisible(true);
- inputComposite.setBusinessObject(input);
- inputComposite.getFromGroup().setText(Messages.ActivityDetailComposite_Map_Request_Message);
+ if (container!=null) {
+ if (activity instanceof ServiceTask) {
+ if (inMessage!=null) {
+ // display the "From" association widgets
+ inputComposite.setVisible(true);
+ inputComposite.setBusinessObject(input);
+ inputComposite.getFromGroup().setText(Messages.ActivityDetailComposite_Map_Request_Message);
+ }
+ else
+ inputComposite.setVisible(false);
+
+ if (outMessage!=null) {
+ outputComposite.setVisible(true);
+ outputComposite.setBusinessObject(output);
+ outputComposite.getToGroup().setText(Messages.ActivityDetailComposite_Map_Response_Message);
+ }
+ else
+ outputComposite.setVisible(false);
}
- else
- inputComposite.setVisible(false);
-
- if (outMessage!=null) {
- outputComposite.setVisible(true);
- outputComposite.setBusinessObject(output);
- outputComposite.getToGroup().setText(Messages.ActivityDetailComposite_Map_Response_Message);
+ else if (activity instanceof SendTask) {
+ if (inMessage!=null) {
+ inputComposite.setVisible(true);
+ inputComposite.setBusinessObject(input);
+ inputComposite.getFromGroup().setText(Messages.ActivityDetailComposite_Map_Outgoing_Message);
+ }
+ else
+ inputComposite.setVisible(false);
}
- else
- outputComposite.setVisible(false);
- }
- else if (activity instanceof SendTask) {
- if (inMessage!=null) {
- inputComposite.setVisible(true);
- inputComposite.setBusinessObject(input);
- inputComposite.getFromGroup().setText(Messages.ActivityDetailComposite_Map_Outgoing_Message);
+ else if (activity instanceof ReceiveTask) {
+ if (outMessage!=null) {
+ outputComposite.setVisible(true);
+ outputComposite.setBusinessObject(output);
+ outputComposite.getToGroup().setText(Messages.ActivityDetailComposite_Map_Incoming_Message);
+ }
+ else
+ outputComposite.setVisible(false);
}
- else
- inputComposite.setVisible(false);
- }
- else if (activity instanceof ReceiveTask) {
- if (outMessage!=null) {
- outputComposite.setVisible(true);
- outputComposite.setBusinessObject(output);
- outputComposite.getToGroup().setText(Messages.ActivityDetailComposite_Map_Incoming_Message);
+
+ if (operationChanged || messageChanged) {
+ redrawPage();
}
- else
- outputComposite.setVisible(false);
}
-
- if (operationChanged || messageChanged)
- redrawPage();
}
private void createNewDiagram(final BaseElement bpmnElement) {

Back to the top