| author | Antoine Toulme | 2009-07-03 12:27:34 (EDT) |
|---|---|---|
| committer | Antoine Toulme | 2009-07-03 12:27:34 (EDT) |
| commit | 5fafa171542ab82c12e6e9e01e9e843ea04532d8 (patch) (side-by-side diff) | |
| tree | c9daf4c4a01f02c53a440584ea0d8aafcc10154f | |
| parent | e8a6d2ffd4fda05da14ff0188198c6cb480e72af (diff) | |
| download | bpmnmodeler-1.1.0.zip bpmnmodeler-1.1.0.tar.gz bpmnmodeler-1.1.0.tar.bz2 | |
port trunk fixes to 1.1 stream1.1.0
7 files changed, 97 insertions, 46 deletions
diff --git a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupAction.java b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupAction.java index 96fe45d..e600daa 100644 --- a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupAction.java +++ b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupAction.java @@ -357,7 +357,9 @@ public class GroupAction extends AbstractGroupUngroupAction { }
}
- if (action != null) action.setEnabled(!editParts.isEmpty());
+ if (action != null) {
+ action.setEnabled(!editParts.isEmpty());
+ }
}
/**
diff --git a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupInSubprocessCommand.java b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupInSubprocessCommand.java index a0c5ed3..c38b425 100644 --- a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupInSubprocessCommand.java +++ b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/GroupInSubprocessCommand.java @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -90,7 +90,7 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { //and their associated edit part classes. //used during redo to be able to update the editpart //as they changed during the execution and unexecution of things. - private Map<String,Class> selectedEps = new HashMap<String, Class>(); + private Map<String,Class<?>> selectedEps = new HashMap<String, Class<?>>(); /** The edit parts to be grouped */ private Set<GraphicalEditPart> editParts; @@ -143,7 +143,7 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { public GroupInSubprocessCommand( TransactionalEditingDomain domain, IDiagramGraphicalViewer viewer, - Map<String,Class> contentToGroup, + Map<String,Class<?>> contentToGroup, String originalContainerProxyId) { super(domain, BpmnDiagramMessages.GroupInSubprocessCommand_label, null); this.editParts = new HashSet<GraphicalEditPart>(); @@ -182,7 +182,7 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { } tmpContainerEditPart = eps.get(0); List<EditPart> newSel = new ArrayList<EditPart>(); - for (Entry<String,Class> entry : selectedEps.entrySet()) { + for (Entry<String,Class<?>> entry : selectedEps.entrySet()) { eps = viewer.findEditPartsForElement(entry.getKey(), entry.getValue()); if (!eps.isEmpty()) { @@ -193,6 +193,7 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { editParts, almostSelectedBoundaryEvents, externalSrcConnections, externalTgtConnections, internalConnections); + } // common parent of selected edit part now will become a parent @@ -215,22 +216,39 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { Boolean.FALSE); } - Rectangle rect = getSizeAndLocation(req); Command create = containerEditPart.getCommand(req); create.execute(); final Node spview = (Node) ((IAdaptable) ((List) req.getNewObject()).get(0)).getAdapter(Node.class); _createdSubprocessProxyId = EMFCoreUtil.getProxyID(spview.getElement()); - // collecting semantic elements: - final List<EObject> semantic = new LinkedList<EObject>(); + // final List<EObject> semantic = new LinkedList<EObject>(); + LinkedHashMap<GraphicalEditPart, EObject> semanticMapped = new LinkedHashMap<GraphicalEditPart, EObject>(); for (GraphicalEditPart part : editParts) { - semantic.add(part.resolveSemanticElement()); - if (part.resolveSemanticElement() instanceof Activity) { - Graph graph = ((Activity) part.resolveSemanticElement()).getGraph(); - graph.getVertices().remove(part.resolveSemanticElement()); - ((Activity) part.resolveSemanticElement()).setGraph(null); + EObject eo = part.resolveSemanticElement(); + // semantic.add(eo); + semanticMapped.put(part, eo); + } + for (EObject eo : semanticMapped.values()) { + //first change the scope of dataobjects. + //it is important to remove the scope of the dataobject + //as dataobject are sometimes managed by the activities they are + //associated with + //the fact that they don't have a container during this part of the + //operation will make sure that they don't get removed. + if (eo instanceof Artifact) { + Artifact artifact = (Artifact)eo; + artifact.setArtifactsContainer(null); + } + } + + for (EObject eo : semanticMapped.values()) { + if (eo instanceof Activity) { + Activity act = (Activity) eo; + Graph graph = act.getGraph(); + act.setGraph(null); + graph.getVertices().remove(eo); } } @@ -305,7 +323,7 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { // to a new container Map<Activity, List<SequenceEdge>> incoming = new HashMap<Activity, List<SequenceEdge>>(); Map<Activity, List<SequenceEdge>> outgoing = new HashMap<Activity, List<SequenceEdge>>(); - for (EObject obj : semantic) { + for (EObject obj : semanticMapped.values()) { if (obj instanceof Activity) { Activity act = (Activity) obj; incoming.put(act, new ArrayList<SequenceEdge>(act.getIncomingEdges())); @@ -322,27 +340,31 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { } // moving the nodes now + SubProcess newSubProcess = (SubProcess)spview.getElement(); //first move the artifacts because they are containers of associations - for (EObject obj : semantic) { + for (EObject obj : semanticMapped.values()) { if (obj instanceof Activity) { //later } else if (obj instanceof Artifact) { - ((SubProcess)spview.getElement()).getArtifacts().add((Artifact)obj); + Artifact artifact = (Artifact)obj; + newSubProcess.getArtifacts().add(artifact); + artifact.setArtifactsContainer(newSubProcess); } else { //this looks very bad to me: ie unlikely to do any good. - spview.getElement().eContents().add(obj); + EObject elem = spview.getElement(); + elem.eContents().add(obj); } } //second move the activities: - for (EObject obj : semantic) { + for (EObject obj : semanticMapped.values()) { if (obj instanceof Activity) { ((Activity) obj).setGraph((Graph) spview.getElement()); } } // retargeting the edges now - for (EObject obj : semantic) { + for (EObject obj : semanticMapped.values()) { if (obj instanceof Activity) { Activity act = (Activity) obj; act.getIncomingEdges().addAll(incoming.get(act)); @@ -431,6 +453,17 @@ public class GroupInSubprocessCommand extends AbstractTransactionalCommand { return Status.OK_STATUS; } + private void __checkEditPartSanity() { + for (GraphicalEditPart part : editParts) { + EObject eo = part.resolveSemanticElement(); + if (eo == null) { + System.err.println("We have a problem here: " + part + " is not associated to a semantic element."); + Thread.dumpStack(); + throw new IllegalArgumentException("We have a problem: " + part + " is not associated to a semantic element."); + } + } + + } diff --git a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/UngroupAction.java b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/UngroupAction.java index 4fe339c..6216b08 100644 --- a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/UngroupAction.java +++ b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/actions/UngroupAction.java @@ -18,6 +18,7 @@ package org.eclipse.stp.bpmn.diagram.actions; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -139,10 +140,10 @@ public class UngroupAction extends AbstractGroupUngroupAction { //and their associated edit part classes.
//used during redo to be able to update the editpart
//as they changed during the execution and unexecution of things.
- private Map<String,Class> selectedEps = new HashMap<String, Class>();
+ private Map<String,Class<?>> selectedEps = new HashMap<String, Class<?>>();
- private Map<String,Map<String,Class>> selectedContentForUndo =
- new HashMap<String, Map<String,Class>>();
+ private Map<String,Map<String,Class<?>>> selectedContentForUndo =
+ new HashMap<String, Map<String,Class<?>>>();
//new HashMap<String, Class>();
private Map<String,String> indexOfContainersOfSubProcessUngrouped =
@@ -163,7 +164,7 @@ public class UngroupAction extends AbstractGroupUngroupAction { String spContainerId = EMFCoreUtil.getProxyID(sp.resolveSemanticElement().eContainer());
indexOfContainersOfSubProcessUngrouped.put(spId, spContainerId);
selectedEps.put(spId, sp.getClass());
- Map<String,Class> selectedContentForUndoOne = new HashMap<String,Class>();
+ Map<String,Class<?>> selectedContentForUndoOne = new HashMap<String,Class<?>>();
selectedContentForUndo.put(spId, selectedContentForUndoOne);
for (Object cpt : sp.getChildren()) {
@@ -183,7 +184,7 @@ public class UngroupAction extends AbstractGroupUngroupAction { //the edit parts are new.
//let's locate them.
subProcesses.clear();
- for (Entry<String,Class> entry : selectedEps.entrySet()) {
+ for (Entry<String,Class<?>> entry : selectedEps.entrySet()) {
List eps = viewer.findEditPartsForElement(entry.getKey(),
entry.getValue());
if (!eps.isEmpty()) {
@@ -226,7 +227,7 @@ public class UngroupAction extends AbstractGroupUngroupAction { selectedEps.clear();
TransactionalEditingDomain domain =
((GraphicalEditPart)viewer.getRootEditPart().getContents()).getEditingDomain();
- for (Entry<String,Map<String,Class>> entry : selectedContentForUndo.entrySet()) {
+ for (Entry<String,Map<String,Class<?>>> entry : selectedContentForUndo.entrySet()) {
GroupInSubprocessCommand cmd = new GroupInSubprocessCommand(domain,
viewer, entry.getValue(),
indexOfContainersOfSubProcessUngrouped.get(entry.getKey()));
@@ -265,6 +266,7 @@ public class UngroupAction extends AbstractGroupUngroupAction { // get the children views.
Set<EObject> semantic = new HashSet<EObject>();
+ //LinkedHashMap<EditPart,EObject> eps =
Set<View> views = new HashSet<View>();
Set<EObject> edges = new HashSet<EObject>();
@@ -455,6 +457,12 @@ try { ((EditPart) r).refresh();
((EditPart) r).activate();
}
+
+ for (View v : views) {
+ if (v.getElement() == null) {
+ System.err.println("We have a problem " + v + " is not pointing to a semantic model");
+ }
+ }
}
diff --git a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/providers/BpmnEAnnotationDecoratorProvider.java b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/providers/BpmnEAnnotationDecoratorProvider.java index 7cc021e..407f16e 100644 --- a/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/providers/BpmnEAnnotationDecoratorProvider.java +++ b/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/diagram/providers/BpmnEAnnotationDecoratorProvider.java @@ -305,9 +305,11 @@ public class BpmnEAnnotationDecoratorProvider extends AbstractProvider continue;
}
Image image = data.getImage();
- Direction direction = data.getDirection();
- IFigure tooltip = data.getToolTip();
- decorate(image, tooltip, direction, editPart, elt, ann, view);
+ if (image != null) {
+ Direction direction = data.getDirection();
+ IFigure tooltip = data.getToolTip();
+ decorate(image, tooltip, direction, editPart, elt, ann, view);
+ }
}
}
}
diff --git a/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/ActivityItemSemanticEditPolicy.java b/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/ActivityItemSemanticEditPolicy.java index c28bfb7..5dad77f 100644 --- a/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/ActivityItemSemanticEditPolicy.java +++ b/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/ActivityItemSemanticEditPolicy.java @@ -497,8 +497,8 @@ public class ActivityItemSemanticEditPolicy extends */
for (Iterator iter = tOutMessages.iterator(); iter.hasNext();) {
MessagingEdge element = (MessagingEdge) iter.next();
- Activity task = (Activity) element.getTarget();
- Identifiable container = (Identifiable) task.eContainer();
+ MessageVertex vertex = element.getTarget();
+ Identifiable container = (Identifiable) vertex;
while (!(container instanceof Pool)) {
container = (Identifiable) container.eContainer();
}
@@ -509,8 +509,8 @@ public class ActivityItemSemanticEditPolicy extends for (Iterator iter = tInMessages.iterator(); iter.hasNext();) {
MessagingEdge element = (MessagingEdge) iter.next();
- Activity task = (Activity) element.getSource();
- Identifiable container = (Identifiable) task.eContainer();
+ MessageVertex vertex = element.getSource();
+ Identifiable container = (Identifiable) vertex;
while (!(container instanceof Pool)) {
container = (Identifiable) container.eContainer();
}
@@ -521,8 +521,8 @@ public class ActivityItemSemanticEditPolicy extends for (Iterator iter = sOutMessages.iterator(); iter.hasNext();) {
MessagingEdge element = (MessagingEdge) iter.next();
- Activity task = (Activity) element.getTarget();
- Identifiable container = (Identifiable) task.eContainer();
+ MessageVertex vertex = element.getTarget();
+ Identifiable container = (Identifiable) vertex;
while (!(container instanceof Pool)) {
container = (Identifiable) container.eContainer();
}
@@ -533,8 +533,8 @@ public class ActivityItemSemanticEditPolicy extends for (Iterator iter = sInMessages.iterator(); iter.hasNext();) {
MessagingEdge element = (MessagingEdge) iter.next();
- Activity task = (Activity) element.getSource();
- Identifiable container = (Identifiable) task.eContainer();
+ MessageVertex vertex = element.getSource();
+ Identifiable container = (Identifiable) vertex;
while (!(container instanceof Pool)) {
container = (Identifiable) container.eContainer();
}
diff --git a/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/BpmnBaseItemSemanticEditPolicy.java b/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/BpmnBaseItemSemanticEditPolicy.java index 41b903e..a365806 100644 --- a/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/BpmnBaseItemSemanticEditPolicy.java +++ b/org.eclipse.stp.bpmn.diagram/src/org/eclipse/stp/bpmn/diagram/edit/policies/BpmnBaseItemSemanticEditPolicy.java @@ -124,11 +124,11 @@ public class BpmnBaseItemSemanticEditPolicy extends SemanticEditPolicy { ehCommand = ehCommand == null ? deleteViewCommand : ehCommand
.chain(deleteViewCommand);
}
- if (ehCommand == null) {
- // try to return epCommand instead in that case to avoid issues
- // with GMF 2.2 ~ fix for bug 280348
- ehCommand = epCommand;
- }
+ if (ehCommand == null) {
+ // try to return epCommand instead in that case to avoid issues
+ // with GMF 2.2 ~ fix for bug 280348
+ ehCommand = epCommand;
+ }
return ehCommand;
}
return null;
diff --git a/org.eclipse.stp.bpmn.validation/src/org/eclipse/stp/bpmn/validation/builder/ResourceImportersRegistry.java b/org.eclipse.stp.bpmn.validation/src/org/eclipse/stp/bpmn/validation/builder/ResourceImportersRegistry.java index 7779f7c..efae575 100644 --- a/org.eclipse.stp.bpmn.validation/src/org/eclipse/stp/bpmn/validation/builder/ResourceImportersRegistry.java +++ b/org.eclipse.stp.bpmn.validation/src/org/eclipse/stp/bpmn/validation/builder/ResourceImportersRegistry.java @@ -64,7 +64,7 @@ public class ResourceImportersRegistry implements IResourceImportersRegistry { */ public ListenerList changeListeners = new ListenerList(); - /** separator character between 2 project relative pathes. */ + /** separator character between 2 projects relative paths. */ private static String SEPARATOR = ":"; //$NON-NLS-1$ private boolean _isDirty; @@ -180,9 +180,11 @@ public class ResourceImportersRegistry implements IResourceImportersRegistry { StringTokenizer tokenizer = new StringTokenizer(simports, String.valueOf(SEPARATOR), false); while (tokenizer.hasMoreTokens()) { - Path path = new Path(tokenizer.nextToken()); + String spath = tokenizer.nextToken(); + Path path = new Path(spath); //it does not matter if the resource imported exists or not: - IResource imported = project.getFile(path);//assume a file + IResource imported = spath.endsWith("/") //$NON-NLS-1$ + ? project.getFolder(spath) : project.getFile(path); imports.add(imported); //and the mirror index: @@ -240,8 +242,7 @@ public class ResourceImportersRegistry implements IResourceImportersRegistry { return (Set<Entry<Object,Object>>) _orderedKeys.entrySet(); } }; - for (Entry<IResource, Set<IResource>> entry : - _importsIndexedByImporters.entrySet()) { + for (Entry<IResource, Set<IResource>> entry : _importsIndexedByImporters.entrySet()) { Set<IResource> imports = entry.getValue(); if (!imports.isEmpty()) { Iterator<IResource> it = imports.iterator(); @@ -253,6 +254,11 @@ public class ResourceImportersRegistry implements IResourceImportersRegistry { if (rPath != null) { buf = new StringBuilder(); buf.append(r.getProjectRelativePath().toString()); + if (r.getType() == IResource.FOLDER) { + //EDGE-3097: make sure we can make the difference + //between folders and files. + buf.append(IPath.SEPARATOR); + } break; } } |

