summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorujhelyiz2011-06-28 16:57:59 (EDT)
committer Fabian Steeg2011-06-28 16:57:59 (EDT)
commiteb557a047ef59560247a7c165716c31df65bb9ca (patch)
tree1393488f76c1c4261251fa277c3b9622a43f2eba
parent447ced521070874982e2ab1c3b88eb2caaacd0a4 (diff)
downloadorg.eclipse.gef4-eb557a047ef59560247a7c165716c31df65bb9ca.zip
org.eclipse.gef4-eb557a047ef59560247a7c165716c31df65bb9ca.tar.gz
org.eclipse.gef4-eb557a047ef59560247a7c165716c31df65bb9ca.tar.bz2
Created label provider for setting connection routers
-rw-r--r--org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/IConnectionRouterStyleProvider.java26
-rw-r--r--org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java7
2 files changed, 33 insertions, 0 deletions
diff --git a/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/IConnectionRouterStyleProvider.java b/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/IConnectionRouterStyleProvider.java
new file mode 100644
index 0000000..cc2b5f4
--- /dev/null
+++ b/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/IConnectionRouterStyleProvider.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.zest.core.widgets.Graph;
+
+/**
+ * Extension connection style provider that supports setting connection routers.
+ *
+ * @author Zoltan Ujhelyi
+ * @since 2.0
+ */
+public interface IConnectionRouterStyleProvider {
+
+ /**
+ * Calculates the connection router of the single relation.
+ *
+ * @param rel
+ * @return the calculated connection router
+ * @see Graph#setDefaultConnectionRouter(ConnectionRouter) to set the
+ * default router
+ */
+ public ConnectionRouter getConnectionRouter(Object rel);
+}
diff --git a/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java b/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java
index 177974b..ad7011e 100644
--- a/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java
+++ b/org.eclipse.zest.jface/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.zest.core.viewers.internal;
+import org.eclipse.draw2d.ConnectionRouter;
import org.eclipse.draw2d.IFigure;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IColorProvider;
@@ -17,6 +18,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.zest.core.viewers.IConnectionRouterStyleProvider;
import org.eclipse.zest.core.viewers.IConnectionStyleProvider;
import org.eclipse.zest.core.viewers.IEntityConnectionStyleProvider;
import org.eclipse.zest.core.viewers.IEntityStyleProvider;
@@ -91,6 +93,11 @@ public class GraphItemStyler {
} else if (labelProvider instanceof IConnectionStyleProvider) {
styleConnection(conn, (IConnectionStyleProvider) labelProvider);
}
+ if (labelProvider instanceof IConnectionRouterStyleProvider) {
+ ConnectionRouter router = ((IConnectionRouterStyleProvider) labelProvider)
+ .getConnectionRouter(conn.getExternalConnection());
+ conn.setRouter(router);
+ }
int swt = getLineStyleForZestStyle(conn.getConnectionStyle());
conn.setLineStyle(swt);
if (labelProvider instanceof ISelfStyleProvider) {