Author: vyemialyanchyk
Date: 2009-11-02 10:00:19 -0500 (Mon, 02 Nov 2009)
New Revision: 18388
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterFanAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterManhattanAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/fanConnectionRouter.png
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/manhattanConnectionRouter.png
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramActionBarContributor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ActionMenu.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5124 - fixed
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -63,4 +63,6 @@
public static String Diagram_incorrect_state;
public static String Diagram_no_items_or_incorrect_state;
public static String OpenDiagramActionDelegate_could_not_load_configuration;
+ public static String ConnectionRouterFanAction_select_fan_connection_router;
+ public static String
ConnectionRouterManhattanAction_select_manhattan_connection_router;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-11-02
15:00:19 UTC (rev 18388)
@@ -39,3 +39,5 @@
Diagram_incorrect_state=incorrect Hibernate Console Configuration state.
Diagram_no_items_or_incorrect_state=no items or incorrect Hibernate Console Configuration
state.
OpenDiagramActionDelegate_could_not_load_configuration=Could not load configuration
+ConnectionRouterFanAction_select_fan_connection_router=Select fan connection router
+ConnectionRouterManhattanAction_select_manhattan_connection_router=Select manhattan
connection router
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramActionBarContributor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramActionBarContributor.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramActionBarContributor.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -33,6 +33,8 @@
import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ActionMenu;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.AutoLayoutAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.ConnectionRouterFanAction;
+import
org.jboss.tools.hibernate.ui.diagram.editors.actions.ConnectionRouterManhattanAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ToggleAssociationAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ToggleClassMappingAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ToggleConnectionsAction;
@@ -75,14 +77,14 @@
DiagramBaseRetargetAction diagramAction2 = new DiagramBaseRetargetAction(
ToggleShapeExpandStateAction.ACTION_ID,
DiagramViewerMessages.ToggleShapeExpandStateAction_toggle_expand_state,
- DiagramViewerMessages.ToggleShapeExpandStateAction_toggle_expand_state,
+ DiagramViewerMessages.ToggleShapeExpandStateAction_toggle_expand_state_tooltip,
ToggleShapeExpandStateAction.img);
addRetargetAction(diagramAction2);
//
diagramAction = new DiagramBaseRetargetAction(
ToggleShapeVisibleStateAction.ACTION_ID,
DiagramViewerMessages.ToggleShapeVisibleStateAction_toggle_visible_state,
- DiagramViewerMessages.ToggleShapeVisibleStateAction_toggle_visible_state,
+ DiagramViewerMessages.ToggleShapeVisibleStateAction_toggle_visible_state_tooltip,
ToggleShapeVisibleStateAction.img);
addRetargetAction(diagramAction);
//
@@ -114,11 +116,28 @@
ToggleForeignKeyConstraintAction.img, IAction.AS_CHECK_BOX);
addRetargetAction(diagramAction);
//
- act = new Action[4];
+ diagramAction = new DiagramBaseRetargetAction(
+ ConnectionRouterManhattanAction.ACTION_ID,
+ DiagramViewerMessages.ConnectionRouterManhattanAction_select_manhattan_connection_router,
+ DiagramViewerMessages.ConnectionRouterManhattanAction_select_manhattan_connection_router,
+ ConnectionRouterManhattanAction.img, IAction.AS_RADIO_BUTTON);
+ addRetargetAction(diagramAction);
+ //
+ diagramAction = new DiagramBaseRetargetAction(
+ ConnectionRouterFanAction.ACTION_ID,
+ DiagramViewerMessages.ConnectionRouterFanAction_select_fan_connection_router,
+ DiagramViewerMessages.ConnectionRouterFanAction_select_fan_connection_router,
+ ConnectionRouterFanAction.img, IAction.AS_RADIO_BUTTON);
+ addRetargetAction(diagramAction);
+ //
+ act = new Action[7];
act[0] = (Action)getAction(TogglePropertyMappingAction.ACTION_ID);
act[1] = (Action)getAction(ToggleClassMappingAction.ACTION_ID);
act[2] = (Action)getAction(ToggleAssociationAction.ACTION_ID);
act[3] = (Action)getAction(ToggleForeignKeyConstraintAction.ACTION_ID);
+ act[4] = null;
+ act[5] = (Action)getAction(ConnectionRouterManhattanAction.ACTION_ID);
+ act[6] = (Action)getAction(ConnectionRouterFanAction.ACTION_ID);
diagramAction1.setMenuCreator(new ActionMenu(act));
//
addRetargetAction(new UndoRetargetAction());
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -66,6 +66,8 @@
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ActionMenu;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.AutoLayoutAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.CollapseAllAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.ConnectionRouterFanAction;
+import
org.jboss.tools.hibernate.ui.diagram.editors.actions.ConnectionRouterManhattanAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ExpandAllAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ExportImageAction;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.LexicalSortingAction;
@@ -82,6 +84,7 @@
import
org.jboss.tools.hibernate.ui.diagram.editors.actions.ToggleShapeVisibleStateAction;
import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.DiagramEditPart;
import org.jboss.tools.hibernate.ui.diagram.editors.parts.GEFRootEditPart;
import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPart;
import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPartFactory;
@@ -246,6 +249,12 @@
action = new TogglePropertyMappingAction(this);
registry.registerAction(action);
+ action = new ConnectionRouterFanAction(this);
+ registry.registerAction(action);
+
+ action = new ConnectionRouterManhattanAction(this);
+ registry.registerAction(action);
+
action = new ToggleShapeExpandStateAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
@@ -269,11 +278,14 @@
action = new LexicalSortingAction(this, null);
registry.registerAction(action);
- Action[] act = new Action[4];
+ Action[] act = new Action[7];
act[0] = (Action)registry.getAction(TogglePropertyMappingAction.ACTION_ID);
act[1] = (Action)registry.getAction(ToggleClassMappingAction.ACTION_ID);
act[2] = (Action)registry.getAction(ToggleAssociationAction.ACTION_ID);
act[3] = (Action)registry.getAction(ToggleForeignKeyConstraintAction.ACTION_ID);
+ act[4] = null;
+ act[5] = (Action)registry.getAction(ConnectionRouterManhattanAction.ACTION_ID);
+ act[6] = (Action)registry.getAction(ConnectionRouterFanAction.ACTION_ID);
actionToggleConnections.setMenuCreator(new ActionMenu(act));
}
@@ -606,4 +618,18 @@
public IAction getLexicalSortingAction() {
return getActionRegistry().getAction(LexicalSortingAction.ACTION_ID);
}
+
+ public GEFRootEditPart getRootEditPart() {
+ return gefRootEditPart;
+ }
+
+ public DiagramEditPart getDiagramEditPart() {
+ if (!gefRootEditPart.getChildren().isEmpty()) {
+ Object obj = gefRootEditPart.getChildren().get(0);
+ if (obj instanceof DiagramEditPart) {
+ return (DiagramEditPart)obj;
+ }
+ }
+ return null;
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ActionMenu.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ActionMenu.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ActionMenu.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -13,6 +13,7 @@
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
@@ -73,7 +74,12 @@
}
protected void addActionToMenu(Menu parent, Action action) {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
+ if (action == null) {
+ Separator item = new Separator();
+ item.fill(parent, -1);
+ } else {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
}
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterFanAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterFanAction.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterFanAction.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.DiagramEditPart;
+
+/**
+ * Connect figures with direct line connections
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ConnectionRouterFanAction extends DiagramBaseAction {
+
+ public static final String ACTION_ID = "connectionRouterFanId"; //$NON-NLS-1$
+ public static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class,
"icons/fanConnectionRouter.png"); //$NON-NLS-1$
+
+ public ConnectionRouterFanAction(DiagramViewer editor) {
+ super(editor, AS_RADIO_BUTTON);
+ setId(ACTION_ID);
+ setText(DiagramViewerMessages.ConnectionRouterFanAction_select_fan_connection_router);
+ setToolTipText(DiagramViewerMessages.ConnectionRouterFanAction_select_fan_connection_router);
+ setImageDescriptor(img);
+ }
+
+ public void run() {
+ DiagramEditPart diagramEditPart = getDiagramViewer().getDiagramEditPart();
+ if (diagramEditPart != null) {
+ diagramEditPart.setupFanConnectionRouter();
+ }
+ }
+
+ public boolean isChecked() {
+ DiagramEditPart diagramEditPart = getDiagramViewer().getDiagramEditPart();
+ if (diagramEditPart != null) {
+ return diagramEditPart.isFanConnectionRouter();
+ }
+ return super.isChecked();
+ }
+}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterManhattanAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterManhattanAction.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ConnectionRouterManhattanAction.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.DiagramEditPart;
+
+/**
+ * Connect figures with bend line connections
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ConnectionRouterManhattanAction extends DiagramBaseAction {
+
+ public static final String ACTION_ID = "connectionRouterManhattanId";
//$NON-NLS-1$
+ public static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class,
"icons/manhattanConnectionRouter.png"); //$NON-NLS-1$
+
+ public ConnectionRouterManhattanAction(DiagramViewer editor) {
+ super(editor, AS_RADIO_BUTTON);
+ setId(ACTION_ID);
+ setText(DiagramViewerMessages.ConnectionRouterManhattanAction_select_manhattan_connection_router);
+ setToolTipText(DiagramViewerMessages.ConnectionRouterManhattanAction_select_manhattan_connection_router);
+ setImageDescriptor(img);
+ }
+
+ public void run() {
+ DiagramEditPart diagramEditPart = getDiagramViewer().getDiagramEditPart();
+ if (diagramEditPart != null) {
+ diagramEditPart.setupManhattanConnectionRouter();
+ }
+ }
+
+ public boolean isChecked() {
+ DiagramEditPart diagramEditPart = getDiagramViewer().getDiagramEditPart();
+ if (diagramEditPart != null) {
+ return diagramEditPart.isManhattanConnectionRouter();
+ }
+ return super.isChecked();
+ }
+}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/fanConnectionRouter.png
===================================================================
(Binary files differ)
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/fanConnectionRouter.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/manhattanConnectionRouter.png
===================================================================
(Binary files differ)
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/icons/manhattanConnectionRouter.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -96,6 +96,7 @@
protected double zoom = 1.0;
protected float fontHeight = 8.5f;
protected boolean deepIntoSort = false;
+ protected boolean flagManhattanConnectionRouter = true;
//
private boolean fileLoadSuccessfull = false;
// this is workaround to load diagram state in the case if Console Config loaded later
@@ -506,6 +507,7 @@
gridEnabled = getPrValue(memento, "gridEnabled", false); //$NON-NLS-1$
zoom = getPrValue(memento, "zoom", 1.0); //$NON-NLS-1$
deepIntoSort = getPrValue(memento, "deepIntoSort", false); //$NON-NLS-1$
+ flagManhattanConnectionRouter = getPrValue(memento,
"flagManhattanConnectionRouter", true); //$NON-NLS-1$
connectionsVisibilityAssociation = getPrValue(memento,
"connectionsVisibilityAssociation", true); //$NON-NLS-1$
connectionsVisibilityClassMapping = getPrValue(memento,
"connectionsVisibilityClassMapping", true); //$NON-NLS-1$
connectionsVisibilityForeignKeyConstraint = getPrValue(memento,
"connectionsVisibilityForeignKeyConstraint", true); //$NON-NLS-1$
@@ -532,6 +534,7 @@
gridEnabled = getPrValue(properties, "gridEnabled", false); //$NON-NLS-1$
zoom = getPrValue(properties, "zoom", 1.0); //$NON-NLS-1$
deepIntoSort = getPrValue(properties, "deepIntoSort", false); //$NON-NLS-1$
+ flagManhattanConnectionRouter = getPrValue(properties,
"flagManhattanConnectionRouter", true); //$NON-NLS-1$
connectionsVisibilityAssociation = getPrValue(properties,
"connectionsVisibilityAssociation", true); //$NON-NLS-1$
connectionsVisibilityClassMapping = getPrValue(properties,
"connectionsVisibilityClassMapping", true); //$NON-NLS-1$
connectionsVisibilityForeignKeyConstraint = getPrValue(properties,
"connectionsVisibilityForeignKeyConstraint", true); //$NON-NLS-1$
@@ -551,6 +554,7 @@
setPrValue(memento, "gridEnabled", "" + gridEnabled); //$NON-NLS-1$
//$NON-NLS-2$
setPrValue(memento, "zoom", "" + zoom); //$NON-NLS-1$
//$NON-NLS-2$
setPrValue(memento, "deepIntoSort", "" + deepIntoSort);
//$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "flagManhattanConnectionRouter", "" +
flagManhattanConnectionRouter); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(memento, "connectionsVisibilityAssociation", "" +
connectionsVisibilityAssociation); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(memento, "connectionsVisibilityClassMapping", "" +
connectionsVisibilityClassMapping); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(memento, "connectionsVisibilityForeignKeyConstraint", ""
+ connectionsVisibilityForeignKeyConstraint); //$NON-NLS-1$ //$NON-NLS-2$
@@ -570,6 +574,7 @@
setPrValue(properties, "gridEnabled", "" + gridEnabled);
//$NON-NLS-1$ //$NON-NLS-2$
setPrValue(properties, "zoom", "" + zoom); //$NON-NLS-1$
//$NON-NLS-2$
setPrValue(properties, "deepIntoSort", "" + deepIntoSort);
//$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "flagManhattanConnectionRouter", "" +
flagManhattanConnectionRouter); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(properties, "connectionsVisibilityAssociation", "" +
connectionsVisibilityAssociation); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(properties, "connectionsVisibilityClassMapping", "" +
connectionsVisibilityClassMapping); //$NON-NLS-1$ //$NON-NLS-2$
setPrValue(properties, "connectionsVisibilityForeignKeyConstraint",
"" + connectionsVisibilityForeignKeyConstraint); //$NON-NLS-1$ //$NON-NLS-2$
@@ -944,4 +949,20 @@
elements.get(entry.getKey()).setExpanded(entry.getValue());
}
}
+
+ public boolean isManhattanConnectionRouter() {
+ return flagManhattanConnectionRouter;
+ }
+
+ public boolean isFanConnectionRouter() {
+ return !flagManhattanConnectionRouter;
+ }
+
+ public void setupManhattanConnectionRouter() {
+ flagManhattanConnectionRouter = true;
+ }
+
+ public void setupFanConnectionRouter() {
+ flagManhattanConnectionRouter = false;
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -36,7 +36,7 @@
/**
* @author some modifications from Vitali
*/
-class ConnectionEditPart extends AbstractConnectionEditPart
+public class ConnectionEditPart extends AbstractConnectionEditPart
implements PropertyChangeListener, EditPartListener {
public void activate() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-11-02
13:19:08 UTC (rev 18387)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-11-02
15:00:19 UTC (rev 18388)
@@ -16,6 +16,7 @@
import java.util.List;
import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.FanRouter;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayout;
@@ -44,7 +45,7 @@
/**
* @author some modifications from Vitali
*/
-class DiagramEditPart extends OrmEditPart {
+public class DiagramEditPart extends OrmEditPart {
protected void createEditPolicies() {
installEditPolicy(EditPolicy.LAYOUT_ROLE,
@@ -55,16 +56,40 @@
Figure f = new FreeformLayer();
f.setBorder(new MarginBorder(3));
f.setLayoutManager(new FreeformLayout());
+ if (isManhattanConnectionRouter()) {
+ getOrmDiagram().setupFanConnectionRouter();
+ setupManhattanConnectionRouter();
+ } else {
+ getOrmDiagram().setupManhattanConnectionRouter();
+ setupFanConnectionRouter();
+ }
+ return f;
+ }
- ConnectionLayer connLayer = (ConnectionLayer)
getLayer(LayerConstants.CONNECTION_LAYER);
- connLayer.setConnectionRouter(new ManhattanConnectionRouter());
- //connLayer.setConnectionRouter(new ShortestPathConnectionRouter());
- //connLayer.setConnectionRouter(new BendpointConnectionRouter());
- //connLayer.setConnectionRouter(new FanRouter());
+ public void setupManhattanConnectionRouter() {
+ if (!isManhattanConnectionRouter()) {
+ ConnectionLayer connLayer = (ConnectionLayer)
getLayer(LayerConstants.CONNECTION_LAYER);
+ connLayer.setConnectionRouter(new ManhattanConnectionRouter());
+ getOrmDiagram().setupManhattanConnectionRouter();
+ }
+ }
- return f;
+ public void setupFanConnectionRouter() {
+ if (!isFanConnectionRouter()) {
+ ConnectionLayer connLayer = (ConnectionLayer)
getLayer(LayerConstants.CONNECTION_LAYER);
+ connLayer.setConnectionRouter(new FanRouter());
+ getOrmDiagram().setupFanConnectionRouter();
+ }
}
+ public boolean isManhattanConnectionRouter() {
+ return getOrmDiagram().isManhattanConnectionRouter();
+ }
+
+ public boolean isFanConnectionRouter() {
+ return getOrmDiagram().isFanConnectionRouter();
+ }
+
/**
* @see java.beans.PropertyChangeListener#propertyChange(PropertyChangeEvent)
*/