Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Brodt2014-06-07 07:51:59 -0400
committerBob Brodt2014-06-07 07:51:59 -0400
commit29f90f116fda9fe14f70ed6a32a9e9aad554a6ae (patch)
tree5c38f8ca9ca694a781d0b4916f7500e759cdaeab
parente2296dd4fb0996fd706e180165bf9c28da2eb0f0 (diff)
downloadorg.eclipse.bpmn2-modeler-29f90f116fda9fe14f70ed6a32a9e9aad554a6ae.tar.gz
org.eclipse.bpmn2-modeler-29f90f116fda9fe14f70ed6a32a9e9aad554a6ae.tar.xz
org.eclipse.bpmn2-modeler-29f90f116fda9fe14f70ed6a32a9e9aad554a6ae.zip
Fixed copy/paste - was missing labels.
Added support for BPMNLabel to content outline
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultMoveBPMNShapeFeature.java3
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultPasteBPMNElementFeature.java32
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java2
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/icons/16/BPMNLabel.pngbin0 -> 323 bytes
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/IConstants.java1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2ToolBehaviorProvider.java24
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNDiagramTreeEditPartFactory.java5
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNEdgeTreeEditPart.java5
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNLabelTreeEditPart.java56
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNShapeTreeEditPart.java8
10 files changed, 90 insertions, 46 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultMoveBPMNShapeFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultMoveBPMNShapeFeature.java
index d4ce2fa0..e8ed633e 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultMoveBPMNShapeFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultMoveBPMNShapeFeature.java
@@ -20,19 +20,18 @@ import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.bpmn2.modeler.core.utils.FeatureSupport;
import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.graphiti.datatypes.ILocation;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.IMoveShapeContext;
import org.eclipse.graphiti.features.context.impl.MoveShapeContext;
import org.eclipse.graphiti.features.impl.DefaultMoveShapeFeature;
-import org.eclipse.graphiti.mm.algorithms.AbstractText;
import org.eclipse.graphiti.mm.algorithms.styles.Point;
import org.eclipse.graphiti.mm.pictograms.Anchor;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.eclipse.graphiti.mm.pictograms.ContainerShape;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.platform.IDiagramContainer;
import org.eclipse.graphiti.services.Graphiti;
/**
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultPasteBPMNElementFeature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultPasteBPMNElementFeature.java
index a8e58bdc..5fd2d938 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultPasteBPMNElementFeature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/DefaultPasteBPMNElementFeature.java
@@ -177,7 +177,6 @@ public class DefaultPasteBPMNElementFeature extends AbstractPasteFeature {
*/
@Override
public void paste(IPasteContext context) {
- // TODO: COPY-PASTE
ContainerShape targetContainerShape = getTargetContainerShape(context);
BaseElement targetContainerObject = getContainerObject(targetContainerShape);
@@ -257,20 +256,26 @@ public class DefaultPasteBPMNElementFeature extends AbstractPasteFeature {
protected Object[] getFromClipboard() {
List<Object> allObjects = new ArrayList<Object>();
Object[] objects = super.getFromClipboard();
- for (Object o : objects)
- allObjects.add(o);
+ for (Object object : objects) {
+ if (object instanceof EObject && ((EObject)object).eContainer()!=null)
+ allObjects.add(object);
+ }
List<Object> filteredObjects = new ArrayList<Object>();
for (Object object : allObjects) {
- if (object instanceof ContainerShape && !FeatureSupport.isLabelShape((Shape)object)) {
- filteredObjects.add(object);
- }
- else if (object instanceof Connection) {
- Connection c = (Connection)object;
- if (allObjects.contains(c.getStart().getParent()) &&
- allObjects.contains(c.getEnd().getParent())) {
+ if (object instanceof EObject && ((EObject)object).eContainer()!=null) {
+ if (object instanceof ContainerShape) {
filteredObjects.add(object);
}
+ else if (object instanceof Connection) {
+ Connection c = (Connection)object;
+ if (c.getStart()!=null && c.getEnd()!=null) {
+ if (allObjects.contains(c.getStart().getParent()) &&
+ allObjects.contains(c.getEnd().getParent())) {
+ filteredObjects.add(object);
+ }
+ }
+ }
}
}
@@ -483,8 +488,8 @@ public class DefaultPasteBPMNElementFeature extends AbstractPasteFeature {
}
ac.putProperty(GraphitiConstants.COPIED_BPMN_OBJECT, oldObject);
- IAddFeature af = getFeatureProvider().getAddFeature(ac);
- ContainerShape newShape = (ContainerShape) af.add(ac);
+
+ ContainerShape newShape = (ContainerShape) getFeatureProvider().addIfPossible(ac);
shapeMap.put(oldShape, newShape);
@@ -643,8 +648,7 @@ public class DefaultPasteBPMNElementFeature extends AbstractPasteFeature {
AddConnectionContext acc = new AddConnectionContext(newStart, newEnd);
acc.setNewObject(newObject);
- IAddFeature af = getFeatureProvider().getAddFeature(acc);
- Connection newConnection = (Connection) af.add(acc);
+ Connection newConnection = (Connection) getFeatureProvider().addIfPossible(acc);
connectionMap.put(oldConnection, newConnection);
if (oldConnection instanceof FreeFormConnection && newConnection instanceof FreeFormConnection) {
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
index dca0cd30..f8ce37b4 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
@@ -308,7 +308,7 @@ public abstract class AbstractDetailComposite extends ListAndDetailCompositeBase
descriptionText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
descriptionText.setData(AbstractObjectEditingDialog.DO_NOT_ADAPT , Boolean.TRUE);
- GridData d = new GridData(SWT.FILL, SWT.FILL, false, false, 3, 1);
+ GridData d = new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1);
d.horizontalIndent = 4;
d.verticalIndent = 4;
d.heightHint = (int)(5.5 * getDescriptionFont().getFontData()[0].getHeight());
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/icons/16/BPMNLabel.png b/plugins/org.eclipse.bpmn2.modeler.ui/icons/16/BPMNLabel.png
new file mode 100644
index 00000000..fc549691
--- /dev/null
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/icons/16/BPMNLabel.png
Binary files differ
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/IConstants.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/IConstants.java
index 02aeb69a..583bf431 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/IConstants.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/IConstants.java
@@ -131,6 +131,7 @@ public interface IConstants {
public final String ICON_USERTASK = "16/UserTask.png"; //$NON-NLS-1$
public final String ICON_BPMNSHAPE = "16/BPMNShape.png"; //$NON-NLS-1$
public final String ICON_BPMNEDGE = "16/BPMNEdge.png"; //$NON-NLS-1$
+ public final String ICON_BPMNLABEL = "16/BPMNLabel.png"; //$NON-NLS-1$
public final String ICON_BPMNDIAGRAM = "16/BPMNDiagram.png"; //$NON-NLS-1$
public final String ICON_BPMNSUBDIAGRAM = "16/BPMNSubDiagram.png"; //$NON-NLS-1$
public final String ICON_PROCESS = "16/Process.png"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2ToolBehaviorProvider.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2ToolBehaviorProvider.java
index e37e8253..e2e86826 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2ToolBehaviorProvider.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2ToolBehaviorProvider.java
@@ -733,8 +733,8 @@ public class Bpmn2ToolBehaviorProvider extends DefaultToolBehaviorProvider imple
}
@Override
+ @SuppressWarnings("rawtypes")
public void postExecute(IExecutionInfo executionInfo) {
- BPMN2Editor editor = (BPMN2Editor)getDiagramTypeProvider().getDiagramEditor();
for (IFeatureAndContext fc : executionInfo.getExecutionList()) {
IContext context = fc.getContext();
IFeature feature = fc.getFeature();
@@ -748,28 +748,6 @@ public class Bpmn2ToolBehaviorProvider extends DefaultToolBehaviorProvider imple
((IBpmn2CreateFeature)feature).postExecute(executionInfo);
}
}
- else if (context instanceof UpdateContext) {
- PictogramElement pe = ((UpdateContext)context).getPictogramElement();
- if (!(pe instanceof Connection)) {
- editor.setPictogramElementForSelection(pe);
- }
- editor.refresh();
- }
- else if (context instanceof MoveShapeContext) {
- PictogramElement pe = ((MoveShapeContext)context).getPictogramElement();
- editor.setPictogramElementForSelection(pe);
- editor.refresh();
- }
- else if (context instanceof AddBendpointContext) {
- PictogramElement pe = ((AddBendpointContext)context).getConnection();
- editor.setPictogramElementForSelection(pe);
- editor.refresh();
- }
- else if (context instanceof MoveBendpointContext) {
- PictogramElement pe = ((MoveBendpointContext)context).getConnection();
- editor.setPictogramElementForSelection(pe);
- editor.refresh();
- }
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNDiagramTreeEditPartFactory.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNDiagramTreeEditPartFactory.java
index 88ef6777..afc005a8 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNDiagramTreeEditPartFactory.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNDiagramTreeEditPartFactory.java
@@ -20,8 +20,9 @@ import org.eclipse.bpmn2.Operation;
import org.eclipse.bpmn2.Participant;
import org.eclipse.bpmn2.RootElement;
import org.eclipse.bpmn2.di.BPMNDiagram;
-import org.eclipse.bpmn2.di.BPMNShape;
import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.bpmn2.di.BPMNLabel;
+import org.eclipse.bpmn2.di.BPMNShape;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.eclipse.graphiti.mm.pictograms.Diagram;
@@ -85,6 +86,8 @@ public class BPMNDiagramTreeEditPartFactory implements EditPartFactory {
ret = new BPMNShapeTreeEditPart(dep, (BPMNShape) model);
} else if (model instanceof BPMNEdge) {
ret = new BPMNEdgeTreeEditPart(dep, (BPMNEdge) model);
+ } else if (model instanceof BPMNLabel) {
+ ret = new BPMNLabelTreeEditPart(dep, (BPMNLabel) model);
}
}
return ret;
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNEdgeTreeEditPart.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNEdgeTreeEditPart.java
index c103e849..9345ef53 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNEdgeTreeEditPart.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNEdgeTreeEditPart.java
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.bpmn2.di.BPMNLabel;
import org.eclipse.bpmn2.di.BPMNShape;
public class BPMNEdgeTreeEditPart extends AbstractGraphicsTreeEditPart {
@@ -40,7 +41,9 @@ public class BPMNEdgeTreeEditPart extends AbstractGraphicsTreeEditPart {
protected List<Object> getModelChildren() {
List<Object> retList = new ArrayList<Object>();
BPMNEdge bpmnEdge = getBPMNEdge();
- // TODO
+ BPMNLabel bpmnLabel = bpmnEdge.getLabel();
+ if (bpmnLabel!=null)
+ retList.add(bpmnLabel);
return retList;
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNLabelTreeEditPart.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNLabelTreeEditPart.java
new file mode 100644
index 00000000..0fbfdb7d
--- /dev/null
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNLabelTreeEditPart.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Red Hat, Inc.
+ * All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.views.outline;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpmn2.di.BPMNLabel;
+import org.eclipse.dd.dc.Bounds;
+
+public class BPMNLabelTreeEditPart extends AbstractGraphicsTreeEditPart {
+
+ public BPMNLabelTreeEditPart(DiagramTreeEditPart dep, BPMNLabel BPMNLabel) {
+ super(dep, BPMNLabel);
+ }
+
+ public BPMNLabel getBPMNLabel() {
+ return (BPMNLabel) getModel();
+ }
+
+ // ======================= overwriteable behaviour ========================
+
+ /**
+ * Creates the EditPolicies of this EditPart. Subclasses often overwrite
+ * this method to change the behaviour of the editpart.
+ */
+ @Override
+ protected void createEditPolicies() {
+ }
+
+ @Override
+ protected List<Object> getModelChildren() {
+ List<Object> retList = new ArrayList<Object>();
+ BPMNLabel bpmnLabel = getBPMNLabel();
+ // TODO
+ return retList;
+ }
+
+ @Override
+ protected String getText() {
+ BPMNLabel bpmnLabel = getBPMNLabel();
+ if (bpmnLabel.getBounds()!=null) {
+ Bounds b = bpmnLabel.getBounds();
+ return "Label: x="+b.getX()+", y="+b.getY()+" w="+b.getWidth()+" h="+b.getHeight();
+ }
+ return "Label";
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNShapeTreeEditPart.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNShapeTreeEditPart.java
index 98931bc6..d3839a93 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNShapeTreeEditPart.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMNShapeTreeEditPart.java
@@ -13,10 +13,8 @@ package org.eclipse.bpmn2.modeler.ui.views.outline;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.bpmn2.di.BPMNLabel;
import org.eclipse.bpmn2.di.BPMNShape;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
public class BPMNShapeTreeEditPart extends AbstractGraphicsTreeEditPart {
@@ -42,7 +40,9 @@ public class BPMNShapeTreeEditPart extends AbstractGraphicsTreeEditPart {
protected List<Object> getModelChildren() {
List<Object> retList = new ArrayList<Object>();
BPMNShape bpmnShape = getBPMNShape();
- // TODO
+ BPMNLabel bpmnLabel = bpmnShape.getLabel();
+ if (bpmnLabel!=null)
+ retList.add(bpmnLabel);
return retList;
}

Back to the top