Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2014-09-23 16:30:20 +0000
committerMickael ADAM2014-09-26 07:57:20 +0000
commitffc9fe0f9597605fa92545664e8520cbe92c7b3c (patch)
treef7b319bb6b6ba11cc2b3932e625344978ecaba63 /plugins/infra
parent84b7754d168b0ae91f06faf45d4356f5d9b38111 (diff)
downloadorg.eclipse.papyrus-ffc9fe0f9597605fa92545664e8520cbe92c7b3c.tar.gz
org.eclipse.papyrus-ffc9fe0f9597605fa92545664e8520cbe92c7b3c.tar.xz
org.eclipse.papyrus-ffc9fe0f9597605fa92545664e8520cbe92c7b3c.zip
440226: [All Diagrams] Allow Left side label edition (not only right
side ) Patch set 1: -Some fix -RefreshTAEP: delete unecessary handler -add //$NON-NLS-N$ -Regenerate class diagram -add PapyrusLabelEditPart for Time/Duration Observation name -take into account margin for locator Patch set 2: -Fix port name constrained refresh issue -Some Fix Patch set 3 -Fix port with icon position -Fix direct edit issue -Rename locator Patch set 4 -Rebase -Rename of CSS attribute -fix on customTimeEditPart Patch set 5 -Some clean of code Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=440226 Change-Id: Iffa42f612ea5f8c22b1c33efd55f83fadceccdeb Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java127
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/RefreshTextAlignmentEditPolicy.java48
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/IPapyrusBorderItemLocator.java18
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/PapyrusLabelLocator.java35
4 files changed, 97 insertions, 131 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
index c7815db0d5a..287e0c5552e 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
@@ -52,40 +52,40 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
/**
* CSS Integer property to define the horizontal Label Margin
*/
- static final String TOP_MARGIN_PROPERTY = "TopMarginLabel"; //$NON-NLS$
+ public static final String TOP_MARGIN_PROPERTY = "topMarginLabel"; // $NON-NLS$
/**
* CSS Integer property to define the vertical Label Margin
*/
- static final String LEFT_MARGIN_PROPERTY = "LeftMarginLabel"; //$NON-NLS$
-
+ public static final String LEFT_MARGIN_PROPERTY = "leftMarginLabel"; // $NON-NLS$
+
/**
* CSS Integer property to define the horizontal Label Margin
*/
- static final String BOTTOM_MARGIN_PROPERTY = "BottomMarginLabel"; //$NON-NLS$
+ public static final String BOTTOM_MARGIN_PROPERTY = "bottomMarginLabel"; // $NON-NLS$
/**
* CSS Integer property to define the vertical Label Margin
*/
- static final String RIGHT_MARGIN_PROPERTY = "RightMarginLabel"; //$NON-NLS$
+ public static final String RIGHT_MARGIN_PROPERTY = "rightMarginLabel"; // $NON-NLS$
/** The Constant TEXT_ALIGNMENT. */
- private static final String TEXT_ALIGNMENT = "textAlignment"; //$NON-NLS$
+ public static final String TEXT_ALIGNMENT = "textAlignment"; // $NON-NLS$
/** The Constant LABEL_OFFSET_Y. */
- private static final String LABEL_OFFSET_Y = "labelOffsetY"; //$NON-NLS$
+ public static final String LABEL_OFFSET_Y = "labelOffsetY"; // $NON-NLS$
/** The Constant LABEL_OFFSET_X. */
- private static final String LABEL_OFFSET_X = "labelOffsetX"; //$NON-NLS$
+ public static final String LABEL_OFFSET_X = "labelOffsetX"; // $NON-NLS$
/** The Constant LABEL_CONSTRAINED. */
- private static final String LABEL_CONSTRAINED = "labelConstrained"; //$NON-NLS$
-
- /** The label locator. */
- protected PapyrusLabelLocator labelLocator;
+ public static final String LABEL_CONSTRAINED = "labelConstrained"; // $NON-NLS$
/** The external label locator. */
- protected IPapyrusBorderItemLocator externalLabelLocator;
+ protected PapyrusLabelLocator papyrusLabelLocator = null;
+
+ /** The affixed label locator. */
+ protected IPapyrusBorderItemLocator borderLabelLocator = null;
public PapyrusLabelEditPart(View view) {
@@ -95,7 +95,6 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
-
installEditPolicy(BorderDisplayEditPolicy.BORDER_DISPLAY_EDITPOLICY, new BorderDisplayEditPolicy());
installEditPolicy(LabelAlignmentEditPolicy.LABEL_ALIGNMENT_KEY, new LabelAlignmentEditPolicy());
installEditPolicy(LabelPrimarySelectionEditPolicy.LABEL_PRIMARY_SELECTION_KEY, new LabelPrimarySelectionEditPolicy());
@@ -142,18 +141,18 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
Connection connectionFigure = ((AbstractConnectionEditPart) getParent()).getConnectionFigure();
- if (labelLocator != null) {
- labelLocator.setOffset(offset);
+ if (papyrusLabelLocator != null) {
+ papyrusLabelLocator.setOffset(offset);
} else {
- labelLocator = new PapyrusLabelLocator(connectionFigure, offset, getKeyPoint());
+ papyrusLabelLocator = new PapyrusLabelLocator(connectionFigure, offset, getKeyPoint());
}
- labelLocator.setTextAlignment(getTextAlignment());
- labelLocator.setView((View) getModel());
- parentEditPart.setLayoutConstraint(this, getFigure(), labelLocator);
+ papyrusLabelLocator.setTextAlignment(getTextAlignment());
+ papyrusLabelLocator.setView((View) getModel());
+ parentEditPart.setLayoutConstraint(this, getFigure(), papyrusLabelLocator);
} else {
setExternalLabelLocator(offset);
- getFigure().getParent().setConstraint(getFigure(), externalLabelLocator);
+ getFigure().getParent().setConstraint(getFigure(), borderLabelLocator);
}
}
@@ -164,15 +163,16 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
* the new external label locator
*/
private void setExternalLabelLocator(Point offset) {
- if (externalLabelLocator == null) {
- externalLabelLocator = (IPapyrusBorderItemLocator) getBorderItemLocator();
+ if (borderLabelLocator == null) {
+ borderLabelLocator = (IPapyrusBorderItemLocator) getBorderItemLocator();
+
}
if (offset != null) {
- externalLabelLocator.setConstraint(new Rectangle(offset.x, offset.y, 0, 0));
+ borderLabelLocator.setConstraint(new Rectangle(offset.x, offset.y, 0, 0));
}
- externalLabelLocator.setView((View) getModel());
- externalLabelLocator.setTextAlignment(getTextAlignment());
- externalLabelLocator.setPosition(getPositionOnParent());
+ borderLabelLocator.setView((View) getModel());
+ borderLabelLocator.setEditpart(this);
+ borderLabelLocator.setTextAlignment(getTextAlignment());
}
/**
@@ -197,7 +197,6 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
public int getTextAlignment() {
// get the value of the CSS property
View model = (View) getModel();
- // View eContainer = (View) model.eContainer();// Pas sur le eContainer
StringValueStyle labelAlignment = (StringValueStyle) model.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), TEXT_ALIGNMENT);
int textAlignment = 0;
@@ -249,6 +248,21 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
}
/**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart#refresh()
+ *
+ */
+ @Override
+ public void refresh() {
+ super.refresh();
+ if (getBorderItemLocator() instanceof IPapyrusBorderItemLocator) {
+ // Constrained management
+ setExternalLabelLocator(null);
+ refreshLabelConstrained();
+ refreshLabelOffset();
+ }
+ }
+
+ /**
* Refresh label offset.
*/
private void refreshLabelOffset() {
@@ -274,53 +288,6 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
// set the value on the locator
((IPapyrusBorderItemLocator) getBorderItemLocator()).setConstrained(labelConstrained);
}
- // Set the position from the parent position
- ((IPapyrusBorderItemLocator) getBorderItemLocator()).setPosition(getPositionOnParent());
- }
-
- /**
- * Refresh label text alignement.
- */
- private void refreshLabelTextAlignement() {
- ((IPapyrusBorderItemLocator) getBorderItemLocator()).setTextAlignment(getTextAlignment());
- }
-
- /**
- * Gets the position on parent.
- *
- * @return the position on parent
- */
- public int getPositionOnParent() {
- Rectangle portBounds = null;
- Rectangle parentBounds = null;
- int position = PositionConstants.EAST;
-
- // Get the port figure
- if (getParent() instanceof IPapyrusEditPart) {
- IFigure portPrimaryShape = ((IPapyrusEditPart) getParent()).getPrimaryShape();
- portBounds = portPrimaryShape.getBounds();
-
- // Get the port's parent figure
- // if it's a papyrus edit part and the figure is paint(width !=0)
- if (getParent().getParent() instanceof IPapyrusEditPart && portBounds.width != 0) {
- IFigure parentPrimaryShape = ((IPapyrusEditPart) getParent().getParent()).getPrimaryShape();
- parentBounds = parentPrimaryShape.getBounds();
-
- if (portBounds.x + portBounds.width / 2 == parentBounds.x) {
- // West position
- position = PositionConstants.WEST;
- } else if (portBounds.x + portBounds.width / 2 == parentBounds.getBottomRight().x) {
- // East Position
- position = PositionConstants.EAST;
- } else if (portBounds.y + portBounds.height / 2 == parentBounds.y) {
- position = PositionConstants.NORTH;
- } else if (portBounds.y + portBounds.height / 2 == parentBounds.getBottomRight().y) {
- position = PositionConstants.SOUTH;
- }
- }
- }
-
- return position;
}
/**
@@ -372,8 +339,6 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
Object model = this.getModel();
-
-
if (model instanceof View) {
leftMargin = NotationUtils.getIntValue((View) model, LEFT_MARGIN_PROPERTY, DEFAULT_MARGIN);
rightMargin = NotationUtils.getIntValue((View) model, RIGHT_MARGIN_PROPERTY, DEFAULT_MARGIN);
@@ -385,8 +350,14 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
if (figure instanceof IPapyrusWrappingLabel) {
((IPapyrusWrappingLabel) figure).setMarginLabel(leftMargin, topMargin, rightMargin, bottomMargin);
+
+ // set margin of locator:
+ if (borderLabelLocator != null) {
+ borderLabelLocator.setMargin(new Point(leftMargin + rightMargin, topMargin + bottomMargin));
+ } else if (papyrusLabelLocator != null) {
+ papyrusLabelLocator.setMargin(new Point(leftMargin + rightMargin, topMargin + bottomMargin));
+ }
}
}
-
} \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/RefreshTextAlignmentEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/RefreshTextAlignmentEditPolicy.java
index 6d41ebf2463..74a3fb970c9 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/RefreshTextAlignmentEditPolicy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/RefreshTextAlignmentEditPolicy.java
@@ -16,12 +16,6 @@ package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
@@ -30,17 +24,19 @@ import org.eclipse.papyrus.infra.gmfdiag.common.databinding.custom.CustomStringS
/**
* this edit policy has in charge to refresh the edit part when text alignment change.
*/
-public class RefreshTextAlignmentEditPolicy extends GraphicalEditPolicyEx implements IChangeListener, NotificationListener {
+public class RefreshTextAlignmentEditPolicy extends GraphicalEditPolicyEx implements IChangeListener {
/** The Constant TEXT_ALIGNMENT. */
- public static final String TEXT_ALIGNMENT = "textAlignment";
+ public static final String TEXT_ALIGNMENT = "textAlignment";//$NON-NLS-N$
/** key for this edit policy. */
- public final static String REFRESH_TEXT_ALIGNMENT_EDITPOLICY = "REFRESH_TEXT_ALIGNMENT_EDITPOLICY";
+ public final static String REFRESH_TEXT_ALIGNMENT_EDITPOLICY = "Refresh text alignment edit policy";//$NON-NLS-N$
/** The style observable. */
protected IObservableValue styleObservable;
+ protected IObservableValue positionObservable;
+
/**
*
* {@inheritDoc}
@@ -52,35 +48,14 @@ public class RefreshTextAlignmentEditPolicy extends GraphicalEditPolicyEx implem
if (view == null) {
return;
}
-
+ // add style observable value
styleObservable = new CustomStringStyleObservableValue(view, EMFHelper.resolveEditingDomain(view), TEXT_ALIGNMENT);
styleObservable.addChangeListener(this);
- // adds a listener on the view and the element controlled by the editpart
- getDiagramEventBroker().addNotificationListener(view, this);
- getDiagramEventBroker().addNotificationListener(view.eContainer(), this);
-
- EObject semanticElement = EMFHelper.getEObject(getHost());
- if (semanticElement != null) {
- getDiagramEventBroker().addNotificationListener(semanticElement, this);
- }
getHost().refresh();
}
/**
- * Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (theEditingDomain != null) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
- /**
*
* {@inheritDoc}
*/
@@ -94,16 +69,6 @@ public class RefreshTextAlignmentEditPolicy extends GraphicalEditPolicyEx implem
}
/**
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- public void notifyChanged(Notification notification) {
- getHost().refresh();
- }
-
- /**
* @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
*
* @param event
@@ -112,4 +77,5 @@ public class RefreshTextAlignmentEditPolicy extends GraphicalEditPolicyEx implem
public void handleChange(ChangeEvent event) {
getHost().refresh();
}
+
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/IPapyrusBorderItemLocator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/IPapyrusBorderItemLocator.java
index 2163e676cdd..b23e15f9d30 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/IPapyrusBorderItemLocator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/IPapyrusBorderItemLocator.java
@@ -14,6 +14,8 @@
package org.eclipse.papyrus.infra.gmfdiag.common.locator;
import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
import org.eclipse.gmf.runtime.notation.View;
@@ -91,4 +93,20 @@ public interface IPapyrusBorderItemLocator extends IBorderItemLocator {
* the new view
*/
public void setView(View model);
+
+ /**
+ * Sets the editpart.
+ *
+ * @param editpart
+ * the new editpart
+ */
+ public void setEditpart(EditPart editpart);
+
+ /**
+ * Sets the margin.
+ *
+ * @param margin
+ * the new margin
+ */
+ public void setMargin(Point margin);
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/PapyrusLabelLocator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/PapyrusLabelLocator.java
index 0997ab1d624..f63c9d1de1f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/PapyrusLabelLocator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/locator/PapyrusLabelLocator.java
@@ -13,6 +13,7 @@
package org.eclipse.papyrus.infra.gmfdiag.common.locator;
+
import org.eclipse.draw2d.AbstractLocator;
import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.ConnectionLocator;
@@ -31,6 +32,7 @@ import org.eclipse.gmf.runtime.draw2d.ui.geometry.LineSeg;
import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.PapyrusLabelHelper;
/**
@@ -40,7 +42,6 @@ import org.eclipse.papyrus.infra.gmfdiag.common.helper.PapyrusLabelHelper;
*/
public class PapyrusLabelLocator extends AbstractLocator {
-
/** the parent figure of this locator. */
protected IFigure parent;
@@ -80,7 +81,7 @@ public class PapyrusLabelLocator extends AbstractLocator {
/** The cached bounds. */
private Rectangle cachedBounds = new Rectangle();
- // private int dx;
+
/** The cached offset. */
private Point cachedOffset;
@@ -90,6 +91,9 @@ public class PapyrusLabelLocator extends AbstractLocator {
/** The cached segment. */
private LineSeg cachedSegment;
+ /** The margin. */
+ private Point margin = new Point();
+
/**
* Constructor to create a an instance of <code>LabelLocator</code> which locates an IFigure offset relative to a calculated reference point.
*
@@ -155,6 +159,7 @@ public class PapyrusLabelLocator extends AbstractLocator {
// the size must be set first.
Dimension size = new Dimension();
+
if (extent != null) {
PapyrusLabelLocator currentConstraint = (PapyrusLabelLocator) target.getParent().getLayoutManager().getConstraint(target);
Dimension currentExtent = currentConstraint.getSize();
@@ -178,10 +183,7 @@ public class PapyrusLabelLocator extends AbstractLocator {
Point location = null;
// If it's a rename
if (cachedString != null && !cachedString.equals(((WrappingLabel) target).getText())) {
- // System.out.println("Rename");
- // location = PapyrusLabelHelper.relativeCoordinateFromOffset(target, getReferencePoint(), offSet, textAlignment);
location = cachedBounds.getLocation();
-
int x;
int textWidth = ((IFigure) target.getChildren().get(0)).getBounds().width;
@@ -191,10 +193,10 @@ public class PapyrusLabelLocator extends AbstractLocator {
x = 0;
break;
case PositionConstants.RIGHT:
- x = textWidth - cachedBounds.width;
+ x = textWidth - cachedBounds.width + margin.x;
break;
case PositionConstants.CENTER:
- x = (textWidth - cachedBounds.width) / 2;
+ x = (textWidth - cachedBounds.width + margin.x) / 2;
break;
default:
x = 0;
@@ -205,7 +207,6 @@ public class PapyrusLabelLocator extends AbstractLocator {
IFigure tmpTarget = target;
tmpTarget.translate(x, 0);
final Point viewLocation = PapyrusLabelHelper.offsetFromRelativeCoordinate(tmpTarget, cachedBounds, getReferencePoint());
-
try {
TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(view);
org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.TransactionHelper.run(domain, new Runnable() {
@@ -218,14 +219,13 @@ public class PapyrusLabelLocator extends AbstractLocator {
}
});
} catch (Exception e) {
- System.out.println(e.toString());
+ Activator.log.debug(e.toString());
}
-
} else
- // At the creation or It's a d&d move or // If it a move the connnection
+ // At the creation or It's a d&d move or // If it a move the connection
if (cachedBounds.height == 0 || !offset.equals(cachedOffset) || !segment.equals(cachedSegment)) {
- // System.out.println("Creation/open: " + ((WrappingLabel) target).getText() + " offSet: " + offset + " textAlign: " + textAlignment);
location = PapyrusLabelHelper.relativeCoordinateFromOffset(target, getReferencePoint(), offset);
+ // cachedString = ((WrappingLabel) target).getText();
} else {
// nothing change, in refresh case
location = cachedBounds.getLocation();
@@ -234,6 +234,7 @@ public class PapyrusLabelLocator extends AbstractLocator {
// Set the location
target.setLocation(location);
+ // cache actual values
cachedString = ((WrappingLabel) target).getText();
cachedBounds = target.getBounds();
cachedOffset = offset;
@@ -329,5 +330,15 @@ public class PapyrusLabelLocator extends AbstractLocator {
this.view = view;
}
+ /**
+ * Sets the margin.
+ *
+ * @param margin
+ * the margin to set
+ */
+ public void setMargin(Point margin) {
+ this.margin = margin;
+ }
+
} \ No newline at end of file

Back to the top