Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratischenko2014-11-07 19:30:11 +0000
committeratischenko2014-11-07 19:54:58 +0000
commit94b7c5cb09e659469d967dcfba07d8f048dc0bfc (patch)
tree602b62bb978ed9d4bc8c18d89783c5ae74165cd2 /plugins/uml
parent9206abd34dcdc0f28de66dab5d5cd0bf0edc179e (diff)
downloadorg.eclipse.papyrus-94b7c5cb09e659469d967dcfba07d8f048dc0bfc.tar.gz
org.eclipse.papyrus-94b7c5cb09e659469d967dcfba07d8f048dc0bfc.tar.xz
org.eclipse.papyrus-94b7c5cb09e659469d967dcfba07d8f048dc0bfc.zip
Bug 448948 - [Activity Diagram] Output pin arrow does not disappear
after it has been connected to an input pin Fixed: - NPE - refreshing the arrow state for existing activity diagram when it opened in the editor. cherry-picked from master: I133f9459e07bfd9c8d90dc125d680a6934ef9413 Signed-off-by: atischenko <ticher777@gmail.com>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/AbstractPinEditPart.java54
1 files changed, 38 insertions, 16 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/AbstractPinEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/AbstractPinEditPart.java
index b53aee018c2..3c6590568c2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/AbstractPinEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/part/AbstractPinEditPart.java
@@ -47,7 +47,7 @@ public abstract class AbstractPinEditPart extends BorderedBorderItemEditPart {
}
/**
- * undraw the pin arrow
+ * Undraw the pin arrow
*
* @param connection
* <code>ConnectionEditPart</code> being added as child.
@@ -61,12 +61,24 @@ public abstract class AbstractPinEditPart extends BorderedBorderItemEditPart {
}
/**
+ * Draw the pin arrow
+ *
+ */
+ private void drawPinArrow() {
+ PinFigure pinFigure = getPrimaryShape();
+ AbstractPointListShape arrow = pinFigure.getOptionalArrowFigure();
+ int side = getBorderItemLocator().getCurrentSideOfParent();
+ int direction = ActivityFigureDrawer.getOppositeDirection(side);
+ ActivityFigureDrawer.redrawPinArrow(arrow, getMapMode(), getSize(), direction);
+ }
+
+ /**
* redraw the pin arrow if current connection doesnt set
*
* @param connection
* <code>ConnectionEditPart</code> being added as child.
*/
- private void redrawPinArrow(List connections) {
+ private void redrawPinArrow(List<?> connections) {
this.redrawPinArrow(null, connections);
}
@@ -76,21 +88,32 @@ public abstract class AbstractPinEditPart extends BorderedBorderItemEditPart {
* @param connection
* <code>ConnectionEditPart</code> being added as child.
*/
- private void redrawPinArrow(ConnectionEditPart connection, List connections) {
- boolean hasActivityEdge = false;
- for (Object connect : connections) {
- if (!connection.equals(connect) && isConnectionSupported((ConnectionEditPart) connect)) {
- hasActivityEdge = true;
- break;
+ private void redrawPinArrow(ConnectionEditPart connection, List<?> connections) {
+ if (isHasActiveEdge(connection, connections)) {
+ undrawPinArrow(connection);
+ return;
+ }
+ drawPinArrow();
+ }
+
+ private boolean isHasActiveEdge(ConnectionEditPart connection, List<?> connections) {
+ if (connection == null && (connections == null || connections.isEmpty())) {
+ return false;
+ }
+ if (connection == null) {
+ for (Object next : connections) {
+ if (isConnectionSupported((ConnectionEditPart) next)) {
+ return true;
+ }
}
+ return false;
}
- if (!hasActivityEdge) {
- PinFigure pinFigure = getPrimaryShape();
- AbstractPointListShape arrow = pinFigure.getOptionalArrowFigure();
- int side = getBorderItemLocator().getCurrentSideOfParent();
- int direction = ActivityFigureDrawer.getOppositeDirection(side);
- ActivityFigureDrawer.redrawPinArrow(arrow, getMapMode(), getSize(), direction);
+ for (Object next : connections) {
+ if (!connection.equals(next) && isConnectionSupported((ConnectionEditPart) next)) {
+ return true;
+ }
}
+ return false;
}
/**
@@ -141,7 +164,6 @@ public abstract class AbstractPinEditPart extends BorderedBorderItemEditPart {
public void activate() {
super.activate();
// redraw the pin arrow if no connection
- redrawPinArrow(getTargetConnections());
- redrawPinArrow(getSourceConnections());
+ redrawPinArrow(getTargetConnections().isEmpty() ? getSourceConnections() : getTargetConnections());
}
}

Back to the top