Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java11
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java11
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java161
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/EFontConversionDelegate.java4
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java21
5 files changed, 112 insertions, 96 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
index c14a02e1..c836d8d3 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
@@ -453,6 +453,17 @@ public class DIImport {
private void importConnections(List<DiagramElement> ownedElement) {
for (DiagramElement diagramElement : ownedElement) {
if (diagramElement instanceof BPMNEdge) {
+ // Since Associations can have other connections as sources/targets
+ // handle these last.
+ if (((BPMNEdge) diagramElement).getBpmnElement() instanceof Association)
+ continue;
+ createEdge((BPMNEdge) diagramElement);
+ }
+ }
+ for (DiagramElement diagramElement : ownedElement) {
+ if (diagramElement instanceof BPMNEdge) {
+ if (!(((BPMNEdge) diagramElement).getBpmnElement() instanceof Association))
+ continue;
createEdge((BPMNEdge) diagramElement);
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
index 376918c0..48f4829a 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
@@ -129,16 +129,7 @@ public class NamespaceUtil {
if (prefix==null) {
prefix = "ns"; //$NON-NLS-1$
}
- final String pfx = createUniquePrefix(map, prefix);
- TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
- if (domain != null) {
- domain.getCommandStack().execute(new RecordingCommand(domain) {
- @Override
- protected void doExecute() {
- map.put(pfx, namespace);
- }
- });
- }
+ map.put(prefix, namespace);
return prefix;
}
return null;
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
index 3feac32d..12d30621 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
@@ -1256,86 +1256,87 @@ public class BPMN2Editor extends DiagramEditor implements IPreferenceChangeListe
// if the selected element is obscured by another shape
// send it to the top of the z-stack.
- final List<ContainerShape> moved = new ArrayList<ContainerShape>();
- for (PictogramElement pe : getSelectedPictogramElements()) {
- if (pe instanceof ContainerShape && !(pe instanceof Diagram)) {
- final ContainerShape shape = (ContainerShape)pe;
- ContainerShape container = shape.getContainer();
- // make sure this shape has not been deleted
- if (container==null)
- continue;
- int size = container.getChildren().size();
- if (size>1) {
- // don't send Choreography Participant bands, Pools or Lanes to front
- // they're already there...
- BaseElement baseElement = BusinessObjectUtil.getFirstBaseElement(shape);
- if (baseElement instanceof Participant || baseElement instanceof Lane)
- continue;
- boolean obscured = false;
- int index = container.getChildren().indexOf(shape);
- for (int i=index+1; i<container.getChildren().size(); ++i) {
- PictogramElement sibling = container.getChildren().get(i);
- if (sibling instanceof ContainerShape &&
- !FeatureSupport.isLabelShape((ContainerShape)sibling)) {
- if (GraphicsUtil.intersects(shape, (ContainerShape)sibling)) {
- boolean siblingIsBoundaryEvent = false;
- if (baseElement instanceof Activity) {
- BaseElement be = BusinessObjectUtil.getFirstBaseElement(sibling);
- for (BoundaryEvent boundaryEvent : ((Activity)baseElement).getBoundaryEventRefs()) {
- if (be==boundaryEvent) {
- siblingIsBoundaryEvent = true;
- break;
- }
- }
- }
- if (!siblingIsBoundaryEvent) {
- obscured = true;
- }
- }
- }
- }
- // if the selected shape is an Activity, it may have Boundary Event shapes
- // attached to it - these will have to be moved to the top so they're
- // not obscured by the Activity.
- if (baseElement instanceof Activity) {
- for (BoundaryEvent be : ((Activity)baseElement).getBoundaryEventRefs()) {
- for (PictogramElement child : container.getChildren()) {
- if (child instanceof ContainerShape && BusinessObjectUtil.getFirstBaseElement(child) == be) {
- index = container.getChildren().indexOf(child);
- for (int i=index+1; i<container.getChildren().size(); ++i) {
- PictogramElement sibling = container.getChildren().get(i);
- if (sibling!=shape && sibling instanceof ContainerShape) {
- if (GraphicsUtil.intersects((ContainerShape)child, (ContainerShape)sibling)) {
- obscured = true;
- moved.add((ContainerShape)child);
- }
- }
- }
- }
- }
- }
- }
- if (obscured) {
- moved.add(0,shape);
- }
- }
- }
- }
- if (!moved.isEmpty()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- getEditingDomain().getCommandStack().execute(new RecordingCommand(getEditingDomain()) {
- @Override
- protected void doExecute() {
- for (ContainerShape child : moved) {
- GraphicsUtil.sendToFront(child);
- }
- }
- });
- }
- });
- }
+ // FIXME: this should be done in the figure's UpdateFeature or LayoutFeature, not here.
+// final List<ContainerShape> moved = new ArrayList<ContainerShape>();
+// for (PictogramElement pe : getSelectedPictogramElements()) {
+// if (pe instanceof ContainerShape && !(pe instanceof Diagram)) {
+// final ContainerShape shape = (ContainerShape)pe;
+// ContainerShape container = shape.getContainer();
+// // make sure this shape has not been deleted
+// if (container==null)
+// continue;
+// int size = container.getChildren().size();
+// if (size>1) {
+// // don't send Choreography Participant bands, Pools or Lanes to front
+// // they're already there...
+// BaseElement baseElement = BusinessObjectUtil.getFirstBaseElement(shape);
+// if (baseElement instanceof Participant || baseElement instanceof Lane)
+// continue;
+// boolean obscured = false;
+// int index = container.getChildren().indexOf(shape);
+// for (int i=index+1; i<container.getChildren().size(); ++i) {
+// PictogramElement sibling = container.getChildren().get(i);
+// if (sibling instanceof ContainerShape &&
+// !FeatureSupport.isLabelShape((ContainerShape)sibling)) {
+// if (GraphicsUtil.intersects(shape, (ContainerShape)sibling)) {
+// boolean siblingIsBoundaryEvent = false;
+// if (baseElement instanceof Activity) {
+// BaseElement be = BusinessObjectUtil.getFirstBaseElement(sibling);
+// for (BoundaryEvent boundaryEvent : ((Activity)baseElement).getBoundaryEventRefs()) {
+// if (be==boundaryEvent) {
+// siblingIsBoundaryEvent = true;
+// break;
+// }
+// }
+// }
+// if (!siblingIsBoundaryEvent) {
+// obscured = true;
+// }
+// }
+// }
+// }
+// // if the selected shape is an Activity, it may have Boundary Event shapes
+// // attached to it - these will have to be moved to the top so they're
+// // not obscured by the Activity.
+// if (baseElement instanceof Activity) {
+// for (BoundaryEvent be : ((Activity)baseElement).getBoundaryEventRefs()) {
+// for (PictogramElement child : container.getChildren()) {
+// if (child instanceof ContainerShape && BusinessObjectUtil.getFirstBaseElement(child) == be) {
+// index = container.getChildren().indexOf(child);
+// for (int i=index+1; i<container.getChildren().size(); ++i) {
+// PictogramElement sibling = container.getChildren().get(i);
+// if (sibling!=shape && sibling instanceof ContainerShape) {
+// if (GraphicsUtil.intersects((ContainerShape)child, (ContainerShape)sibling)) {
+// obscured = true;
+// moved.add((ContainerShape)child);
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// if (obscured) {
+// moved.add(0,shape);
+// }
+// }
+// }
+// }
+// if (!moved.isEmpty()) {
+// Display.getDefault().asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// getEditingDomain().getCommandStack().execute(new RecordingCommand(getEditingDomain()) {
+// @Override
+// protected void doExecute() {
+// for (ContainerShape child : moved) {
+// GraphicsUtil.sendToFront(child);
+// }
+// }
+// });
+// }
+// });
+// }
}
@Override
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/EFontConversionDelegate.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/EFontConversionDelegate.java
index 82eaed08..7fa40fde 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/EFontConversionDelegate.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/EFontConversionDelegate.java
@@ -97,7 +97,9 @@ public class EFontConversionDelegate extends DefaultConversionDelegate {
}
catch (Exception e) {}
}
- return systemFontData;
+ if (systemFontData!=null)
+ return systemFontData;
+ return new FontData("arial",12,SWT.NORMAL);
}
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
index 25d9bdd1..7639db86 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
@@ -40,9 +40,11 @@ import org.eclipse.emf.ecore.EAttribute;
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.util.EcoreEMap;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.CellEditor;
@@ -440,11 +442,20 @@ public class DefinitionsPropertyComposite extends DefaultDetailComposite {
}
protected boolean setValue(final Object value) {
- // remove old prefix
- String prefix = text.getText();
- NamespaceUtil.removeNamespaceForPrefix(imp.eResource(), prefix);
- // and add new
- NamespaceUtil.addNamespace(imp.eResource(), (String)value, imp.getNamespace());
+ final Resource resource = imp.eResource();
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
+ if (domain != null) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
+ @Override
+ protected void doExecute() {
+ // remove old prefix
+ String prefix = text.getText();
+ NamespaceUtil.removeNamespaceForPrefix(resource, prefix);
+ // and add new
+ NamespaceUtil.addNamespace(resource, (String)value, imp.getNamespace());
+ }
+ });
+ }
setText((String) value);
return true;
}

Back to the top