Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbblajer2007-05-04 14:08:42 +0000
committerbblajer2007-05-04 14:08:42 +0000
commit1d4aaa9d22fb35ec031b01a8e5cd66fef00c0f30 (patch)
tree66005af4d85ba613aecd99858b632b0d9d892432 /plugins/org.eclipse.gmf.runtime.lite
parentf4e4ebc01c8403aeff0f19fbb9b611e4caa56540 (diff)
downloadorg.eclipse.gmf-tooling-1d4aaa9d22fb35ec031b01a8e5cd66fef00c0f30.tar.gz
org.eclipse.gmf-tooling-1d4aaa9d22fb35ec031b01a8e5cd66fef00c0f30.tar.xz
org.eclipse.gmf-tooling-1d4aaa9d22fb35ec031b01a8e5cd66fef00c0f30.zip
1. Links to links;
2. Exception from TreeEditPartViewer (in the outline) while closing the diagram editor (because unregister is not called, only deactivate) fixed; 3. instead of rerouting a link to an end that does not support it, remove the link
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite')
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java7
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/update/canonical/OwnedLinksNotationModelRefresher.java30
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/figures/ConnectionConnectionAnchor.java34
3 files changed, 65 insertions, 6 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
index df4db0f5f..2db5736db 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
@@ -96,8 +96,11 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
super.deactivate();
}
- protected final TransactionalUpdateManager getTransactionalUpdateManager() {
- return (TransactionalUpdateManager) getViewer().getProperty(TransactionalUpdateManager.class.getName());
+ protected TransactionalUpdateManager getTransactionalUpdateManager() {
+ if (getParent() instanceof BaseTreeEditPart) {
+ return ((BaseTreeEditPart) getParent()).getTransactionalUpdateManager();
+ }
+ return null;
}
protected List getModelChildren() {
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/update/canonical/OwnedLinksNotationModelRefresher.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/update/canonical/OwnedLinksNotationModelRefresher.java
index 5b47a6213..73df6995d 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/update/canonical/OwnedLinksNotationModelRefresher.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/update/canonical/OwnedLinksNotationModelRefresher.java
@@ -99,12 +99,20 @@ public abstract class OwnedLinksNotationModelRefresher extends AbstractNotationM
command.appendIfCanExecute(getCreateNotationalElementCommand(next));
} else {
View newSourceView = myViewService.findView(next.getSource());
- if (changedSource && newSourceView != null) {
- command.appendIfCanExecute(new ReconnectNotationalEdgeSourceCommand(currentEdge, newSourceView));
+ if (changedSource) {
+ if (newSourceView != null && isValidLinkSource(newSourceView, next)) {
+ command.appendIfCanExecute(new ReconnectNotationalEdgeSourceCommand(currentEdge, newSourceView));
+ } else {
+ command.appendIfCanExecute(new RemoveNotationalEdgeCommand(currentEdge.getDiagram(), currentEdge));
+ }
}
View newTargetView = myViewService.findView(next.getDestination());
- if (changedTarget && newTargetView != null) {
- command.appendIfCanExecute(new ReconnectNotationalEdgeTargetCommand(currentEdge, newTargetView));
+ if (changedTarget) {
+ if (newTargetView != null && isValidLinkTarget(newTargetView, next)) {
+ command.appendIfCanExecute(new ReconnectNotationalEdgeTargetCommand(currentEdge, newTargetView));
+ } else {
+ command.appendIfCanExecute(new RemoveNotationalEdgeCommand(currentEdge.getDiagram(), currentEdge));
+ }
}
}
}
@@ -126,4 +134,18 @@ public abstract class OwnedLinksNotationModelRefresher extends AbstractNotationM
protected abstract List/*<LinkDescriptor>*/ getSemanticChildLinks();
protected abstract List/*<Edge>*/ getNotationalChildLinks();
+
+ /**
+ * Returns whether the given view can be source of the given link.
+ */
+ protected boolean isValidLinkSource(View sourceCandidate, LinkDescriptor linkDescriptor) {
+ return true;
+ }
+
+ /**
+ * Returns whether the given view can be source of the given link.
+ */
+ protected boolean isValidLinkTarget(View targetCandidate, LinkDescriptor linkDescriptor) {
+ return true;
+ }
}
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/figures/ConnectionConnectionAnchor.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/figures/ConnectionConnectionAnchor.java
new file mode 100644
index 000000000..e37df34ae
--- /dev/null
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/figures/ConnectionConnectionAnchor.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * bblajer - initial API and implementation
+ */
+package org.eclipse.gmf.runtime.lite.figures;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+
+public class ConnectionConnectionAnchor extends ChopboxAnchor {
+ public ConnectionConnectionAnchor(Connection figure) {
+ super(figure);
+ }
+
+ @Override
+ protected Rectangle getBox() {
+ PointList points = ((Connection) getOwner()).getPoints();
+ if (points == null || points.size() == 0) {
+ return super.getBox();
+ }
+ return new Rectangle(points.getMidpoint(), new Dimension(1,1));
+ }
+}

Back to the top