From 9d8095cf8815a2691a8ebf019e4c2065b6242829 Mon Sep 17 00:00:00 2001 From: Lukas Ladenberger <lukas.ladenberger@googlemail.com> Date: Tue, 6 Nov 2012 16:12:45 +0100 Subject: [PATCH] fixed PROBPLUGIN-40 --- .../bmotionstudio/gef/editor/command/PasteCommand.java | 2 ++ .../gef/editor/figure/VisualizationFigure.java | 2 -- .../src/de/bmotionstudio/gef/editor/model/BControl.java | 5 ++--- .../gef/editor/part/BMSAbstractEditPart.java | 9 +++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/PasteCommand.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/PasteCommand.java index 1136ff70..69c55986 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/PasteCommand.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/command/PasteCommand.java @@ -22,6 +22,7 @@ public class PasteCommand extends Command { private CopyPasteHelper cHelper; + // List with mapping original BControl ==> cloned BControl private HashMap<BControl, BControl> list = new HashMap<BControl, BControl>(); private List<BControl> parentControls = new ArrayList<BControl>(); @@ -68,6 +69,7 @@ public class PasteCommand extends Command { BControl control = (BControl) it.next(); control.setParent(parent); try { + BControl clone = (BControl) control.clone(); clone.setParent(parent); int x = Integer.valueOf(Integer.valueOf(clone diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/VisualizationFigure.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/VisualizationFigure.java index 1e500bd1..b2b647d2 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/VisualizationFigure.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/figure/VisualizationFigure.java @@ -10,7 +10,6 @@ import org.eclipse.draw2d.FreeformLayer; import org.eclipse.draw2d.FreeformLayout; import org.eclipse.draw2d.LayoutAnimator; import org.eclipse.draw2d.LayoutListener; -import org.eclipse.draw2d.MarginBorder; import org.eclipse.draw2d.geometry.Rectangle; public class VisualizationFigure extends FreeformLayer { @@ -19,7 +18,6 @@ public class VisualizationFigure extends FreeformLayer { public VisualizationFigure() { setLayoutManager(new FreeformLayout()); - setBorder(new MarginBorder(5)); addLayoutListener(layoutListener); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java index e364f3ab..b3027904 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/model/BControl.java @@ -650,8 +650,6 @@ public abstract class BControl implements IAdaptable, Cloneable { clonedControl.setParent(getParent()); - String newID = clonedControl.getID(); - Map<String, AbstractAttribute> newProperties = new HashMap<String, AbstractAttribute>(); for (Entry<String, AbstractAttribute> e : getAttributes().entrySet()) { AbstractAttribute idAtr = e.getValue().clone(); @@ -659,7 +657,8 @@ public abstract class BControl implements IAdaptable, Cloneable { } clonedControl.setAttributes(newProperties); - clonedControl.setAttributeValue(AttributeConstants.ATTRIBUTE_ID, newID); + clonedControl.setAttributeValue(AttributeConstants.ATTRIBUTE_ID, + getVisualization().getMaxIDString(type)); clonedControl.setChildrenArray(new BControlList()); Iterator<BControl> it = getChildrenArray().iterator(); diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java index 951a270c..90de631c 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/part/BMSAbstractEditPart.java @@ -23,6 +23,7 @@ import org.eclipse.draw2d.ConnectionAnchor; import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.FlowLayout; import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.NodeEditPart; import org.eclipse.gef.Request; @@ -173,10 +174,10 @@ public abstract class BMSAbstractEditPart extends AbstractGraphicalEditPart protected void refreshEditLayout(IFigure figure, BControl control) { if (!(control instanceof Visualization)) { - if (getFigure().getParent() != null) - getFigure().getParent().setConstraint((IFigure) figure, - control.getLayout()); - getFigure().setPreferredSize(control.getDimension()); + figure.setPreferredSize(control.getDimension()); + if (figure.getParent() != null) + figure.getParent().setConstraint(figure, + new Rectangle(control.getLayout())); } } -- GitLab