summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2010-12-02 18:21:02 (EST)
committer Fabian Steeg2010-12-02 18:21:02 (EST)
commit97fc1147c6e57071cf3ca258374619ac65bdf13a (patch)
treef6891f19552db25b90447ce486e7f4e4778df114
downloadorg.eclipse.gef4-97fc1147c6e57071cf3ca258374619ac65bdf13a.zip
org.eclipse.gef4-97fc1147c6e57071cf3ca258374619ac65bdf13a.tar.gz
org.eclipse.gef4-97fc1147c6e57071cf3ca258374619ac65bdf13a.tar.bz2
Initial Zest 2.0 commit
-rw-r--r--org.eclipse.zest.core/.classpath11
-rw-r--r--org.eclipse.zest.core/.cvsignore1
-rw-r--r--org.eclipse.zest.core/.gitignore1
-rw-r--r--org.eclipse.zest.core/.project34
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.history8
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.index5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.history16
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.index11
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.history10
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.index7
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.history17
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.index14
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.history7
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.index4
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.history14
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.index11
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.history8
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.index5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.history10
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.index7
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.history25
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.index22
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.history10
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.index7
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.history10
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.index7
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.history5
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.index2
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.history4
-rw-r--r--org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.index1
-rw-r--r--org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.history3
-rw-r--r--org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.index6
-rw-r--r--org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.history3
-rw-r--r--org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.index4
-rw-r--r--org.eclipse.zest.core/.settings/.api_filters51
-rw-r--r--org.eclipse.zest.core/.settings/org.eclipse.jdt.core.prefs313
-rw-r--r--org.eclipse.zest.core/.settings/org.eclipse.jdt.ui.prefs53
-rw-r--r--org.eclipse.zest.core/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--org.eclipse.zest.core/.settings/org.eclipse.pde.api.tools.prefs86
-rw-r--r--org.eclipse.zest.core/.settings/org.eclipse.pde.prefs13
-rw-r--r--org.eclipse.zest.core/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.zest.core/about.html27
-rw-r--r--org.eclipse.zest.core/about.ini11
-rw-r--r--org.eclipse.zest.core/about.mappings6
-rw-r--r--org.eclipse.zest.core/about.properties23
-rw-r--r--org.eclipse.zest.core/build.properties20
-rw-r--r--org.eclipse.zest.core/currentTasks.txt0
-rw-r--r--org.eclipse.zest.core/license.txt88
-rw-r--r--org.eclipse.zest.core/modeling32.pngbin0 -> 2414 bytes
-rw-r--r--org.eclipse.zest.core/plugin.properties12
-rw-r--r--org.eclipse.zest.core/plugin.xml5
-rw-r--r--org.eclipse.zest.core/src/icons/home.gifbin0 -> 1034 bytes
-rw-r--r--org.eclipse.zest.core/src/icons/tree_hanging.gifbin0 -> 853 bytes
-rw-r--r--org.eclipse.zest.core/src/icons/tree_hanging_inverse.gifbin0 -> 853 bytes
-rw-r--r--org.eclipse.zest.core/src/icons/tree_normal.gifbin0 -> 860 bytes
-rw-r--r--org.eclipse.zest.core/src/icons/tree_normal_inverse.gifbin0 -> 860 bytes
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractStructuredGraphViewer.java801
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractZoomableViewer.java43
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/EntityConnectionData.java61
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/GraphViewer.java380
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleBezierExtension.java76
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleProvider.java79
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleBezierExtension.java84
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleProvider.java86
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityStyleProvider.java131
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IFigureProvider.java25
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphContentProvider.java58
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityContentProvider.java32
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityRelationshipContentProvider.java39
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/INestedContentProvider.java43
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ISelfStyleProvider.java32
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IZoomableWorkbenchPart.java28
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomContributionViewItem.java247
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomListener.java27
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomManager.java611
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/AbstractStylingModelFactory.java430
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java279
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityFactory.java229
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityRelationshipFactory.java152
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelFactory.java181
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/IStylingGraphModelFactory.java172
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/SharedMessages.java32
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/CGraphNode.java51
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DAGExpandCollapseManager.java300
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DefaultSubgraph.java380
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FigureSubgraph.java195
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FisheyeListener.java61
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java1217
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java739
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphContainer.java947
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphItem.java117
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphNode.java769
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/IContainer.java93
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalLayoutContext.java540
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalNodeLayout.java329
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/LayoutFilter.java20
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/PrunedSuccessorsSubgraph.java272
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/SubgraphFactory.java25
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/ZestStyles.java137
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/CGraphNode.java76
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/LabelSubgraph.java68
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/TriangleSubgraph.java227
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AligningBendpointLocator.java236
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AspectRatioFreeformLayer.java224
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java255
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ContainerFigure.java18
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ExpandGraphLabel.java296
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/GraphLabel.java282
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/LoopAnchor.java40
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/PolylineArcConnection.java260
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/RevealListener.java26
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/RoundedChopboxAnchor.java88
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/XYScaledGraphics.java870
-rw-r--r--org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ZestRootLayer.java212
-rw-r--r--org.eclipse.zest.layouts/.classpath11
-rw-r--r--org.eclipse.zest.layouts/.cvsignore1
-rw-r--r--org.eclipse.zest.layouts/.project34
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/11/45/refactorings.history4
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/11/45/refactorings.index1
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/6/24/refactorings.history5
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/6/24/refactorings.index2
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/8/31/refactorings.history5
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2006/8/31/refactorings.index2
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/4/14/refactorings.history4
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/4/14/refactorings.index1
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/7/27/refactorings.history5
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/7/27/refactorings.index2
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/8/33/refactorings.history7
-rw-r--r--org.eclipse.zest.layouts/.refactorings/2007/8/33/refactorings.index4
-rw-r--r--org.eclipse.zest.layouts/.settings/org.eclipse.jdt.core.prefs313
-rw-r--r--org.eclipse.zest.layouts/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--org.eclipse.zest.layouts/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--org.eclipse.zest.layouts/.settings/org.eclipse.pde.api.tools.prefs86
-rw-r--r--org.eclipse.zest.layouts/.settings/org.eclipse.pde.prefs13
-rw-r--r--org.eclipse.zest.layouts/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.zest.layouts/about.html27
-rw-r--r--org.eclipse.zest.layouts/build.properties8
-rw-r--r--org.eclipse.zest.layouts/license.txt88
-rw-r--r--org.eclipse.zest.layouts/plugin.properties12
-rw-r--r--org.eclipse.zest.layouts/plugin.xml5
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/LayoutAlgorithm.java50
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/AlgorithmHelper.java205
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/BoxLayoutAlgorithm.java48
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/CompositeLayoutAlgorithm.java35
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/DirectedGraphLayoutAlgorithm.java132
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/GridLayoutAlgorithm.java222
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/HorizontalShiftAlgorithm.java103
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/RadialLayoutAlgorithm.java101
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpaceTreeLayoutAlgorithm.java1204
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/SpringLayoutAlgorithm.java776
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/TreeLayoutAlgorithm.java178
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/algorithms/TreeLayoutObserver.java552
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/dataStructures/DisplayIndependentDimension.java35
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/dataStructures/DisplayIndependentPoint.java84
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/dataStructures/DisplayIndependentRectangle.java55
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/ConnectionLayout.java48
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/ContextListener.java74
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/EntityLayout.java106
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/ExpandCollapseManager.java63
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/GraphStructureListener.java119
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/LayoutContext.java229
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/LayoutListener.java98
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/NodeLayout.java91
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/PruningListener.java51
-rw-r--r--org.eclipse.zest.layouts/src/org/eclipse/zest/layouts/interfaces/SubgraphLayout.java99
-rw-r--r--org.eclipse.zest.tests/.classpath11
-rw-r--r--org.eclipse.zest.tests/.cvsignore1
-rw-r--r--org.eclipse.zest.tests/.project28
-rw-r--r--org.eclipse.zest.tests/.refactorings/2007/8/35/refactorings.history15
-rw-r--r--org.eclipse.zest.tests/.refactorings/2007/8/35/refactorings.index12
-rw-r--r--org.eclipse.zest.tests/.refactorings/2009/3/12/refactorings.history3
-rw-r--r--org.eclipse.zest.tests/.refactorings/2009/3/12/refactorings.index5
-rw-r--r--org.eclipse.zest.tests/.refactorings/2009/3/13/refactorings.history4
-rw-r--r--org.eclipse.zest.tests/.refactorings/2009/3/13/refactorings.index1
-rw-r--r--org.eclipse.zest.tests/.refactorings/2010/12/49/refactorings.history3
-rw-r--r--org.eclipse.zest.tests/.refactorings/2010/12/49/refactorings.index2
-rw-r--r--org.eclipse.zest.tests/.settings/org.eclipse.jdt.core.prefs308
-rw-r--r--org.eclipse.zest.tests/.settings/org.eclipse.jdt.ui.prefs59
-rw-r--r--org.eclipse.zest.tests/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--org.eclipse.zest.tests/.settings/org.eclipse.pde.prefs12
-rw-r--r--org.eclipse.zest.tests/META-INF/MANIFEST.MF19
-rw-r--r--org.eclipse.zest.tests/about.html27
-rw-r--r--org.eclipse.zest.tests/build.properties18
-rw-r--r--org.eclipse.zest.tests/ibull.jpgbin0 -> 36409 bytes
-rw-r--r--org.eclipse.zest.tests/icons/nest.gifbin0 -> 972 bytes
-rw-r--r--org.eclipse.zest.tests/icons/sample.gifbin0 -> 983 bytes
-rw-r--r--org.eclipse.zest.tests/icons/static.gifbin0 -> 958 bytes
-rw-r--r--org.eclipse.zest.tests/icons/timeline.gifbin0 -> 887 bytes
-rw-r--r--org.eclipse.zest.tests/icons/zest.gifbin0 -> 968 bytes
-rw-r--r--org.eclipse.zest.tests/icons/zest1.jpgbin0 -> 5079 bytes
-rw-r--r--org.eclipse.zest.tests/icons/zest2.gifbin0 -> 955 bytes
-rw-r--r--org.eclipse.zest.tests/icons/zest_128x128.jpgbin0 -> 6854 bytes
-rw-r--r--org.eclipse.zest.tests/icons/zest_large.jpgbin0 -> 31249 bytes
-rw-r--r--org.eclipse.zest.tests/license.txt88
-rw-r--r--org.eclipse.zest.tests/plugin.properties12
-rw-r--r--org.eclipse.zest.tests/plugin.xml4
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/GraphSelectionTests.java140
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet1.java135
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet2.java118
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet3.java136
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet4.java133
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet5.java141
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet6.java147
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/GraphJFaceSnippet7.java183
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/jface/SimpleGraph.sgf29
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/AnimationSnippet.java68
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/CustomLayout.java69
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet1.java59
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet10.java77
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet11.java66
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet12.java161
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet13.java178
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet2.java72
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet3.java78
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet4.java109
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet5.java146
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet6.java76
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet7.java71
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet8.java113
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/GraphSnippet9.java54
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/HelloWorld.java53
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/NestedGraphSnippet.java140
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/PaintSnippet.java115
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/ZoomSnippet.java169
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/class_obj.gifbin0 -> 586 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/swt/package_obj.gifbin0 -> 227 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/CompartmentFigure.java39
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/UMLClassFigure.java42
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/UMLExample.java138
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/class_obj.gifbin0 -> 194 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/field_private_obj.gifbin0 -> 109 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/eclipse/zest/tests/uml/methpub_obj.gifbin0 -> 121 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/ContainerResizeGraphSnippet.java172
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/ContainersGraphSnippet.java86
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/CustomFigureGraphSnippet.java163
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/CustomLayout.java67
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/DAGExample.java139
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/FilterGraphSnippet.java115
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/FisheyeGraphSnippet.java76
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/RadialLayoutExample.java44
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/SimpleGraphSnippet.java59
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/SpaceTreeBuilding.java120
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/SpaceTreeExample.java189
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/SpringLayoutExample.java62
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/SpringLayoutProgress.java245
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/TreeLayoutExample.java146
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/class_obj.gifbin0 -> 586 bytes
-rw-r--r--org.eclipse.zest.tests/src/org/mati/zest/examples/package_obj.gifbin0 -> 227 bytes
-rw-r--r--org.eclipse.zest.tests/test.xml57
-rw-r--r--org.eclipse.zest.tests/zx.pngbin0 -> 9971 bytes
-rw-r--r--org.eclipse.zest.tests/zxsnow.pngbin0 -> 14819 bytes
285 files changed, 25916 insertions, 0 deletions
diff --git a/org.eclipse.zest.core/.classpath b/org.eclipse.zest.core/.classpath
new file mode 100644
index 0000000..6425d71
--- /dev/null
+++ b/org.eclipse.zest.core/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4">
+ <accessrules>
+ <accessrule kind="discouraged" pattern="**/System/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.zest.core/.cvsignore b/org.eclipse.zest.core/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/org.eclipse.zest.core/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/org.eclipse.zest.core/.gitignore b/org.eclipse.zest.core/.gitignore
new file mode 100644
index 0000000..c5e82d7
--- /dev/null
+++ b/org.eclipse.zest.core/.gitignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/org.eclipse.zest.core/.project b/org.eclipse.zest.core/.project
new file mode 100644
index 0000000..322fffc
--- /dev/null
+++ b/org.eclipse.zest.core/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.zest.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.history
new file mode 100644
index 0000000..a1ef365
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.gefx.StyledPolylineConnection.getDashStyle()' to 'getDashPattern'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.gefx.StyledPolylineConnection.getDashStyle()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.gefx.StyledPolylineConnection.getDashPattern()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getDashStyle'" flags="589826" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.gefx{StyledPolylineConnection.java[StyledPolylineConnection~getDashStyle" name="getDashPattern" references="true" stamp="1160173625750" version="1.0"/>
+<refactoring comment="Rename field 'CONNECTION_DASH_DOT' in 'org.eclipse.mylar.zest.core.ZestStyles' to 'CONNECTIONS_DASH_DOT'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTION_DASH_DOT'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_DASH_DOT'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'CONNECTION_DASH_DOT'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java[ZestStyles^CONNECTION_DASH_DOT" name="CONNECTIONS_DASH_DOT" references="true" setter="false" stamp="1160175242421" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.index
new file mode 100644
index 0000000..50c5672
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/40/refactorings.index
@@ -0,0 +1,2 @@
+1160173625750 Rename method 'getDashStyle'
+1160175242421 Rename field 'CONNECTION_DASH_DOT'
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.history
new file mode 100644
index 0000000..d228bd6
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.history
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.gefx.MidBendpointLocator.translate()' to 'calculatePosition'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.gefx.MidBendpointLocator.translate()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.gefx.MidBendpointLocator.calculatePosition()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'translate'" flags="589826" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.gefx{MidBendpointLocator.java[MidBendpointLocator~translate" name="calculatePosition" references="true" stamp="1160515795140" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.gefx.MidBendpointLocator' to 'AligningBendpointLocator'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.gefx.MidBendpointLocator'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.gefx.AligningBendpointLocator'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'MidBendpointLocator'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.gefx{MidBendpointLocator.java[MidBendpointLocator" matchStrategy="1" name="AligningBendpointLocator" qualified="true" references="true" similarDeclarations="false" stamp="1160515908859" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'CONNECTIONS_ALIGN_MIDDLE' in 'org.eclipse.mylar.zest.core.ZestStyles' to 'CONNECTIONS_VALIGN_MIDDLE'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_ALIGN_MIDDLE'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_VALIGN_MIDDLE'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'CONNECTIONS_ALIGN_MIDDLE'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java[ZestStyles^CONNECTIONS_ALIGN_MIDDLE" name="CONNECTIONS_VALIGN_MIDDLE" references="true" setter="false" stamp="1160517412593" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'CONNECTIONS_ALIGN_TOP' in 'org.eclipse.mylar.zest.core.ZestStyles' to 'CONNECTIONS_VALIGN_TOP'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_ALIGN_TOP'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_VALIGN_TOP'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'CONNECTIONS_ALIGN_TOP'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java[ZestStyles^CONNECTIONS_ALIGN_TOP" name="CONNECTIONS_VALIGN_TOP" references="true" setter="false" stamp="1160517422765" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'CONNECTIONS_ALIGN_BOTTOM' in 'org.eclipse.mylar.zest.core.ZestStyles' to 'CONNECTIONS_VALIGN_BOTTOM'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_ALIGN_BOTTOM'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestStyles.CONNECTIONS_VALIGN_BOTTOM'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'CONNECTIONS_ALIGN_BOTTOM'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java[ZestStyles^CONNECTIONS_ALIGN_BOTTOM" name="CONNECTIONS_VALIGN_BOTTOM" references="true" setter="false" stamp="1160517433906" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.index
new file mode 100644
index 0000000..361c751
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/41/refactorings.index
@@ -0,0 +1,5 @@
+1160515795140 Rename method 'translate'
+1160517433906 Rename field 'CONNECTIONS_ALIGN_BOTTOM'
+1160517422765 Rename field 'CONNECTIONS_ALIGN_TOP'
+1160517412593 Rename field 'CONNECTIONS_ALIGN_MIDDLE'
+1160515908859 Rename type 'MidBendpointLocator'
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.history
new file mode 100644
index 0000000..612fe6b
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.history
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.GraphOverviewerImple' to 'GraphOverviewerImpl'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.GraphOverviewerImple'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.GraphOverviewerImpl'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphOverviewerImple'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview{GraphOverviewerImple.java[GraphOverviewerImple" matchStrategy="1" name="GraphOverviewerImpl" qualified="true" references="true" similarDeclarations="false" stamp="1161206392421" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.GraphEditPartFactory' to 'OverviewGraphEditPartFactory'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.GraphEditPartFactory'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.OverviewGraphEditPartFactory'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphEditPartFactory'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{GraphEditPartFactory.java[GraphEditPartFactory" matchStrategy="1" name="OverviewGraphEditPartFactory" qualified="true" references="true" similarDeclarations="false" stamp="1161207732859" textual="false" version="1.0"/>
+<refactoring comment="Rename local variable 'heigthScale' in 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateToParent(...)' to 'heightScale'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateToParent(Translatable).heigthScale'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateToParent(Translatable).heightScale'&#13;&#10;- Update references to refactored element" description="Rename local variable 'heigthScale'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java" name="heightScale" references="true" selection="4167 11" stamp="1161280619984" version="1.0"/>
+<refactoring comment="Rename local variable 'heigthScale' in 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateFromParent(...)' to 'heightScale'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateFromParent(Translatable).heigthScale'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.translateFromParent(Translatable).heightScale'&#13;&#10;- Update references to refactored element" description="Rename local variable 'heigthScale'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java" name="heightScale" references="true" selection="1921 11" stamp="1161280645906" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)' to 'setViewableSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setLogicalSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~setLogicalSize~I~I" name="setViewableSize" references="true" stamp="1161286000140" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)' to 'setViewableS'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableS(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setLogicalSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~setLogicalSize~QDimension;" name="setViewableS" references="true" stamp="1161286010625" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableS(...)' to 'setViewableSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableS(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setViewableS'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~setViewableS~QDimension;" name="setViewableSize" references="true" stamp="1161286018484" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getLogicalSize()' to 'getViewableSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getLogicalSize()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getViewableSize()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getLogicalSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~getLogicalSize" name="getViewableSize" references="true" stamp="1161286031531" version="1.0"/>
+
+
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)' to 'setLogicalSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setViewableSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~setViewableSize~QDimension;" name="setLogicalSize" references="true" stamp="1161286152703" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getViewableSize()' to 'getLogicalSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getViewableSize()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.getLogicalSize()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getViewableSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~getViewableSize" name="getLogicalSize" references="true" stamp="1161286164859" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)' to 'setLogicalSize'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setViewableSize(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.ScalingContainerFigure.setLogicalSize(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setViewableSize'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{ScalingContainerFigure.java[ScalingContainerFigure~setViewableSize~I~I" name="setLogicalSize" references="true" stamp="1161286177890" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.index
new file mode 100644
index 0000000..a40bc96
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/42/refactorings.index
@@ -0,0 +1,11 @@
+1161206392421 Rename type 'GraphOverviewerImple'
+1161286177890 Rename method 'setViewableSize'
+1161286164859 Rename method 'getViewableSize'
+1161286152703 Rename method 'setViewableSize'
+1161286031531 Rename method 'getLogicalSize'
+1161286018484 Rename method 'setViewableS'
+1161286010625 Rename method 'setLogicalSize'
+1161286000140 Rename method 'setLogicalSize'
+1161280645906 Rename local variable 'heigthScale'
+1161280619984 Rename local variable 'heigthScale'
+1161207732859 Rename type 'GraphEditPartFactory'
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.history
new file mode 100644
index 0000000..819069e
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename field 'feedBackFigure' in 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.tools.OverviewRectangleTool' to 'focusFigure'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.tools.OverviewRectangleTool.feedBackFigure'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.tools.OverviewRectangleTool.focusFigure'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'feedBackFigure'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.parts.tools{OverviewRectangleTool.java[OverviewRectangleTool^feedBackFigure" name="focusFigure" references="true" setter="false" stamp="1161619971718" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.OverViewNodeEditPart' to 'OverviewNodeEditPart'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.OverViewNodeEditPart'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts.OverviewNodeEditPart'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'OverViewNodeEditPart'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.overview.parts{OverViewNodeEditPart.java[OverViewNodeEditPart" matchStrategy="1" name="OverviewNodeEditPart" qualified="false" references="true" similarDeclarations="false" stamp="1161807534287" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.index
new file mode 100644
index 0000000..1105d16
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/43/refactorings.index
@@ -0,0 +1,2 @@
+1161619971718 Rename field 'feedBackFigure'
+1161807534287 Rename type 'OverViewNodeEditPart'
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.history
new file mode 100644
index 0000000..1343d08
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.history
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.treegraphviewer.Animation' to 'oldAnimation'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.Animation'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.oldAnimation'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'Animation'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{Animation.java[Animation" matchStrategy="1" name="oldAnimation" qualified="false" references="true" similarDeclarations="false" stamp="1162255688500" textual="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.oldAnimation.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{oldAnimation.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1162267222890" subPackages="false" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.internal.treegraphviewer'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.internal.treegraphviewer'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.TreeLayout.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer" element1="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{TreeLayout.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{TreeLayout.java&#9;true&#9;true&#9;TreeLayout2.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1162270820812" units="1" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.TreeLayout2.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{TreeLayout2.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1162271080078" subPackages="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DagViewer' to 'DagViewerImpl'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DagViewer'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DagViewerImpl'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'DagViewer'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{DagViewer.java[DagViewer" matchStrategy="1" name="DagViewerImpl" qualified="false" references="true" similarDeclarations="false" stamp="1162271144843" textual="false" version="1.0"/>
+<refactoring comment="Rename compilation unit 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DavModelFactory.java' to 'DagModelFactory.java'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DavModelFactory.java'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.treegraphviewer.DagModelFactory.java'" description="Rename compilation unit 'DavModelFactory.java'" flags="2" id="org.eclipse.jdt.ui.rename.compilationunit" input="/src&lt;org.eclipse.mylar.zest.core.internal.treegraphviewer{DavModelFactory.java" name="DagModelFactory.java" references="false" stamp="1162271428765" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.TreeGraphViewer.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.core.viewers" element1="/src&lt;org.eclipse.mylar.zest.core.viewers{TreeGraphViewer.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.core.viewers{TreeGraphViewer.java&#9;true&#9;true&#9;DAGViewer.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1162280390187" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.index
new file mode 100644
index 0000000..654433e
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/10/44/refactorings.index
@@ -0,0 +1,7 @@
+1162255688500 Rename type 'Animation'
+1162267222890 Delete element
+1162270820812 Copy compilation unit
+1162271080078 Delete element
+1162271144843 Rename type 'DagViewer'
+1162271428765 Rename compilation unit 'DavModelFactory.java'
+1162280390187 Copy compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.history
new file mode 100644
index 0000000..904a872
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Convert member type 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityFactory.EntityConnectionData' in 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityFactory' to top level type&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityFactory.EntityConnectionData'&#13;&#10;- Field name: 'factory'&#13;&#10;- Declare field 'final'" description="Convert member type 'EntityConnectionData' to top level" field="false" fieldName="factory" final="true" flags="786438" id="org.eclipse.jdt.ui.move.inner" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{GraphModelEntityFactory.java[GraphModelEntityFactory[EntityConnectionData" mandatory="false" possible="false" stamp="1163096643078" version="1.0"/>
+<refactoring abstract="0" comment="Pull up members from 'org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory' to 'org.eclipse.mylar.zest.core.internal.graphmodel.IStylingGraphModelFactory'&#13;&#10;- Original elements:&#13;&#10; org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory.setConnectionStyle(...)&#13;&#10; org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory.getConnectionStyle()&#13;&#10; org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory.setNodeStyle(...)&#13;&#10; org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory.getNodeStyle()&#13;&#10;- Destination type: 'org.eclipse.mylar.zest.core.internal.graphmodel.IStylingGraphModelFactory'&#13;&#10;- Use super type where possible" delete="0" description="Pull up members to 'IStylingGraphModelFactory'" element1="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{AbstractStylingModelFactory.java[AbstractStylingModelFactory~setConnectionStyle~I" element2="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{AbstractStylingModelFactory.java[AbstractStylingModelFactory~getConnectionStyle" element3="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{AbstractStylingModelFactory.java[AbstractStylingModelFactory~setNodeStyle~I" element4="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{AbstractStylingModelFactory.java[AbstractStylingModelFactory~getNodeStyle" flags="589830" id="org.eclipse.jdt.ui.pull.up" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{IStylingGraphModelFactory.java[IStylingGraphModelFactory" instanceof="false" pull="4" replace="true" stamp="1163104277281" stubs="true" version="1.0"/>
+</session> \ No newline at end of file
diff --git a/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.index
new file mode 100644
index 0000000..002b10b
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/11/45/refactorings.index
@@ -0,0 +1,2 @@
+1163096643078 Convert member type 'EntityConnectionData' to top level
+1163104277281 Pull up members to 'IStylingGraphModelFactory'
diff --git a/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.history
new file mode 100644
index 0000000..4573db7
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers'&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.EntityConnectionData.java'&#10;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylar.zest.core.viewers" element1="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{EntityConnectionData.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1163800610389" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.index
new file mode 100644
index 0000000..3eabed4
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/11/46/refactorings.index
@@ -0,0 +1 @@
+1163800610389 Move compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.history
new file mode 100644
index 0000000..b2f37c7
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.pde.visualization.dependency'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.pde.visualization.dependency'&#13;&#10;- Original element: 'about.html'" description="Copy file" destination="=org.eclipse.pde.visualization.dependency" element1="about.html" files="1" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="about.html&#9;true&#9;false" policy="org.eclipse.jdt.ui.copyResources" stamp="1166080804593" units="0" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.pde.visualization.dependency'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.pde.visualization.dependency'&#13;&#10;- Original element: 'license.txt'" description="Copy file" destination="=org.eclipse.pde.visualization.dependency" element1="license.txt" files="1" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="license.txt&#9;true&#9;false" policy="org.eclipse.jdt.ui.copyResources" stamp="1166080853812" units="0" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.index
new file mode 100644
index 0000000..bcf88a0
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/12/50/refactorings.index
@@ -0,0 +1,2 @@
+1166080804593 Copy file
+1166080853812 Copy file
diff --git a/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.history
new file mode 100644
index 0000000..1a89f74
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.history
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.CorePlugin' to 'ZestPlugin'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.CorePlugin'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestPlugin'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'CorePlugin'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core{CorePlugin.java[CorePlugin" matchStrategy="1" name="ZestPlugin" qualified="true" references="true" similarDeclarations="false" stamp="1153421644296" textual="true" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getAdjacentEntityHighlight(...)' to 'getAdjacentEntityHighlightColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getAdjacentEntityHighlight(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getAdjacentEntityHighlightColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getAdjacentEntityHighlight'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getAdjacentEntityHighlight~QObject;" name="getAdjacentEntityHighlightColor" references="true" stamp="1153433302140" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorder(...)' to 'getBorderColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorder(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getBorder'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getBorder~QObject;" name="getBorderColor" references="true" stamp="1153433330781" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderHighlight(...)' to 'getBorderHighlightColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderHighlight(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderHighlightColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getBorderHighlight'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getBorderHighlight~QObject;" name="getBorderHighlightColor" references="true" stamp="1153433340968" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderUnhighlight(...)' to 'getBorderUnhighlightColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderUnhighlight(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getBorderUnhighlightColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getBorderUnhighlight'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getBorderUnhighlight~QObject;" name="getBorderUnhighlightColor" references="true" stamp="1153433350562" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getHighlight(...)' to 'getHighlightColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getHighlight(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getHighlightColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getHighlight'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getHighlight~QObject;" name="getHighlightColor" references="true" stamp="1153433359984" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getUnhighlight(...)' to 'getUnhighlightColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getUnhighlight(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IEntityStyleProvider.getUnhighlightColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getUnhighlight'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IEntityStyleProvider.java[IEntityStyleProvider~getUnhighlight~QObject;" name="getUnhighlightColor" references="true" stamp="1153433372156" version="1.0"/>
+<refactoring comment="Rename field 'EDGE_WEIGHT_1' in 'org.eclipse.mylar.zest.core.IZestColorConstants' to 'EDGE_WEIGHT_01'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_1'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_01'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'EDGE_WEIGHT_1'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{IZestColorConstants.java[IZestColorConstants^EDGE_WEIGHT_1" name="EDGE_WEIGHT_01" references="true" setter="false" stamp="1153435094593" textual="true" version="1.0"/>
+<refactoring comment="Rename field 'EDGE_WEIGHT_2' in 'org.eclipse.mylar.zest.core.IZestColorConstants' to 'EDGE_WEIGHT_02'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_2'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_02'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'EDGE_WEIGHT_2'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{IZestColorConstants.java[IZestColorConstants^EDGE_WEIGHT_2" name="EDGE_WEIGHT_02" references="true" setter="false" stamp="1153435108921" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'EDGE_WEIGHT_3' in 'org.eclipse.mylar.zest.core.IZestColorConstants' to 'EDGE_WEIGHT_03'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_3'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.IZestColorConstants.EDGE_WEIGHT_03'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'EDGE_WEIGHT_3'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{IZestColorConstants.java[IZestColorConstants^EDGE_WEIGHT_3" name="EDGE_WEIGHT_03" references="true" setter="false" stamp="1153435118000" textual="false" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelConnection.setLineColor(...)' to 'changeLineColor'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelConnection.setLineColor(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelConnection.changeLineColor(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'setLineColor'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{GraphModelConnection.java[GraphModelConnection~setLineColor~QColor;" name="changeLineColor" references="true" stamp="1153437169921" version="1.0"/>
+<refactoring comment="Rename field 'HIGHLIGHT_ADJACENT_NODES' in 'org.eclipse.mylar.zest.core.ZestStyles' to 'NODES_HIGHLIGHT_ADJACENT'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.HIGHLIGHT_ADJACENT_NODES'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.ZestStyles.NODES_HIGHLIGHT_ADJACENT'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'HIGHLIGHT_ADJACENT_NODES'" flags="589830" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java[ZestStyles^HIGHLIGHT_ADJACENT_NODES" name="NODES_HIGHLIGHT_ADJACENT" references="true" setter="false" stamp="1153505271218" textual="false" version="1.0"/>
+<refactoring comment="Rename package 'org.eclipse.mylar.zest.core.messages' to 'org.eclipse.mylar.zest.core.internal.messages'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.messages'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.internal.messages'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename package 'org.eclipse.mylar.zest.core.messages'" flags="589830" hierarchical="false" id="org.eclipse.jdt.ui.rename.package" input="/src&lt;org.eclipse.mylar.zest.core.messages" name="org.eclipse.mylar.zest.core.internal.messages" qualified="true" references="true" stamp="1153507285671" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.messages.ZestErrors' to 'ZestErrorMessages'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.messages.ZestErrors'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.messages.ZestErrorMessages'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'ZestErrors'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.messages{ZestErrors.java[ZestErrors" matchStrategy="1" name="ZestErrorMessages" qualified="true" references="true" similarDeclarations="false" stamp="1153507355875" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.index
new file mode 100644
index 0000000..e0ca927
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/7/29/refactorings.index
@@ -0,0 +1,14 @@
+1153421644296 Rename type 'CorePlugin'
+1153507355875 Rename type 'ZestErrors'
+1153507285671 Rename package 'org.eclipse.mylar.zest.core.messages'
+1153505271218 Rename field 'HIGHLIGHT_ADJACENT_NODES'
+1153437169921 Rename method 'setLineColor'
+1153435118000 Rename field 'EDGE_WEIGHT_3'
+1153435108921 Rename field 'EDGE_WEIGHT_2'
+1153435094593 Rename field 'EDGE_WEIGHT_1'
+1153433372156 Rename method 'getUnhighlight'
+1153433359984 Rename method 'getHighlight'
+1153433350562 Rename method 'getBorderUnhighlight'
+1153433340968 Rename method 'getBorderHighlight'
+1153433330781 Rename method 'getBorder'
+1153433302140 Rename method 'getAdjacentEntityHighlight'
diff --git a/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.history
new file mode 100644
index 0000000..3b3b52a
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename package 'org.eclipse.mylar.zest.core.internal.messages' to 'org.eclipse.mylar.zest.core.messages'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.internal.messages'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.messages'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename package 'org.eclipse.mylar.zest.core.internal.messages'" flags="589830" hierarchical="false" id="org.eclipse.jdt.ui.rename.package" input="/src&lt;org.eclipse.mylar.zest.core.internal.messages" name="org.eclipse.mylar.zest.core.messages" qualified="true" references="true" stamp="1153954304731" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.index
new file mode 100644
index 0000000..fcc1ce2
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/7/30/refactorings.index
@@ -0,0 +1 @@
+1153954304731 Rename package 'org.eclipse.mylar.zest.core.internal.messages'
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.history
new file mode 100644
index 0000000..0f8f278
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.history
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Convert local variable 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.createFigureForModel().label' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.createFigureForModel()' to field&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.createFigureForModel().label'&#13;&#10;- Field name: 'label'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'" description="Convert local variable 'label' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphNodeEditPart.java" name="label" selection="3638 0" stamp="1154453403140" static="false" version="1.0" visibility="2"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedSidePane' to 'NestedPane'&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedSidePane'&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane'&#10;- Update references to refactored element&#10;- Update textual occurrences in comments and strings" description="Rename type 'NestedSidePane'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel.nested{NestedSidePane.java[NestedSidePane" matchStrategy="1" name="NestedPane" qualified="false" references="true" similarDeclarations="false" stamp="1154535190155" textual="false" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.getScreenBounds()' to 'getAbsoluteBounds'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.getScreenBounds()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphNodeEditPart.getAbsoluteBounds()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getScreenBounds'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphNodeEditPart.java[NestedGraphNodeEditPart~getScreenBounds" name="getAbsoluteBounds" references="true" stamp="1154543083953" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.getMaxBounds()' to 'getMainArea'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.getMaxBounds()'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.getMainArea()'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="true" description="Rename method 'getMaxBounds'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java[NestedGraphEditPart~getMaxBounds" name="getMainArea" references="true" stamp="1154543427984" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.index
new file mode 100644
index 0000000..c357a20
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/31/refactorings.index
@@ -0,0 +1,4 @@
+1154453403140 Convert local variable 'label' to field
+1154543427984 Rename method 'getMaxBounds'
+1154543083953 Rename method 'getScreenBounds'
+1154535190155 Rename type 'NestedSidePane'
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.history
new file mode 100644
index 0000000..14c37e6
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.history
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename local variable 'parts' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.FigureKeyFrameAnimator.addFigures(...)' to 'figuresArray'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.FigureKeyFrameAnimator.addFigures(IFigure[], Rectangle[]).parts'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.FigureKeyFrameAnimator.addFigures(IFigure[], Rectangle[]).figuresArray'&#13;&#10;- Update references to refactored element" description="Rename local variable 'parts'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="figuresArray" references="true" selection="3171 5" stamp="1155075332471" version="1.0"/>
+<refactoring comment="Rename local variable 'startBounds' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.zoomOutOnNode(...)' to 'endBounds'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.zoomOutOnNode(NestedGraphNodeEditPart).startBounds'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.zoomOutOnNode(NestedGraphNodeEditPart).endBounds'&#13;&#10;- Update references to refactored element" description="Rename local variable 'startBounds'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="endBounds" references="true" selection="12639 11" stamp="1155078188939" version="1.0"/>
+<refactoring comment="Rename local variable 'f1' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(...)' to 'supply'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).f1'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).supply'&#13;&#10;- Update references to refactored element" description="Rename local variable 'f1'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="supply" references="true" selection="9289 2" stamp="1155140298593" version="1.0"/>
+<refactoring comment="Rename local variable 'f2' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(...)' to 'main'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).f2'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).main'&#13;&#10;- Update references to refactored element" description="Rename local variable 'f2'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="main" references="true" selection="9348 2" stamp="1155140303921" version="1.0"/>
+<refactoring comment="Rename local variable 'f3' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(...)' to 'client'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).f3'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createFigure().new AbstractLayout() {...}.layout(IFigure).client'&#13;&#10;- Update references to refactored element" description="Rename local variable 'f3'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="client" references="true" selection="9401 2" stamp="1155140313718" version="1.0"/>
+<refactoring comment="Rename local variable 'nodes' in 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.createProxies(...)' to 'connections'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.createProxies(List, boolean).nodes'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.createProxies(List, boolean).connections'&#13;&#10;- Update references to refactored element" description="Rename local variable 'nodes'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel.nested{NestedPane.java" name="connections" references="true" selection="2641 5" stamp="1155232653609" version="1.0"/>
+<refactoring comment="Rename local variable 'nestedFigure' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel()' to 'figure'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel().nestedFigure'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel().figure'&#13;&#10;- Update references to refactored element" description="Rename local variable 'nestedFigure'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NonNestedGraphProxyNodeEditPart.java" name="figure" references="true" selection="2328 12" stamp="1155233823812" version="1.0"/>
+<refactoring comment="Rename field 'proxyConnections' in 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode' to 'sourceConnection'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode.proxyConnections'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode.sourceConnection'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'proxyConnections'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel.nested{NonNestedProxyNode.java[NonNestedProxyNode^proxyConnections" name="sourceConnection" references="true" setter="false" stamp="1155234397109" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'sourceConnection' in 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode' to 'sourceConnections'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode.sourceConnection'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NonNestedProxyNode.sourceConnections'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'sourceConnection'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel.nested{NonNestedProxyNode.java[NonNestedProxyNode^sourceConnection" name="sourceConnections" references="true" setter="false" stamp="1155234404437" textual="false" version="1.0"/>
+<refactoring comment="Rename local variable 'editParts' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(...)' to 'nodeEditParts'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(NestedGraphModelNode).editParts'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(NestedGraphModelNode).nodeEditParts'&#13;&#10;- Update references to refactored element" description="Rename local variable 'editParts'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="nodeEditParts" references="true" selection="17974 9" stamp="1155318207281" version="1.0"/>
+<refactoring comment="Rename local variable 'source' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(...)' to 'pn'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(NestedGraphModelNode).source'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxies(NestedGraphModelNode).pn'&#13;&#10;- Update references to refactored element" description="Rename local variable 'source'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="pn" references="true" selection="18154 6" stamp="1155319513906" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.index
new file mode 100644
index 0000000..3898dcc
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/32/refactorings.index
@@ -0,0 +1,11 @@
+1155075332471 Rename local variable 'parts'
+1155319513906 Rename local variable 'source'
+1155318207281 Rename local variable 'editParts'
+1155234404437 Rename field 'sourceConnection'
+1155234397109 Rename field 'proxyConnections'
+1155233823812 Rename local variable 'nestedFigure'
+1155232653609 Rename local variable 'nodes'
+1155140313718 Rename local variable 'f3'
+1155140303921 Rename local variable 'f2'
+1155140298593 Rename local variable 'f1'
+1155078188939 Rename local variable 'startBounds'
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.history
new file mode 100644
index 0000000..5e5c4e7
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.history
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Convert local variable 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel().label' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel()' to field&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NonNestedGraphProxyNodeEditPart.createFigureForModel().label'&#13;&#10;- Field name: 'label'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'" description="Convert local variable 'label' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NonNestedGraphProxyNodeEditPart.java" name="label" selection="2493 5" stamp="1155769686421" static="false" version="1.0" visibility="2"/>
+<refactoring comment="Rename local variable 'length' in 'org.eclipse.mylar.zest.core.internal.gefx.Bezier.reCompute()' to 'lengthSquared'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.gefx.Bezier.reCompute().length'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.gefx.Bezier.reCompute().lengthSquared'&#13;&#10;- Update references to refactored element" description="Rename local variable 'length'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.gefx{Bezier.java" name="lengthSquared" references="true" selection="4012 6" stamp="1155764020578" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphmodel.AbstractBaseModelFactory' to 'AbstractStylingModelFactory'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.AbstractBaseModelFactory'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.AbstractStylingModelFactory'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'AbstractBaseModelFactory'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{AbstractBaseModelFactory.java[AbstractBaseModelFactory" matchStrategy="1" name="AbstractStylingModelFactory" qualified="true" references="true" similarDeclarations="false" stamp="1155754482125" textual="false" version="1.0"/>
+<refactoring comment="Rename local variable 'proxyEditPart' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxyNodeEditPart(...)' to 'baseEditPart'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxyNodeEditPart(NonNestedProxyNode, GraphicalEditPart).proxyEditPart'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphEditPart.createProxyNodeEditPart(NonNestedProxyNode, GraphicalEditPart).baseEditPart'&#13;&#10;- Update references to refactored element" description="Rename local variable 'proxyEditPart'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphEditPart.java" name="baseEditPart" references="true" selection="22825 13" stamp="1155597874078" version="1.0"/>
+<refactoring comment="Rename local variable 'connectionsTo' in 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.refreshChildren()' to 'connections'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.refreshChildren().connectionsTo'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.nested.NestedPane.refreshChildren().connections'&#13;&#10;- Update references to refactored element" description="Rename local variable 'connectionsTo'" id="org.eclipse.jdt.ui.rename.local.variable" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel.nested{NestedPane.java" name="connections" references="true" selection="2821 13" stamp="1155579294062" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.index
new file mode 100644
index 0000000..d11ff8d
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/33/refactorings.index
@@ -0,0 +1,5 @@
+1155769686421 Convert local variable 'label' to field
+1155764020578 Rename local variable 'length'
+1155754482125 Rename type 'AbstractBaseModelFactory'
+1155597874078 Rename local variable 'proxyEditPart'
+1155579294062 Rename local variable 'connectionsTo'
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.history
new file mode 100644
index 0000000..e1329cc
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelConnection' to 'IGraphModelConnection'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelConnection'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.IGraphModelConnection'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphModelConnection'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{GraphModelConnection.java[GraphModelConnection" matchStrategy="1" name="IGraphModelConnection" qualified="true" references="true" similarDeclarations="false" stamp="1156527057765" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelNode' to 'IGraphModelNode'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelNode'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.IGraphModelNode'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphModelNode'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{GraphModelNode.java[GraphModelNode" matchStrategy="1" name="IGraphModelNode" qualified="true" references="true" similarDeclarations="false" stamp="1156527038046" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.index
new file mode 100644
index 0000000..c5ed431
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/8/34/refactorings.index
@@ -0,0 +1,2 @@
+1156527057765 Rename type 'GraphModelConnection'
+1156527038046 Rename type 'GraphModelNode'
diff --git a/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.history
new file mode 100644
index 0000000..957aea4
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.history
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityConnectionFactory' to 'GraphModelEntityRelationshipFactory'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityConnectionFactory'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.graphmodel.GraphModelEntityRelationshipFactory'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphModelEntityConnectionFactory'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphmodel{GraphModelEntityConnectionFactory.java[GraphModelEntityConnectionFactory" matchStrategy="1" name="GraphModelEntityRelationshipFactory" qualified="true" references="true" similarDeclarations="false" stamp="1157485906671" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.viewers.AbstractZommableGraphicalViewer' to 'AbstractZoomableGraphicalViewer'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.AbstractZommableGraphicalViewer'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.AbstractZoomableGraphicalViewer'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'AbstractZommableGraphicalViewer'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.viewers{AbstractZommableGraphicalViewer.java[AbstractZommableGraphicalViewer" matchStrategy="1" name="AbstractZoomableGraphicalViewer" qualified="true" references="true" similarDeclarations="false" stamp="1157572405250" textual="false" version="1.0"/>
+<refactoring comment="Rename compilation unit 'org.eclipse.mylar.zest.core.viewers.AbstractZoomableGraphicalViewer.java' to 'IZoomProvider.java'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.AbstractZoomableGraphicalViewer.java'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.IZoomProvider.java'" description="Rename compilation unit 'AbstractZoomableGraphicalViewer.java'" flags="589830" id="org.eclipse.jdt.ui.rename.compilationunit" input="/src&lt;org.eclipse.mylar.zest.core.viewers{AbstractZoomableGraphicalViewer.java" name="IZoomProvider.java" stamp="1157572669125" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.viewers.IZoomProvider' to 'AbstractZoomableViewer'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.IZoomProvider'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.AbstractZoomableViewer'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'IZoomProvider'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.viewers{IZoomProvider.java[IZoomProvider" matchStrategy="1" name="AbstractZoomableViewer" qualified="true" references="true" similarDeclarations="false" stamp="1157573084046" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.viewers.ZoomInViewAction' to 'ZoomInViewerAction'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.ZoomInViewAction'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.ZoomInViewerAction'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'ZoomInViewAction'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.viewers{ZoomInViewAction.java[ZoomInViewAction" matchStrategy="1" name="ZoomInViewerAction" qualified="true" references="true" similarDeclarations="false" stamp="1157573905750" textual="false" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.core.viewers.ZoomComboContributionViewItem' to 'ZoomContributionViewItem'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.ZoomComboContributionViewItem'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.viewers.ZoomContributionViewItem'&#13;&#10;- Update references to refactored element&#13;&#10;- Update fully qualified names in non-Java files&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'ZoomComboContributionViewItem'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.core.viewers{ZoomComboContributionViewItem.java[ZoomComboContributionViewItem" matchStrategy="1" name="ZoomContributionViewItem" qualified="true" references="true" similarDeclarations="false" stamp="1157659668281" textual="false" version="1.0"/>
+<refactoring comment="Rename field 'layerdPane' in 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphRootEditPart' to 'innerLayers'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphRootEditPart.layerdPane'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts.NestedGraphRootEditPart.innerLayers'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="true" description="Rename field 'layerdPane'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylar.zest.core.internal.nestedgraphviewer.parts{NestedGraphRootEditPart.java[NestedGraphRootEditPart^layerdPane" name="innerLayers" references="true" setter="false" stamp="1157668553687" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.index
new file mode 100644
index 0000000..83d3887
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/9/36/refactorings.index
@@ -0,0 +1,7 @@
+1157485906671 Rename type 'GraphModelEntityConnectionFactory'
+1157668553687 Rename field 'layerdPane'
+1157659668281 Rename type 'ZoomComboContributionViewItem'
+1157573905750 Rename type 'ZoomInViewAction'
+1157573084046 Rename type 'IZoomProvider'
+1157572669125 Rename compilation unit 'AbstractZoomableGraphicalViewer.java'
+1157572405250 Rename type 'AbstractZommableGraphicalViewer'
diff --git a/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.history b/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.history
new file mode 100644
index 0000000..56d7ade
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Convert member type 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.GraphNodeEditPart.LoopAnchor' in 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.GraphNodeEditPart' to top level type&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.internal.graphviewer.parts.GraphNodeEditPart.LoopAnchor'" description="Convert member type 'LoopAnchor' to top level" field="false" final="true" flags="786438" id="org.eclipse.jdt.ui.move.inner" input="/src&lt;org.eclipse.mylar.zest.core.internal.graphviewer.parts{GraphNodeEditPart.java[GraphNodeEditPart[LoopAnchor" mandatory="false" possible="true" stamp="1158255145718" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.index b/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.index
new file mode 100644
index 0000000..59de75b
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2006/9/37/refactorings.index
@@ -0,0 +1 @@
+1158255145718 Convert member type 'LoopAnchor' to top level
diff --git a/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.history
new file mode 100644
index 0000000..46d4e23
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.history
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphJFaceSnippet.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.snippets" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphJFaceSnippet.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.snippets{GraphJFaceSnippet.java&#9;true&#9;true&#9;GraphJFaceSnippet2.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1174608368218" units="1" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphJFaceSnippet2.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.snippets" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphJFaceSnippet2.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.snippets{GraphJFaceSnippet2.java&#9;true&#9;true&#9;GraphJFaceSnippet3.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1174608749725" units="1" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphJFaceSnippet3.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphJFaceSnippet3.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174608885911" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.widgets.IGraphNode.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.widgets{IGraphNode.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174677896390" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.widgets.IGraphConnection.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.widgets{IGraphConnection.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174680901703" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.viewers.internal.IGraphModelFactory.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.viewers.internal{IGraphModelFactory.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174681104750" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.widgets.IGraphItem.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.widgets{IGraphItem.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174682629968" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.widgets.IZestGraphDefaults.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core.widgets{IZestGraphDefaults.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174682975234" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestController.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core{ZestController.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174683215671" subPackages="false" version="1.0"/>
+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers.internal'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.viewers.internal'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestException.java'&#13;&#10;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylar.zest.core.viewers.internal" element1="/src&lt;org.eclipse.mylar.zest.core{ZestException.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1174683270546" units="1" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestException.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core{ZestException.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174683331703" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.IZestColorConstants.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core{IZestColorConstants.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174683374437" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.IZestImageConstants.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core{IZestImageConstants.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174683377359" subPackages="false" version="1.0"/>
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestColors.java'" description="Delete element" element1="/src&lt;org.eclipse.mylar.zest.core{ZestColors.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1174683380562" subPackages="false" version="1.0"/>
+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.widgets'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.core.widgets'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core.ZestStyles.java'&#13;&#10;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylar.zest.core.widgets" element1="/src&lt;org.eclipse.mylar.zest.core{ZestStyles.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1174683391468" units="1" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.snippets.GraphSnippet' to 'GraphSnippet1'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphSnippet'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.snippets.GraphSnippet1'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphSnippet'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet.java[GraphSnippet" matchStrategy="1" name="GraphSnippet1" qualified="false" references="true" similarDeclarations="false" stamp="1174685993781" textual="false" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphSnippet1.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.snippets" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet1.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet1.java&#9;true&#9;true&#9;GraphSnippet2.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1174686085546" units="1" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphSnippet2.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.snippets" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet2.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet2.java&#9;true&#9;true&#9;GraphSnippet3.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1174690783687" units="1" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.snippets.GraphSnippet3.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.snippets" element1="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet3.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.snippets{GraphSnippet3.java&#9;true&#9;true&#9;GraphSnippet4.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1174691672281" units="1" version="1.0"/>
+<refactoring comment="Rename package 'org.eclipse.mylar.zest.snippets' to 'org.eclipse.mylar.zest.examples'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.snippets'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename package 'org.eclipse.mylar.zest.snippets'" flags="589830" hierarchical="false" id="org.eclipse.jdt.ui.rename.package" input="/src&lt;org.eclipse.mylar.zest.snippets" name="org.eclipse.mylar.zest.examples" qualified="false" references="true" stamp="1174706783765" textual="false" version="1.0"/>
+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.uml'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.uml'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.GraphSnippet4.java'&#13;&#10;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylar.zest.examples.uml" element1="/src&lt;org.eclipse.mylar.zest.examples{GraphSnippet4.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1174707072046" units="1" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.examples.uml.GraphSnippet4' to 'UMLExample'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.uml.GraphSnippet4'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.examples.uml.UMLExample'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphSnippet4'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.examples.uml{GraphSnippet4.java[GraphSnippet4" matchStrategy="1" name="UMLExample" qualified="false" references="true" similarDeclarations="false" stamp="1174707391125" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.index
new file mode 100644
index 0000000..f65a678
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/3/12/refactorings.index
@@ -0,0 +1,22 @@
+1174608368218 Copy compilation unit
+1174608749725 Copy compilation unit
+1174608885911 Delete element
+1174677896390 Delete element
+1174680901703 Delete element
+1174681104750 Delete element
+1174682629968 Delete element
+1174682975234 Delete element
+1174683215671 Delete element
+1174683270546 Move compilation unit
+1174683331703 Delete element
+1174683374437 Delete element
+1174683377359 Delete element
+1174683380562 Delete element
+1174683391468 Move compilation unit
+1174685993781 Rename type 'GraphSnippet'
+1174686085546 Copy compilation unit
+1174690783687 Copy compilation unit
+1174691672281 Copy compilation unit
+1174706783765 Rename package 'org.eclipse.mylar.zest.snippets'
+1174707072046 Move compilation unit
+1174707391125 Rename type 'GraphSnippet4'
diff --git a/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.history
new file mode 100644
index 0000000..dbe39b9
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.history
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Move 2 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.jface'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.jface'&#13;&#10;- Original elements:&#13;&#10; org.eclipse.mylar.zest.examples.GraphJFaceSnippet2.java&#13;&#10; org.eclipse.mylar.zest.examples.GraphJFaceSnippet.java&#13;&#10;- Update references to refactored element" description="Move compilation units" destination="/src&lt;org.eclipse.mylar.zest.jface" element1="/src&lt;org.eclipse.mylar.zest.examples{GraphJFaceSnippet2.java" element2="/src&lt;org.eclipse.mylar.zest.examples{GraphJFaceSnippet.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1174936872156" units="2" version="1.0"/>
+<refactoring comment="Rename package 'org.eclipse.mylar.zest.jface' to 'org.eclipse.mylar.zest.examples.jface'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.jface'&#13;&#10;- Renamed element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.jface'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename package 'org.eclipse.mylar.zest.jface'" flags="589830" hierarchical="false" id="org.eclipse.jdt.ui.rename.package" input="/src&lt;org.eclipse.mylar.zest.jface" name="org.eclipse.mylar.zest.examples.jface" qualified="false" references="true" stamp="1174936888015" textual="false" version="1.0"/>
+<refactoring comment="Move 3 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original elements:&#13;&#10; org.eclipse.mylar.zest.examples.GraphSnippet1.java&#13;&#10; org.eclipse.mylar.zest.examples.GraphSnippet3.java&#13;&#10; org.eclipse.mylar.zest.examples.GraphSnippet2.java&#13;&#10;- Update references to refactored element" description="Move compilation units" destination="/src&lt;org.eclipse.mylar.zest.examples.swt" element1="/src&lt;org.eclipse.mylar.zest.examples{GraphSnippet1.java" element2="/src&lt;org.eclipse.mylar.zest.examples{GraphSnippet3.java" element3="/src&lt;org.eclipse.mylar.zest.examples{GraphSnippet2.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1174936900953" units="3" version="1.0"/>
+<refactoring comment="Convert member type 'org.eclipse.mylar.zest.examples.uml.UMLExample.CompartmentFigure' in 'org.eclipse.mylar.zest.examples.uml.UMLExample' to top level type&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.uml.UMLExample.CompartmentFigure'&#13;&#10;- Field name: 'example'&#13;&#10;- Declare field 'final'" description="Convert member type 'CompartmentFigure' to top level" field="false" fieldName="example" final="true" flags="786438" id="org.eclipse.jdt.ui.move.inner" input="/src&lt;org.eclipse.mylar.zest.examples.uml{UMLExample.java[UMLExample[CompartmentFigure" mandatory="false" possible="false" stamp="1174936959734" version="1.0"/>
+<refactoring comment="Convert member type 'org.eclipse.mylar.zest.examples.uml.UMLExample.UMLClassFigure' in 'org.eclipse.mylar.zest.examples.uml.UMLExample' to top level type&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.uml.UMLExample.UMLClassFigure'&#13;&#10;- Field name: 'example'&#13;&#10;- Declare field 'final'" description="Convert member type 'UMLClassFigure' to top level" field="false" fieldName="example" final="true" flags="786438" id="org.eclipse.jdt.ui.move.inner" input="/src&lt;org.eclipse.mylar.zest.examples.uml{UMLExample.java[UMLExample[UMLClassFigure" mandatory="false" possible="false" stamp="1174936970375" version="1.0"/>
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.examples.jface.GraphJFaceSnippet' to 'GraphJFaceSnippet1'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Original element: 'org.eclipse.mylar.zest.examples.jface.GraphJFaceSnippet'&#10;- Renamed element: 'org.eclipse.mylar.zest.examples.jface.GraphJFaceSnippet1'&#10;- Update references to refactored element&#10;- Update textual occurrences in comments and strings" description="Rename type 'GraphJFaceSnippet'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.examples.jface{GraphJFaceSnippet.java[GraphJFaceSnippet" matchStrategy="1" name="GraphJFaceSnippet1" qualified="false" references="true" similarDeclarations="false" stamp="1175025425145" textual="false" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'zest'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Destination element: 'zest'&#10;- Original element: 'SimpleGraph.sgf'" description="Copy file" element1="src/org/eclipse/mylar/zest/examples/jface/SimpleGraph.sgf" files="1" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="src/org/eclipse/mylar/zest/examples/jface/SimpleGraph.sgf&#9;true&#9;false" policy="org.eclipse.jdt.ui.copyResources" stamp="1175028357758" target="/mylar/sandbox/zest" units="0" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.index
new file mode 100644
index 0000000..4a360c4
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/3/13/refactorings.index
@@ -0,0 +1,7 @@
+1174936872156 Move compilation units
+1174936888015 Rename package 'org.eclipse.mylar.zest.jface'
+1174936900953 Move compilation units
+1174936959734 Convert member type 'CompartmentFigure' to top level
+1174936970375 Convert member type 'UMLClassFigure' to top level
+1175025425145 Rename type 'GraphJFaceSnippet'
+1175028357758 Copy file
diff --git a/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.history
new file mode 100644
index 0000000..382e076
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.swt.GraphSnippet3.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.examples.swt" element1="/src&lt;org.eclipse.mylar.zest.examples.swt{GraphSnippet3.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.examples.swt{GraphSnippet3.java&#9;true&#9;true&#9;GraphSnippet4.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1177348560172" units="1" version="1.0"/>
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylar.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylar.zest.core/src/org.eclipse.mylar.zest.examples.swt'&#13;&#10;- Original element: 'org.eclipse.mylar.zest.examples.swt.GraphSnippet4.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylar.zest.examples.swt" element1="/src&lt;org.eclipse.mylar.zest.examples.swt{GraphSnippet4.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylar.zest.examples.swt{GraphSnippet4.java&#9;true&#9;true&#9;GraphSnippet5.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1177436433568" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.index
new file mode 100644
index 0000000..33f5a49
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/4/17/refactorings.index
@@ -0,0 +1,2 @@
+1177348560172 Copy compilation unit
+1177436433568 Copy compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.history
new file mode 100644
index 0000000..129866f
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylar.zest.examples.jface.RefreshDemo' to 'GraphJFaceSnippet5'&#10;- Original project: 'org.eclipse.mylar.zest.core'&#10;- Original element: 'org.eclipse.mylar.zest.examples.jface.RefreshDemo'&#10;- Renamed element: 'org.eclipse.mylar.zest.examples.jface.GraphJFaceSnippet5'&#10;- Update references to refactored element&#10;- Update textual occurrences in comments and strings" description="Rename type 'RefreshDemo'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylar.zest.examples.jface{RefreshDemo.java[RefreshDemo" matchStrategy="1" name="GraphJFaceSnippet5" qualified="false" references="true" similarDeclarations="false" stamp="1178566315014" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.index
new file mode 100644
index 0000000..811130a
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/5/19/refactorings.index
@@ -0,0 +1 @@
+1178566315014 Rename type 'RefreshDemo'
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.history
new file mode 100644
index 0000000..86d4d31
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Extract constant 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.MIN_WIDTH' from expression '150'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Constant name: 'MIN_WIDTH'&#13;&#10;- Constant expression: '150'&#13;&#10;- Declared visibility: 'private'" description="Extract constant 'MIN_WIDTH'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{GraphContainer.java" name="MIN_WIDTH" qualify="false" replace="false" selection="9141 3" stamp="1183692637406" version="1.0" visibility="2"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.index
new file mode 100644
index 0000000..2164ed5
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/27/refactorings.index
@@ -0,0 +1 @@
+1183692637406 Extract constant 'MIN_WIDTH'
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.history
new file mode 100644
index 0000000..1ebe7fe
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.history
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.GraphSnippet2.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylyn.zest.examples.swt" element1="/src&lt;org.eclipse.mylyn.zest.examples.swt{GraphSnippet2.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylyn.zest.examples.swt{GraphSnippet2.java&#9;true&#9;true&#9;GraphSnippet6.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1184004352328" units="1" version="1.0"/>
+<refactoring comment="Extract constant 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.CONTAINER_HEIGHT' from expression '150'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Constant name: 'CONTAINER_HEIGHT'&#13;&#10;- Constant expression: '150'&#13;&#10;- Declared visibility: 'private'" description="Extract constant 'CONTAINER_HEIGHT'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{GraphContainer.java" name="CONTAINER_HEIGHT" qualify="false" replace="false" selection="8199 0" stamp="1184018647750" version="1.0" visibility="2"/>
+<refactoring comment="Extract constant 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.CONTAINER_SCALE' from expression '0.25'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Constant name: 'CONTAINER_SCALE'&#13;&#10;- Constant expression: '0.25'&#13;&#10;- Declared visibility: 'private'" description="Extract constant 'CONTAINER_SCALE'" flags="786432" id="org.eclipse.jdt.ui.extract.constant" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{GraphContainer.java" name="CONTAINER_SCALE" qualify="false" replace="false" selection="9420 4" stamp="1184018751859" version="1.0" visibility="2"/>
+<refactoring comment="Convert local variable 'org.eclipse.mylyn.zest.core.widgets.internal.ExpandGraphLabel.ExpandGraphLabel().layout' in 'org.eclipse.mylyn.zest.core.widgets.internal.ExpandGraphLabel.ExpandGraphLabel()' to field&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.internal.ExpandGraphLabel.ExpandGraphLabel().layout'&#13;&#10;- Field name: 'layout'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'" description="Convert local variable 'layout' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylyn.zest.core.widgets.internal{ExpandGraphLabel.java" name="layout" selection="4377 6" stamp="1184097068093" static="false" version="1.0" visibility="2"/>
+<refactoring comment="Convert local variable 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.createContainerFigure().pane' in 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.createContainerFigure()' to field&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.GraphContainer.createContainerFigure().pane'&#13;&#10;- Field name: 'scalledLayer'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'" description="Convert local variable 'pane' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{GraphContainer.java" name="scalledLayer" selection="17384 4" stamp="1184174395437" static="false" version="1.0" visibility="2"/>
+<refactoring comment="Convert local variable 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main().image1' in 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main()' to field&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main().image1'&#13;&#10;- Field name: 'image1'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'&#13;&#10;- Declare field 'static'" description="Convert local variable 'image1' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylyn.zest.examples.swt{NestedGraphSnippet.java" name="image1" selection="1862 0" stamp="1184174994562" static="true" version="1.0" visibility="2"/>
+<refactoring comment="Convert local variable 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main().classImage' in 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main()' to field&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.main().classImage'&#13;&#10;- Field name: 'classImage'&#13;&#10;- Initialize field in method&#13;&#10;- Declared visibility: 'private'&#13;&#10;- Declare field 'static'" description="Convert local variable 'classImage' to field" final="false" flags="2" id="org.eclipse.jdt.ui.promote.temp" initialize="1" input="/src&lt;org.eclipse.mylyn.zest.examples.swt{NestedGraphSnippet.java" name="classImage" selection="2001 10" stamp="1184175016265" static="true" version="1.0" visibility="2"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.index
new file mode 100644
index 0000000..701c031
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/28/refactorings.index
@@ -0,0 +1,7 @@
+1184004352328 Copy compilation unit
+1184018647750 Extract constant 'CONTAINER_HEIGHT'
+1184018751859 Extract constant 'CONTAINER_SCALE'
+1184097068093 Convert local variable 'layout' to field
+1184174395437 Convert local variable 'pane' to field
+1184174994562 Convert local variable 'image1' to field
+1184175016265 Convert local variable 'classImage' to field
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.history
new file mode 100644
index 0000000..12fdd93
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Rename type 'org.eclipse.mylyn.zest.core.widgets.internal.ZestRootFigure' to 'ZestRootLayer'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.internal.ZestRootFigure'&#13;&#10;- Renamed element: 'org.eclipse.mylyn.zest.core.widgets.internal.ZestRootLayer'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" description="Rename type 'ZestRootFigure'" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.zest.core.widgets.internal{ZestRootFigure.java[ZestRootFigure" matchStrategy="1" name="ZestRootLayer" qualified="false" references="true" similarDeclarations="false" stamp="1184948271031" textual="false" version="1.0"/>
+<refactoring comment="Rename method 'org.eclipse.mylyn.zest.core.widgets.Graph.changeFigure(...)' to 'changeNodeFigure'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.Graph.changeFigure(...)'&#13;&#10;- Renamed element: 'org.eclipse.mylyn.zest.core.widgets.Graph.changeNodeFigure(...)'&#13;&#10;- Update references to refactored element" delegate="false" deprecate="false" description="Rename method 'changeFigure'" flags="589830" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{Graph.java[Graph~changeFigure~QIFigure;~QIFigure;~QGraphNode;" name="changeNodeFigure" references="true" stamp="1184949733281" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.index
new file mode 100644
index 0000000..56a329f
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/7/29/refactorings.index
@@ -0,0 +1,2 @@
+1184948271031 Rename type 'ZestRootFigure'
+1184949733281 Rename method 'changeFigure'
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.history
new file mode 100644
index 0000000..42ab806
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.NestedGraphSnippet.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylyn.zest.examples.swt" element1="/src&lt;org.eclipse.mylyn.zest.examples.swt{NestedGraphSnippet.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylyn.zest.examples.swt{NestedGraphSnippet.java&#9;true&#9;true&#9;ZoomSnippet.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1185968667656" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.index
new file mode 100644
index 0000000..c238f72
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/31/refactorings.index
@@ -0,0 +1 @@
+1185968667656 Copy compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.history
new file mode 100644
index 0000000..d6ec2c9
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.history
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.internal.AspectRatioScaledFigure.java'" description="Delete element" element1="/src&lt;org.eclipse.mylyn.zest.core.widgets.internal{AspectRatioScaledFigure.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1186673033343" subPackages="false" version="1.0"/>
+<refactoring comment="Rename field 'isFishEnabled' in 'org.eclipse.mylyn.zest.core.widgets.GraphNode' to 'isFisheyeEnabled'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.GraphNode.isFishEnabled'&#13;&#10;- Renamed element: 'org.eclipse.mylyn.zest.core.widgets.GraphNode.isFisheyeEnabled'&#13;&#10;- Update references to refactored element&#13;&#10;- Update textual occurrences in comments and strings" delegate="false" deprecate="false" description="Rename field 'isFishEnabled'" flags="589826" getter="false" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylyn.zest.core.widgets{GraphNode.java[GraphNode^isFishEnabled" name="isFisheyeEnabled" references="true" setter="false" stamp="1186762095468" textual="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.index
new file mode 100644
index 0000000..fd41412
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/32/refactorings.index
@@ -0,0 +1,2 @@
+1186673033343 Delete element
+1186762095468 Rename field 'isFishEnabled'
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.history
new file mode 100644
index 0000000..3321545
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Copy 1 elements(s) to 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.GraphSnippet1.java'" description="Copy compilation unit" destination="/src&lt;org.eclipse.mylyn.zest.examples.swt" element1="/src&lt;org.eclipse.mylyn.zest.examples.swt{GraphSnippet1.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" log="/src&lt;org.eclipse.mylyn.zest.examples.swt{GraphSnippet1.java&#9;true&#9;true&#9;PaintSnippet.java" policy="org.eclipse.jdt.ui.copyResources" stamp="1187017341156" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.index
new file mode 100644
index 0000000..d1941b5
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/33/refactorings.index
@@ -0,0 +1 @@
+1187017341156 Copy compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.history
new file mode 100644
index 0000000..e22cf78
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.examples.swt.LargeTest.java'" description="Delete element" element1="/src&lt;org.eclipse.mylyn.zest.examples.swt{LargeTest.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1187639130390" subPackages="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.index
new file mode 100644
index 0000000..a5d8d07
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/34/refactorings.index
@@ -0,0 +1 @@
+1187639130390 Delete element
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.history
new file mode 100644
index 0000000..8600504
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring comment="Move 1 elements(s) to 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.core.widgets'&#13;&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#13;&#10;- Destination element: 'org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.core.widgets'&#13;&#10;- Original element: 'org.eclipse.mylyn.zest.core.widgets.internal.IContainer.java'&#13;&#10;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylyn.zest.core.widgets" element1="/src&lt;org.eclipse.mylyn.zest.core.widgets.internal{IContainer.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1188335665531" units="1" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.index
new file mode 100644
index 0000000..3e1acc9
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/8/35/refactorings.index
@@ -0,0 +1 @@
+1188335665531 Move compilation unit
diff --git a/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.history b/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.history
new file mode 100644
index 0000000..070ece3
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<session version="1.0">
+<refactoring accessors="true" comment="Delete 3 element(s) from project 'org.eclipse.mylyn.zest.core'&#10;- Original project: 'org.eclipse.mylyn.zest.core'&#10;- Original elements:&#10; org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.jface&#10; org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.swt&#10; org.eclipse.mylyn.zest.core/src/org.eclipse.mylyn.zest.examples.uml" description="Delete elements" element1="/src&lt;org.eclipse.mylyn.zest.examples.uml" element2="/src&lt;org.eclipse.mylyn.zest.examples" element3="/src&lt;org.eclipse.mylyn.zest.examples.swt" element4="/src&lt;org.eclipse.mylyn.zest.examples" element5="/src&lt;org.eclipse.mylyn.zest.examples.jface" element6="/src&lt;org.eclipse.mylyn.zest.examples" elements="6" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1189540969837" subPackages="false" version="1.0"/>
+</session>
diff --git a/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.index b/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.index
new file mode 100644
index 0000000..9cbf771
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2007/9/37/refactorings.index
@@ -0,0 +1 @@
+1189540969837 Delete elements
diff --git a/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.history b/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.history
new file mode 100644
index 0000000..51ceb82
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.history
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<session version="1.0">
+<refactoring comment="Rename compilation unit &apos;org.eclipse.zest.core.viewers.INestedEntityRelationshipContentProvider.java&apos; to &apos;INestedContentProvider.java&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.zest.core.viewers.INestedEntityRelationshipContentProvider.java&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.zest.core.viewers.INestedContentProvider.java&apos;" description="Rename compilation unit &apos;INestedEntityRelationshipContentProvider.java&apos;" flags="2" id="org.eclipse.jdt.ui.rename.compilationunit" input="/src&lt;org.eclipse.zest.core.viewers{INestedEntityRelationshipContentProvider.java" name="INestedContentProvider.java" references="false" stamp="1225253150562" version="1.0"/>
+</session> \ No newline at end of file
diff --git a/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.index b/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.index
new file mode 100644
index 0000000..666919d
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2008/10/44/refactorings.index
@@ -0,0 +1 @@
+1225253150562 Rename compilation unit 'INestedEntityRelationshipContentProvider.java'
diff --git a/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.history b/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.history
new file mode 100644
index 0000000..9a2cef2
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.history
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<session version="1.0">&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.viewers.internal.ZestException.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.viewers.internal{ZestException.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1241411707221" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.messages.ZestErrorMessages.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.messages{ZestErrorMessages.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1241411739374" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.messages.ZestUIMessages.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.messages{ZestUIMessages.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1241411742074" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;ZestError.properties&apos;" description="Delete element" element1="src/org/eclipse/zest/core/messages/ZestError.properties" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="1" stamp="1241411744555" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;ZestUI.properties&apos;" description="Delete element" element1="src/org/eclipse/zest/core/messages/ZestUI.properties" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="1" stamp="1241411746314" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core/src/org.eclipse.zest.core.messages&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.messages" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1241411749899" subPackages="false" version="1.0"/>
+</session> \ No newline at end of file
diff --git a/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.index b/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.index
new file mode 100644
index 0000000..cb214cb
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2009/5/19/refactorings.index
@@ -0,0 +1,6 @@
+1241411707221 Delete element
+1241411739374 Delete element
+1241411742074 Delete element
+1241411744555 Delete element
+1241411746314 Delete element
+1241411749899 Delete element
diff --git a/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.history b/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.history
new file mode 100644
index 0000000..d056a87
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.history
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<session version="1.0">&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.viewers.internal.AbstractStructuredGraphViewer.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.viewers.internal{AbstractStructuredGraphViewer.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1291316557790" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.viewers.internal.ZoomListener.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.viewers.internal{ZoomListener.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1291316585665" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.viewers.internal.ZoomManager.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.viewers.internal{ZoomManager.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1291316588584" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;org.eclipse.zest.core&apos;&#x0A;- Original project: &apos;org.eclipse.zest.core&apos;&#x0A;- Original element: &apos;org.eclipse.zest.core.widgets.ConstraintAdapter.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.zest.core.widgets{ConstraintAdapter.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1291316606776" subPackages="false" version="1.0"/>
+</session> \ No newline at end of file
diff --git a/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.index b/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.index
new file mode 100644
index 0000000..b24b4f8
--- /dev/null
+++ b/org.eclipse.zest.core/.refactorings/2010/12/49/refactorings.index
@@ -0,0 +1,4 @@
+1291316557790 Delete element
+1291316585665 Delete element
+1291316588584 Delete element
+1291316606776 Delete element
diff --git a/org.eclipse.zest.core/.settings/.api_filters b/org.eclipse.zest.core/.settings/.api_filters
new file mode 100644
index 0000000..7f003bf
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/.api_filters
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component id="org.eclipse.zest.core" version="2">
+ <resource path="src/org/eclipse/zest/core/viewers/GraphViewer.java" type="org.eclipse.zest.core.viewers.GraphViewer">
+ <filter id="576720909">
+ <message_arguments>
+ <message_argument value="AbstractStructuredGraphViewer"/>
+ <message_argument value="GraphViewer"/>
+ </message_arguments>
+ </filter>
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="IStylingGraphModelFactory"/>
+ <message_argument value="GraphViewer"/>
+ <message_argument value="getFactory()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="ZoomManager"/>
+ <message_argument value="GraphViewer"/>
+ <message_argument value="getZoomManager()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/zest/core/widgets/GraphContainer.java" type="org.eclipse.zest.core.widgets.GraphContainer">
+ <filter id="627060751">
+ <message_arguments>
+ <message_argument value="ZestRootLayer"/>
+ <message_argument value="GraphContainer"/>
+ <message_argument value="zestLayer"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/zest/core/viewers/ZoomContributionViewItem.java" type="org.eclipse.zest.core.viewers.ZoomContributionViewItem">
+ <filter id="576725006">
+ <message_arguments>
+ <message_argument value="ZoomListener"/>
+ <message_argument value="ZoomContributionViewItem"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/zest/core/viewers/AbstractZoomableViewer.java" type="org.eclipse.zest.core.viewers.AbstractZoomableViewer">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="ZoomManager"/>
+ <message_argument value="AbstractZoomableViewer"/>
+ <message_argument value="getZoomManager()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.zest.core/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.zest.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..797ac4f
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,313 @@
+#Tue Mar 27 12:16:25 PDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=300
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false
diff --git a/org.eclipse.zest.core/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.zest.core/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..dbe23db
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,53 @@
+#Wed Aug 15 08:52:35 PDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Ian's Style
+formatter_settings_version=11
+internal.default.compliance=default
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.zest.core/.settings/org.eclipse.ltk.core.refactoring.prefs b/org.eclipse.zest.core/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 0000000..0b12f67
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,3 @@
+#Fri Jun 02 15:32:08 PDT 2006
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=true
diff --git a/org.eclipse.zest.core/.settings/org.eclipse.pde.api.tools.prefs b/org.eclipse.zest.core/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 0000000..da65176
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,86 @@
+#Wed Oct 15 15:09:10 EDT 2008
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Error
+ILLEGAL_IMPLEMENT=Error
+ILLEGAL_INSTANTIATE=Error
+ILLEGAL_OVERRIDE=Error
+ILLEGAL_REFERENCE=Error
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Error
+LEAK_EXTEND=Error
+LEAK_FIELD_DECL=Error
+LEAK_IMPLEMENT=Error
+LEAK_METHOD_PARAM=Error
+LEAK_METHOD_RETURN_TYPE=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
diff --git a/org.eclipse.zest.core/.settings/org.eclipse.pde.prefs b/org.eclipse.zest.core/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..3256123
--- /dev/null
+++ b/org.eclipse.zest.core/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,13 @@
+#Tue Feb 07 15:50:18 PST 2006
+compilers.p.build=2
+compilers.p.deprecated=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=0
+compilers.p.unknown-element=0
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.zest.core/META-INF/MANIFEST.MF b/org.eclipse.zest.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4ff6c5e
--- /dev/null
+++ b/org.eclipse.zest.core/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Plugin.name
+Bundle-SymbolicName: org.eclipse.zest.core;singleton:=true
+Bundle-Vendor: %Plugin.providerName
+Bundle-Localization: plugin
+Bundle-Version: 2.0.0.qualifier
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.draw2d;visibility:=reexport,
+ org.eclipse.zest.layouts;bundle-version="1.1.0"
+Eclipse-LazyStart: false
+Export-Package: org.eclipse.zest.core.viewers,
+ org.eclipse.zest.core.widgets,
+ org.eclipse.zest.core.widgets.custom
+Import-Package: com.ibm.icu.text;version="[3.8.1,5.0.0)"
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/org.eclipse.zest.core/about.html b/org.eclipse.zest.core/about.html
new file mode 100644
index 0000000..1aeb16b
--- /dev/null
+++ b/org.eclipse.zest.core/about.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.zest.core/about.ini b/org.eclipse.zest.core/about.ini
new file mode 100644
index 0000000..f4b4beb
--- /dev/null
+++ b/org.eclipse.zest.core/about.ini
@@ -0,0 +1,11 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%blurb
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=modeling32.png
diff --git a/org.eclipse.zest.core/about.mappings b/org.eclipse.zest.core/about.mappings
new file mode 100644
index 0000000..bddaab4
--- /dev/null
+++ b/org.eclipse.zest.core/about.mappings
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=@build@ \ No newline at end of file
diff --git a/org.eclipse.zest.core/about.properties b/org.eclipse.zest.core/about.properties
new file mode 100644
index 0000000..0502573
--- /dev/null
+++ b/org.eclipse.zest.core/about.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2007, 2009 IBM Corporation and others.
+# 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
+# about.properties
+# contains externalized strings for about.ini
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# fill-ins are supplied by about.mappings
+# This file should be translated.
+
+blurb=Graphical Editing Framework Zest Visualization Toolkit\n\
+\n\
+Version: {featureVersion}\n\
+Build id: {0}\n\
+\n\
+(c) Copyright Eclipse Contributors and others 2000, 2009. All rights reserved.\n\
+Visit http://www.eclipse.org/gef
diff --git a/org.eclipse.zest.core/build.properties b/org.eclipse.zest.core/build.properties
new file mode 100644
index 0000000..4068520
--- /dev/null
+++ b/org.eclipse.zest.core/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2007, 2009 IBM Corporation and others.
+# 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
+bin.includes = about.*,\
+ modeling32.png,\
+ plugin.xml,\
+ META-INF/,\
+ .,\
+ src/icons/,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/org.eclipse.zest.core/currentTasks.txt b/org.eclipse.zest.core/currentTasks.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/org.eclipse.zest.core/currentTasks.txt
diff --git a/org.eclipse.zest.core/license.txt b/org.eclipse.zest.core/license.txt
new file mode 100644
index 0000000..f61d34d
--- /dev/null
+++ b/org.eclipse.zest.core/license.txt
@@ -0,0 +1,88 @@
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
+
+
diff --git a/org.eclipse.zest.core/modeling32.png b/org.eclipse.zest.core/modeling32.png
new file mode 100644
index 0000000..6b08de2
--- /dev/null
+++ b/org.eclipse.zest.core/modeling32.png
Binary files differ
diff --git a/org.eclipse.zest.core/plugin.properties b/org.eclipse.zest.core/plugin.properties
new file mode 100644
index 0000000..c1406e0
--- /dev/null
+++ b/org.eclipse.zest.core/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2007, 2009 IBM Corporation and others.
+# 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
+Plugin.name=Graphical Editing Framework Zest Core
+Plugin.providerName = Eclipse Modeling Project
diff --git a/org.eclipse.zest.core/plugin.xml b/org.eclipse.zest.core/plugin.xml
new file mode 100644
index 0000000..8e49b52
--- /dev/null
+++ b/org.eclipse.zest.core/plugin.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+</plugin>
diff --git a/org.eclipse.zest.core/src/icons/home.gif b/org.eclipse.zest.core/src/icons/home.gif
new file mode 100644
index 0000000..38e8b54
--- /dev/null
+++ b/org.eclipse.zest.core/src/icons/home.gif
Binary files differ
diff --git a/org.eclipse.zest.core/src/icons/tree_hanging.gif b/org.eclipse.zest.core/src/icons/tree_hanging.gif
new file mode 100644
index 0000000..9c050ed
--- /dev/null
+++ b/org.eclipse.zest.core/src/icons/tree_hanging.gif
Binary files differ
diff --git a/org.eclipse.zest.core/src/icons/tree_hanging_inverse.gif b/org.eclipse.zest.core/src/icons/tree_hanging_inverse.gif
new file mode 100644
index 0000000..22e017d
--- /dev/null
+++ b/org.eclipse.zest.core/src/icons/tree_hanging_inverse.gif
Binary files differ
diff --git a/org.eclipse.zest.core/src/icons/tree_normal.gif b/org.eclipse.zest.core/src/icons/tree_normal.gif
new file mode 100644
index 0000000..4a7cb1a
--- /dev/null
+++ b/org.eclipse.zest.core/src/icons/tree_normal.gif
Binary files differ
diff --git a/org.eclipse.zest.core/src/icons/tree_normal_inverse.gif b/org.eclipse.zest.core/src/icons/tree_normal_inverse.gif
new file mode 100644
index 0000000..2c216e7
--- /dev/null
+++ b/org.eclipse.zest.core/src/icons/tree_normal_inverse.gif
Binary files differ
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractStructuredGraphViewer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractStructuredGraphViewer.java
new file mode 100644
index 0000000..6add9e2
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractStructuredGraphViewer.java
@@ -0,0 +1,801 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria Mateusz Matela
+ * <mateusz.matela@gmail.com> - Adapt Zest to changes in layout -
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=283179
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.zest.core.viewers.internal.IStylingGraphModelFactory;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphContainer;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.core.widgets.custom.CGraphNode;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+
+/**
+ * Abstraction of graph viewers to implement functionality used by all of them.
+ * Not intended to be implemented by clients. Use one of the provided children
+ * instead.
+ *
+ * @author Del Myers
+ * @since 2.0
+ */
+public abstract class AbstractStructuredGraphViewer extends
+ AbstractZoomableViewer {
+ /**
+ * Contains top-level styles for the entire graph. Set in the constructor. *
+ */
+ private int graphStyle;
+
+ /**
+ * Contains node-level styles for the graph. Set in setNodeStyle(). Defaults
+ * are used in the constructor.
+ */
+ private int nodeStyle;
+
+ /**
+ * Contains arc-level styles for the graph. Set in setConnectionStyle().
+ * Defaults are used in the constructor.
+ */
+ private int connectionStyle;
+
+ private HashMap nodesMap = new HashMap();
+ private HashMap connectionsMap = new HashMap();
+
+ /**
+ * A simple graph comparator that orders graph elements based on thier type
+ * (connection or node), and their unique object identification.
+ */
+ private class SimpleGraphComparator implements Comparator {
+ TreeSet storedStrings;
+
+ /**
+ *
+ */
+ public SimpleGraphComparator() {
+ this.storedStrings = new TreeSet();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object arg0, Object arg1) {
+ if (arg0 instanceof GraphNode && arg1 instanceof GraphConnection) {
+ return 1;
+ } else if (arg0 instanceof GraphConnection
+ && arg1 instanceof GraphNode) {
+ return -1;
+ }
+ if (arg0.equals(arg1)) {
+ return 0;
+ }
+ return getObjectString(arg0).compareTo(getObjectString(arg1));
+ }
+
+ private String getObjectString(Object o) {
+ String s = o.getClass().getName() + "@"
+ + Integer.toHexString(o.hashCode());
+ while (storedStrings.contains(s)) {
+ s = s + 'X';
+ }
+ return s;
+ }
+ }
+
+ protected AbstractStructuredGraphViewer(int graphStyle) {
+ this.graphStyle = graphStyle;
+ this.connectionStyle = SWT.NONE;
+ this.nodeStyle = SWT.NONE;
+
+ }
+
+ /**
+ * Sets the default style for nodes in this graph. Note: if an input is set
+ * on the viewer, a ZestException will be thrown.
+ *
+ * @param nodeStyle
+ * the style for the nodes.
+ * @see #ZestStyles
+ */
+ public void setNodeStyle(int nodeStyle) {
+ if (getInput() != null) {
+ throw new SWTError(SWT.ERROR_UNSPECIFIED);
+ }
+ this.nodeStyle = nodeStyle;
+ }
+
+ /**
+ * Sets the default style for connections in this graph. Note: if an input
+ * is set on the viewer, a ZestException will be thrown.
+ *
+ * @param connectionStyle
+ * the style for the connections.
+ * @see #ZestStyles
+ */
+ public void setConnectionStyle(int connectionStyle) {
+ if (getInput() != null) {
+ throw new SWTError(SWT.ERROR_UNSPECIFIED);
+ }
+ if (!ZestStyles.validateConnectionStyle(connectionStyle)) {
+ throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.connectionStyle = connectionStyle;
+ }
+
+ /**
+ * Returns the style set for the graph
+ *
+ * @return The style set of the graph
+ */
+ public int getGraphStyle() {
+ return graphStyle;
+ }
+
+ /**
+ * Returns the style set for the nodes.
+ *
+ * @return the style set for the nodes.
+ */
+ public int getNodeStyle() {
+ return nodeStyle;
+ }
+
+ public Graph getGraphControl() {
+ return (Graph) getControl();
+ }
+
+ /**
+ * @return the connection style.
+ */
+ public int getConnectionStyle() {
+ return connectionStyle;
+ }
+
+ /**
+ * Sets the layout algorithm for this viewer. Subclasses may place
+ * restrictions on the algorithms that it accepts.
+ *
+ * @param algorithm
+ * the layout algorithm
+ * @param run
+ * true if the layout algorithm should be run immediately. This
+ * is a hint.
+ */
+ public abstract void setLayoutAlgorithm(LayoutAlgorithm algorithm,
+ boolean run);
+
+ /**
+ * Gets the current layout algorithm.
+ *
+ * @return the current layout algorithm.
+ */
+ protected abstract LayoutAlgorithm getLayoutAlgorithm();
+
+ /**
+ * Equivalent to setLayoutAlgorithm(algorithm, false).
+ *
+ * @param algorithm
+ */
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm) {
+ setLayoutAlgorithm(algorithm, false);
+ }
+
+ public Object[] getNodeElements() {
+ return this.nodesMap.keySet().toArray();
+ }
+
+ public Object[] getConnectionElements() {
+ return this.connectionsMap.keySet().toArray();
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @return
+ */
+ public HashMap getNodesMap() {
+ return this.nodesMap;
+ }
+
+ /**
+ *
+ * @param element
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphNode addGraphModelContainer(Object element) {
+ GraphNode node = this.getGraphModelNode(element);
+ if (node == null) {
+ node = new GraphContainer((Graph) getControl(), SWT.NONE);
+ this.nodesMap.put(element, node);
+ node.setData(element);
+ }
+ return node;
+ }
+
+ /**
+ *
+ * @param container
+ * @param element
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphNode addGraphModelNode(GraphContainer container, Object element) {
+ GraphNode node = this.getGraphModelNode(element);
+ if (node == null) {
+ node = new GraphNode(container, SWT.NONE);
+ this.nodesMap.put(element, node);
+ node.setData(element);
+ }
+ return node;
+ }
+
+ /**
+ *
+ * @param element
+ * @param figure
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphNode addGraphModelNode(Object element, IFigure figure) {
+ GraphNode node = this.getGraphModelNode(element);
+ if (node == null) {
+ if (figure != null) {
+ node = new CGraphNode((Graph) getControl(), SWT.NONE, figure);
+ this.nodesMap.put(element, node);
+ node.setData(element);
+ } else {
+ node = new GraphNode((Graph) getControl(), SWT.NONE);
+ this.nodesMap.put(element, node);
+ node.setData(element);
+ }
+ }
+ return node;
+ }
+
+ /**
+ *
+ * @param element
+ * @param source
+ * @param target
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphConnection addGraphModelConnection(Object element,
+ GraphNode source, GraphNode target) {
+ GraphConnection connection = this.getGraphModelConnection(element);
+ if (connection == null) {
+ connection = new GraphConnection((Graph) getControl(), SWT.NONE,
+ source, target);
+ this.connectionsMap.put(element, connection);
+ connection.setData(element);
+ }
+ return connection;
+
+ }
+
+ /**
+ *
+ * @param obj
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphConnection getGraphModelConnection(Object obj) {
+ return (GraphConnection) this.connectionsMap.get(obj);
+ }
+
+ /**
+ *
+ * @param obj
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public GraphNode getGraphModelNode(Object obj) {
+ return (GraphNode) this.nodesMap.get(obj);
+ }
+
+ /**
+ * @param obj
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void removeGraphModelConnection(Object obj) {
+ GraphConnection connection = (GraphConnection) connectionsMap.get(obj);
+ if (connection != null) {
+ connectionsMap.remove(obj);
+ if (!connection.isDisposed()) {
+ connection.dispose();
+ }
+ }
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void removeGraphModelNode(Object obj) {
+ GraphNode node = (GraphNode) nodesMap.get(obj);
+ if (node != null) {
+ nodesMap.remove(obj);
+ if (!node.isDisposed()) {
+ node.dispose();
+ }
+ }
+ }
+
+ protected void handleDispose(DisposeEvent event) {
+
+ if (getControl() != null && !getControl().isDisposed()) {
+ getControl().dispose();
+ }
+ super.handleDispose(event);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.StructuredViewer#internalRefresh(java.lang.
+ * Object)
+ */
+ protected void internalRefresh(Object element) {
+ if (getInput() == null) {
+ return;
+ }
+ if (element == getInput()) {
+ getFactory().refreshGraph(getGraphControl());
+ } else {
+ getFactory().refresh(getGraphControl(), element);
+ }
+ // After all the items are loaded, we call update to ensure drawing.
+ // This way the damaged area does not get too big if we start
+ // adding and removing more nodes
+ getGraphControl().getLightweightSystem().getUpdateManager()
+ .performUpdate();
+ }
+
+ protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
+ if (item == getGraphControl()) {
+ getFactory().update(getNodesArray(getGraphControl()));
+ getFactory().update(getConnectionsArray(getGraphControl()));
+ } else if (item instanceof GraphItem) {
+ getFactory().update((GraphItem) item);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.StructuredViewer#doFindInputItem(java.lang.
+ * Object)
+ */
+ protected Widget doFindInputItem(Object element) {
+
+ if (element == getInput() && element instanceof Widget) {
+ return (Widget) element;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.StructuredViewer#doFindItem(java.lang.Object)
+ */
+ protected Widget doFindItem(Object element) {
+ Widget node = (Widget) nodesMap.get(element);
+ Widget connection = (Widget) connectionsMap.get(element);
+ return (node != null) ? node : connection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.StructuredViewer#getSelectionFromWidget()
+ */
+ protected List getSelectionFromWidget() {
+ List internalSelection = getWidgetSelection();
+ LinkedList externalSelection = new LinkedList();
+ for (Iterator i = internalSelection.iterator(); i.hasNext();) {
+ // @tag zest.todo : should there be a method on IGraphItem to get
+ // the external data?
+ GraphItem item = (GraphItem) i.next();
+ if (item instanceof GraphNode) {
+ externalSelection.add(((GraphNode) item).getData());
+ } else if (item instanceof GraphConnection) {
+ externalSelection.add(((GraphConnection) item)
+ .getExternalConnection());
+ } else if (item instanceof Widget) {
+ externalSelection.add(((Widget) item).getData());
+ }
+ }
+ return externalSelection;
+ }
+
+ protected GraphItem[] /* GraphItem */findItems(List l) {
+ if (l == null) {
+ return new GraphItem[0];
+ }
+
+ ArrayList list = new ArrayList();
+ Iterator iterator = l.iterator();
+
+ while (iterator.hasNext()) {
+ GraphItem w = (GraphItem) findItem(iterator.next());
+ list.add(w);
+ }
+ return (GraphItem[]) list.toArray(new GraphItem[list.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.StructuredViewer#setSelectionToWidget(java.
+ * util.List, boolean)
+ */
+ protected void setSelectionToWidget(List l, boolean reveal) {
+ Graph control = (Graph) getControl();
+ List selection = new LinkedList();
+ for (Iterator i = l.iterator(); i.hasNext();) {
+ Object obj = i.next();
+ GraphNode node = (GraphNode) nodesMap.get(obj);
+ GraphConnection conn = (GraphConnection) connectionsMap.get(obj);
+ if (node != null) {
+ selection.add(node);
+ }
+ if (conn != null) {
+ selection.add(conn);
+ }
+ }
+ control.setSelection((GraphNode[]) selection
+ .toArray(new GraphNode[selection.size()]));
+ }
+
+ /**
+ * Gets the internal model elements that are selected.
+ *
+ * @return
+ */
+ protected List getWidgetSelection() {
+ Graph control = (Graph) getControl();
+ return control.getSelection();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.Viewer#inputChanged(java.lang.Object,
+ * java.lang.Object)
+ */
+ protected void inputChanged(Object input, Object oldInput) {
+ IStylingGraphModelFactory factory = getFactory();
+ factory.setConnectionStyle(getConnectionStyle());
+ factory.setNodeStyle(getNodeStyle());
+
+ // Save the old map so we can set the size and position of any nodes
+ // that are the same
+ Map oldNodesMap = nodesMap;
+ Graph graph = (Graph) getControl();
+ graph.setSelection(new GraphNode[0]);
+
+ Iterator iterator = nodesMap.values().iterator();
+ while (iterator.hasNext()) {
+ GraphNode node = (GraphNode) iterator.next();
+ if (!node.isDisposed()) {
+ node.dispose();
+ }
+ }
+
+ iterator = connectionsMap.values().iterator();
+ while (iterator.hasNext()) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!connection.isDisposed()) {
+ connection.dispose();
+ }
+ }
+
+ nodesMap = new HashMap();
+ connectionsMap = new HashMap();
+
+ graph = factory.createGraphModel(graph);
+
+ ((Graph) getControl()).setNodeStyle(getNodeStyle());
+ ((Graph) getControl()).setConnectionStyle(getConnectionStyle());
+
+ // check if any of the pre-existing nodes are still present
+ // in this case we want them to keep the same location & size
+ for (Iterator iter = oldNodesMap.keySet().iterator(); iter.hasNext();) {
+ Object data = iter.next();
+ GraphNode newNode = (GraphNode) nodesMap.get(data);
+ if (newNode != null) {
+ GraphNode oldNode = (GraphNode) oldNodesMap.get(data);
+ newNode.setLocation(oldNode.getLocation().x, oldNode
+ .getLocation().y);
+ if (oldNode.isSizeFixed()) {
+ newNode.setSize(oldNode.getSize().width,
+ oldNode.getSize().height);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the factory used to create the model. This must not be called
+ * before the content provider is set.
+ *
+ * @return
+ * @noreference This method is not intended to be referenced by clients.
+ * @nooverride This method is not intended to be re-implemented or extended
+ * by clients.
+ */
+ protected abstract IStylingGraphModelFactory getFactory();
+
+ protected void filterVisuals() {
+ if (getGraphControl() == null) {
+ return;
+ }
+ Object[] filtered = getFilteredChildren(getInput());
+ SimpleGraphComparator comparator = new SimpleGraphComparator();
+ TreeSet filteredElements = new TreeSet(comparator);
+ TreeSet unfilteredElements = new TreeSet(comparator);
+ List connections = getGraphControl().getConnections();
+ List nodes = getGraphControl().getNodes();
+ if (filtered.length == 0) {
+ // set everything to invisible.
+ // @tag zest.bug.156528-Filters.check : should we only filter out
+ // the nodes?
+ for (Iterator i = connections.iterator(); i.hasNext();) {
+ GraphConnection c = (GraphConnection) i.next();
+ c.setVisible(false);
+ }
+ for (Iterator i = nodes.iterator(); i.hasNext();) {
+ GraphNode n = (GraphNode) i.next();
+ n.setVisible(false);
+ }
+ return;
+ }
+ for (Iterator i = connections.iterator(); i.hasNext();) {
+ GraphConnection c = (GraphConnection) i.next();
+ if (c.getExternalConnection() != null) {
+ unfilteredElements.add(c);
+ }
+ }
+ for (Iterator i = nodes.iterator(); i.hasNext();) {
+ GraphNode n = (GraphNode) i.next();
+ if (n.getData() != null) {
+ unfilteredElements.add(n);
+ }
+ }
+ for (int i = 0; i < filtered.length; i++) {
+ Object modelElement = connectionsMap.get(filtered[i]);
+ if (modelElement == null) {
+ modelElement = nodesMap.get(filtered[i]);
+ }
+ if (modelElement != null) {
+ filteredElements.add(modelElement);
+ }
+ }
+ unfilteredElements.removeAll(filteredElements);
+ // set all the elements that did not pass the filters to invisible, and
+ // all the elements that passed to visible.
+ while (unfilteredElements.size() > 0) {
+ GraphItem i = (GraphItem) unfilteredElements.first();
+ i.setVisible(false);
+ unfilteredElements.remove(i);
+ }
+ while (filteredElements.size() > 0) {
+ GraphItem i = (GraphItem) filteredElements.first();
+ i.setVisible(true);
+ filteredElements.remove(i);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.StructuredViewer#getRawChildren(java.lang.Object
+ * )
+ */
+ protected Object[] getRawChildren(Object parent) {
+ if (parent == getInput()) {
+ // get the children from the model.
+ LinkedList children = new LinkedList();
+ if (getGraphControl() != null) {
+ List connections = getGraphControl().getConnections();
+ List nodes = getGraphControl().getNodes();
+ for (Iterator i = connections.iterator(); i.hasNext();) {
+ GraphConnection c = (GraphConnection) i.next();
+ if (c.getExternalConnection() != null) {
+ children.add(c.getExternalConnection());
+ }
+ }
+ for (Iterator i = nodes.iterator(); i.hasNext();) {
+ GraphNode n = (GraphNode) i.next();
+ if (n.getData() != null) {
+ children.add(n.getData());
+ }
+ }
+ return children.toArray();
+ }
+ }
+ return super.getRawChildren(parent);
+ }
+
+ /**
+ *
+ */
+ public void reveal(Object element) {
+ Widget[] items = this.findItems(element);
+ for (int i = 0; i < items.length; i++) {
+ Widget item = items[i];
+ if (item instanceof GraphNode) {
+ GraphNode graphModelNode = (GraphNode) item;
+ graphModelNode.highlight();
+ } else if (item instanceof GraphConnection) {
+ GraphConnection graphModelConnection = (GraphConnection) item;
+ graphModelConnection.highlight();
+ }
+ }
+ }
+
+ public void unReveal(Object element) {
+ Widget[] items = this.findItems(element);
+ for (int i = 0; i < items.length; i++) {
+ Widget item = items[i];
+ if (item instanceof GraphNode) {
+ GraphNode graphModelNode = (GraphNode) item;
+ graphModelNode.unhighlight();
+ } else if (item instanceof GraphConnection) {
+ GraphConnection graphModelConnection = (GraphConnection) item;
+ graphModelConnection.unhighlight();
+ }
+ }
+ }
+
+ /**
+ * Applies the viewers layouts.
+ *
+ */
+ public abstract void applyLayout();
+
+ /**
+ * Removes the given connection object from the layout algorithm and the
+ * model.
+ *
+ * @param connection
+ */
+ public void removeRelationship(Object connection) {
+ GraphConnection relationship = (GraphConnection) connectionsMap
+ .get(connection);
+
+ if (relationship != null) {
+ // remove the relationship from the model
+ relationship.dispose();
+ }
+ }
+
+ /**
+ * Creates a new node and adds it to the graph. If it already exists nothing
+ * happens.
+ *
+ * @param newNode
+ */
+ public void addNode(Object element) {
+ if (nodesMap.get(element) == null) {
+ // create the new node
+ getFactory().createNode(getGraphControl(), element);
+
+ }
+ }
+
+ /**
+ * Removes the given element from the layout algorithm and the model.
+ *
+ * @param element
+ * The node element to remove.
+ */
+ public void removeNode(Object element) {
+ GraphNode node = (GraphNode) nodesMap.get(element);
+
+ if (node != null) {
+ // remove the node and it's connections from the model
+ node.dispose();
+ }
+ }
+
+ /**
+ * Creates a new relationship between the source node and the destination
+ * node. If either node doesn't exist then it will be created.
+ *
+ * @param connection
+ * The connection data object.
+ * @param srcNode
+ * The source node data object.
+ * @param destNode
+ * The destination node data object.
+ */
+ public void addRelationship(Object connection, Object srcNode,
+ Object destNode) {
+ // create the new relationship
+ IStylingGraphModelFactory modelFactory = getFactory();
+ modelFactory.createConnection(getGraphControl(), connection, srcNode,
+ destNode);
+
+ }
+
+ /**
+ * Adds a new relationship given the connection. It will use the content
+ * provider to determine the source and destination nodes.
+ *
+ * @param connection
+ * The connection data object.
+ */
+ public void addRelationship(Object connection) {
+ IStylingGraphModelFactory modelFactory = getFactory();
+ if (connectionsMap.get(connection) == null) {
+ if (modelFactory.getContentProvider() instanceof IGraphContentProvider) {
+ IGraphContentProvider content = ((IGraphContentProvider) modelFactory
+ .getContentProvider());
+ Object source = content.getSource(connection);
+ Object dest = content.getDestination(connection);
+ // create the new relationship
+ modelFactory.createConnection(getGraphControl(), connection,
+ source, dest);
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+ }
+
+ /**
+ * Converts the list of GraphModelConnection objects into an array and
+ * returns it.
+ *
+ * @return GraphModelConnection[]
+ */
+ protected GraphConnection[] getConnectionsArray(Graph graph) {
+ GraphConnection[] connsArray = new GraphConnection[graph
+ .getConnections().size()];
+ connsArray = (GraphConnection[]) graph.getConnections().toArray(
+ connsArray);
+ return connsArray;
+ }
+
+ /**
+ * Converts the list of GraphModelNode objects into an array an returns it.
+ *
+ * @return GraphModelNode[]
+ */
+ protected GraphNode[] getNodesArray(Graph graph) {
+ GraphNode[] nodesArray = new GraphNode[graph.getNodes().size()];
+ nodesArray = (GraphNode[]) graph.getNodes().toArray(nodesArray);
+ return nodesArray;
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractZoomableViewer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractZoomableViewer.java
new file mode 100644
index 0000000..a9b4e02
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/AbstractZoomableViewer.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.jface.viewers.StructuredViewer;
+
+/**
+ * A simple interface that provides zooming capabilites. Not intended to be
+ * subclassed by clients.
+ *
+ * @author Del Myers
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ *
+ */
+// @tag bug.156286-Zooming.fix
+public abstract class AbstractZoomableViewer extends StructuredViewer {
+ /**
+ * Returns a ZoomManager that zooming can be done on. May return null if
+ * none is available.
+ *
+ * @return a ZoomManager that zooming can be done on.
+ * @since 2.0
+ */
+ protected abstract ZoomManager getZoomManager();
+
+ public void zoomTo(int x, int y, int width, int height) {
+ Rectangle r = new Rectangle(x, y, width, height);
+ if (r.isEmpty()) {
+ getZoomManager().setZoomAsText("100%");
+ } else {
+ getZoomManager().zoomTo(r);
+ }
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/EntityConnectionData.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/EntityConnectionData.java
new file mode 100644
index 0000000..ae1dc65
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/EntityConnectionData.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * A simple object that is used as the "external connection" in content
+ * providers that don't ask the user to create their own external connection.
+ *
+ * This is used whenever users don't specify a connection
+ *
+ * @author Del Myers
+ */
+public final class EntityConnectionData {
+ public final Object source;
+ public final Object dest;
+
+ /**
+ * Creates a new entity connection data. The source and dest are users
+ * nodes.
+ */
+ public EntityConnectionData(Object source, Object dest) {
+ /*
+ * if (source == null) { throw new
+ * RuntimeException("Creating relationship with null source object"); }
+ * if (dest == null) { throw new
+ * RuntimeException("Creating relationship with null dest object"); }
+ */
+ this.source = source;
+ this.dest = dest;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (!(obj instanceof EntityConnectionData)) {
+ return false;
+ }
+ EntityConnectionData that = (EntityConnectionData) obj;
+ return (this.source.equals(that.source) && this.dest.equals(that.dest));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return this.source.hashCode() + this.dest.hashCode();
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/GraphViewer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/GraphViewer.java
new file mode 100644
index 0000000..ed8f6cd
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/GraphViewer.java
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.zest.core.viewers.internal.GraphModelEntityFactory;
+import org.eclipse.zest.core.viewers.internal.GraphModelEntityRelationshipFactory;
+import org.eclipse.zest.core.viewers.internal.GraphModelFactory;
+import org.eclipse.zest.core.viewers.internal.IStylingGraphModelFactory;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+
+/**
+ * This view is used to represent a static graph. Static graphs can be layed
+ * out, but do not continually update their layout locations.
+ *
+ * @author Ian Bull
+ *
+ * @author Chris Callendar
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class GraphViewer extends AbstractStructuredGraphViewer implements
+ ISelectionProvider {
+
+ protected Graph graph = null;
+ private IStylingGraphModelFactory modelFactory = null;
+ private List selectionChangedListeners = null;
+ ZoomManager zoomManager = null;
+
+ /**
+ * Initializes the viewer.
+ *
+ * @param composite
+ * @param style
+ * the style for the viewer and for the layout algorithm
+ * @see ZestStyles#LAYOUT_GRID
+ * @see ZestStyles#LAYOUT_TREE
+ * @see ZestStyles#LAYOUT_RADIAL
+ * @see ZestStyles#LAYOUT_SPRING
+ * @see ZestStyles#NO_OVERLAPPING_NODES
+ * @see ZestStyles#NODES_HIGHLIGHT_ADJACENT
+ * @see SWT#V_SCROLL
+ * @see SWT#H_SCROLL
+ */
+ public GraphViewer(Composite composite, int style) {
+ super(style);
+ this.graph = new Graph(composite, style);
+ hookControl(this.graph);
+ }
+
+ public void setControl(Graph graphModel) {
+ this.graph = graphModel;
+ hookControl(this.graph);
+ }
+
+ protected void hookControl(Control control) {
+ super.hookControl(control);
+
+ selectionChangedListeners = new ArrayList();
+ getGraphControl().addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ Iterator iterator = selectionChangedListeners.iterator();
+
+ ISelection structuredSelection = getSelection();
+ SelectionChangedEvent event = new SelectionChangedEvent(
+ GraphViewer.this, structuredSelection);
+
+ while (iterator.hasNext()) {
+ ISelectionChangedListener listener = (ISelectionChangedListener) iterator
+ .next();
+ listener.selectionChanged(event);
+ }
+
+ }
+
+ });
+
+ control.addMouseListener(new MouseListener() {
+
+ public void mouseDoubleClick(MouseEvent e) {
+ DoubleClickEvent doubleClickEvent = new DoubleClickEvent(
+ GraphViewer.this, getSelection());
+ fireDoubleClick(doubleClickEvent);
+ }
+
+ public void mouseDown(MouseEvent e) {
+
+ }
+
+ public void mouseUp(MouseEvent e) {
+
+ }
+
+ });
+ }
+
+ protected void inputChanged(Object input, Object oldInput) {
+ graph.setDynamicLayout(false);
+ super.inputChanged(input, oldInput);
+ graph.setDynamicLayout(true);
+ graph.applyLayout();
+ }
+
+ /**
+ * Gets the styles for this structuredViewer
+ *
+ * @return
+ */
+ public int getStyle() {
+ return this.graph.getStyle();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.zest.core.viewer.internal.AbstractStructuredGraphViewer#
+ * getGraphControl()
+ */
+ public Graph getGraphControl() {
+ return super.getGraphControl();
+ };
+
+ /**
+ * Sets the layout algorithm to use for this viewer.
+ *
+ * @param algorithm
+ * the algorithm to layout the nodes
+ * @param runLayout
+ * if the layout should be run
+ */
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm, boolean runLayout) {
+ graph.setLayoutAlgorithm(algorithm, runLayout);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.zest.core.viewer.internal.AbstractStructuredGraphViewer#
+ * setLayoutAlgorithm(org.eclipse.zest.layouts.LayoutAlgorithm)
+ */
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm) {
+ super.setLayoutAlgorithm(algorithm);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer#setNodeStyle
+ * (int)
+ */
+ public void setNodeStyle(int nodeStyle) {
+ super.setNodeStyle(nodeStyle);
+ this.graph.setNodeStyle(nodeStyle);
+ }
+
+ public void setContentProvider(IContentProvider contentProvider) {
+ if (contentProvider instanceof IGraphContentProvider) {
+ super.setContentProvider(contentProvider);
+ } else if (contentProvider instanceof IGraphEntityContentProvider) {
+ super.setContentProvider(contentProvider);
+ } else if (contentProvider instanceof IGraphEntityRelationshipContentProvider) {
+ super.setContentProvider(contentProvider);
+ } else {
+ throw new IllegalArgumentException(
+ "Invalid content provider, only IGraphContentProvider, IGraphEntityContentProvider, or IGraphEntityRelationshipContentProvider are supported.");
+ }
+ }
+
+ /**
+ * Finds the graph widget item for a given user model item.
+ *
+ * Note: This method returns an internal interface (GraphItem). You should
+ * be able to cast this to either a IGraphModelNode or IGraphModelConnection
+ * (which are also internal). These are internal because this API is not
+ * stable. If use this method (to access internal nodes and edges), your
+ * code may not compile between versions.
+ *
+ * @param The
+ * user model node.
+ * @return An IGraphItem. This should be either a IGraphModelNode or
+ * IGraphModelConnection
+ */
+ public GraphItem findGraphItem(Object element) {
+ Widget[] result = findItems(element);
+ return (result.length == 0 || !(result[0] instanceof GraphItem)) ? null
+ : (GraphItem) result[0];
+ }
+
+ /**
+ * Applys the current layout to the viewer
+ */
+ public void applyLayout() {
+ graph.applyLayout();
+ }
+
+ protected void setSelectionToWidget(List l, boolean reveal) {
+ GraphItem[] listOfItems = findItems(l);
+ graph.setSelection(listOfItems);
+ }
+
+ public Control getControl() {
+ return graph;
+ }
+
+ public Object[] getNodeElements() {
+ return super.getNodeElements();
+ }
+
+ public Object[] getConnectionElements() {
+ return super.getConnectionElements();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.viewer.internal.AbstractStructuredGraphViewer#reveal
+ * (java.lang.Object)
+ */
+ public void reveal(Object element) {
+ super.reveal(element);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.zest.core.viewer.internal.AbstractStructuredGraphViewer#
+ * setConnectionStyle(int)
+ */
+ public void setConnectionStyle(int connectionStyle) {
+ super.setConnectionStyle(connectionStyle);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.viewer.internal.AbstractStructuredGraphViewer#unReveal
+ * (java.lang.Object)
+ */
+ public void unReveal(Object element) {
+ super.unReveal(element);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ if (!selectionChangedListeners.contains(listener)) {
+ selectionChangedListeners.add(listener);
+ }
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ if (selectionChangedListeners.contains(listener)) {
+ selectionChangedListeners.remove(listener);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * NOTE: If a layout algorithm is set in the receiver, layout is performed
+ * after the refresh.
+ */
+ public void refresh(Object element) {
+ boolean dynamicLayoutEnabled = graph.isDynamicLayoutEnabled();
+ graph.setDynamicLayout(false);
+ super.refresh(element);
+ graph.setDynamicLayout(dynamicLayoutEnabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * NOTE: If a layout algorithm is set in the receiver, layout is performed
+ * after the refresh.
+ */
+ public void refresh(Object element, boolean updateLabels) {
+ boolean dynamicLayoutEnabled = graph.isDynamicLayoutEnabled();
+ graph.setDynamicLayout(false);
+ super.refresh(element, updateLabels);
+ graph.setDynamicLayout(dynamicLayoutEnabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * NOTE: If a layout algorithm is set in the receiver, layout is performed
+ * after the update.
+ */
+ public void update(Object element, String[] properties) {
+ boolean dynamicLayoutEnabled = graph.isDynamicLayoutEnabled();
+ graph.setDynamicLayout(false);
+ super.update(element, properties);
+ graph.setDynamicLayout(dynamicLayoutEnabled);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * NOTE: If a layout algorithm is set in the receiver, layout is performed
+ * after the update.
+ */
+ public void update(Object[] elements, String[] properties) {
+ boolean dynamicLayoutEnabled = graph.isDynamicLayoutEnabled();
+ graph.setDynamicLayout(false);
+ super.update(elements, properties);
+ graph.setDynamicLayout(dynamicLayoutEnabled);
+ }
+
+ // @tag zest.bug.156286-Zooming.fix.experimental : expose the zoom manager
+ // for new actions.
+ protected ZoomManager getZoomManager() {
+ if (zoomManager == null) {
+ zoomManager = new ZoomManager(getGraphControl().getRootLayer(),
+ getGraphControl().getViewport());
+ }
+ return zoomManager;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer#getFactory()
+ * @noreference This method is not intended to be referenced by clients.
+ * @nooverride This method is not intended to be re-implemented or extended
+ * by clients.
+ */
+ protected IStylingGraphModelFactory getFactory() {
+ if (modelFactory == null) {
+ if (getContentProvider() instanceof IGraphContentProvider) {
+ modelFactory = new GraphModelFactory(this);
+ } else if (getContentProvider() instanceof IGraphEntityContentProvider) {
+ modelFactory = new GraphModelEntityFactory(this);
+ } else if (getContentProvider() instanceof IGraphEntityRelationshipContentProvider) {
+ modelFactory = new GraphModelEntityRelationshipFactory(this);
+ }
+ }
+ return modelFactory;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.zest.core.viewers.AbstractStructuredGraphViewer#
+ * getLayoutAlgorithm()
+ */
+ protected LayoutAlgorithm getLayoutAlgorithm() {
+ return graph.getLayoutAlgorithm();
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleBezierExtension.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleBezierExtension.java
new file mode 100644
index 0000000..41ed0ca
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleBezierExtension.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * An extension to the IConnectinStyleProvider that allows styling specific to
+ * bezier curves.
+ *
+ * Bezier curves are defined by a set of four points: two point in the layout
+ * (start and end), and two related control points (also start and end). The
+ * control points are defined relative to their corresponding layout point. This
+ * definition includes an angle between the layout point and the line between
+ * the two layout points, as well as a ratio distance from the corresponding
+ * layout point. The ratio distance is defined as a fraction between 0 and 1 of
+ * the distance between the two layout points. Using this definition allows
+ * bezier curves to have a consistant look regardless of the actual positions of
+ * the nodes in the layouts.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag bug(152530-Bezier(fix)) : users can style bezier curves.
+public interface IConnectionStyleBezierExtension {
+
+ /**
+ * Gets the angle between the start point, and the line between the start
+ * and end, which will define the position of the start control point. If
+ * the start angle, and the end angle are the same sign, the two control
+ * points are guaranteed to be on the same side of the line.
+ *
+ * @param rel
+ * the relationship to base on.
+ * @return the start angle or <code>Double.NaN</code> for defaults.
+ */
+ double getStartAngle(Object rel);
+
+ /**
+ * Gets the angle between the end point, and the line between the start and
+ * end, which will define the position of the end control point. If the
+ * start angle, and the end angle are the same sign, the two control points
+ * are guaranteed to be on the same side of the line.
+ *
+ * @param rel
+ * the relationship to base on.
+ * @return the end angle or <code>Double.NaN</code> for defaults.
+ */
+ double getEndAngle(Object rel);
+
+ /**
+ * Gets the distance between the start point and the start control point, as
+ * a fraction of the distance between the start point and end point.
+ *
+ * @param rel
+ * the relationship to base on.
+ * @return the start distance or <code>Double.NaN</code> for defaults.
+ */
+ double getStartDistance(Object rel);
+
+ /**
+ * Gets the distance between the end point and the end control point, as a
+ * fraction of the distance between the start point and end point.
+ *
+ * @param rel
+ * the relationship to base on.
+ * @return the end distance or <code>Double.NaN</code> for defaults.
+ */
+ double getEndDistance(Object rel);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleProvider.java
new file mode 100644
index 0000000..92d5c72
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IConnectionStyleProvider.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.services.IDisposable;
+
+/**
+ * An extension to label providers, to supply styles for connections based upon
+ * relationships, rather than on connected nodes.
+ *
+ * @author Del Myers
+ * @see #IGraphContentProvider
+ * @see #IEntityStyleProvider
+ *
+ */
+// @tag bug(151327-Styles) : created to solve this bug
+public interface IConnectionStyleProvider extends IDisposable {
+ /**
+ * Returns the style flags for this connection. Valid flags are those that
+ * begin with CONNECTION in @see org.eclipse.zest.core.ZestStyles. Check
+ * ZestStyles for legal combinations.
+ *
+ * @param rel
+ * the relationship represented by this connection.
+ * @return the style flags for this connection.
+ * @see org.eclipse.zest.core.widgets.ZestStyles
+ */
+ public int getConnectionStyle(Object rel);
+
+ /**
+ * Returns the color for the connection. Null for default. Any resources
+ * created by this class must be disposed by this class.
+ *
+ * @param rel
+ * the relationship represented by this connection.
+ * @return the color.
+ * @see #dispose()
+ */
+ public Color getColor(Object rel);
+
+ /**
+ * Returns the highlighted color for this connection. Null for default. Any
+ * resources created by this class must be disposed by this class.
+ *
+ * @param rel
+ * the relationship represented by this connection.
+ * @return the highlighted color. Null for default.
+ * @see #dispose()
+ */
+ public Color getHighlightColor(Object rel);
+
+ /**
+ * Returns the line width of the connection. -1 for default.
+ *
+ * @param rel
+ * the relationship represented by this connection.
+ * @return the line width for the connection. -1 for default.
+ */
+ public int getLineWidth(Object rel);
+
+ /**
+ * Returns the tooltop for this node. If null is returned Zest will simply
+ * use the default tooltip.
+ *
+ * @param entity
+ * @return
+ */
+ public IFigure getTooltip(Object entity);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleBezierExtension.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleBezierExtension.java
new file mode 100644
index 0000000..16aa721
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleBezierExtension.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * An extension to the IEntityConnectinStyleProvider that allows styling
+ * specific to bezier curves.
+ *
+ * Bezier curves are defined by a set of four points: two point in the layout
+ * (start and end), and two related control points (also start and end). The
+ * control points are defined relative to their corresponding layout point. This
+ * definition includes an angle between the layout point and the line between
+ * the two layout points, as well as a ratio distance from the corresponding
+ * layout point. The ratio distance is defined as a fraction between 0 and 1 of
+ * the distance between the two layout points. Using this definition allows
+ * bezier curves to have a consistant look regardless of the actual positions of
+ * the nodes in the layouts.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag zest(bug(152530-Bezier(fix))) : users can style bezier curves.
+interface IEntityConnectionStyleBezierExtension {
+
+ /**
+ * Gets the angle between the start point, and the line between the start
+ * and end, which will define the position of the start control point. If
+ * the start angle, and the end angle are the same sign, the two control
+ * points are guaranteed to be on the same side of the line.
+ *
+ * @param source
+ * the source node to base on.
+ * @param dest
+ * the destination node to base on.
+ * @return the start angle or <code>Double.NaN</code> for defaults.
+ */
+ double getStartAngle(Object source, Object dest);
+
+ /**
+ * Gets the angle between the end point, and the line between the start and
+ * end, which will define the position of the end control point. If the
+ * start angle, and the end angle are the same sign, the two control points
+ * are guaranteed to be on the same side of the line.
+ *
+ * @param source
+ * the source node to base on.
+ * @param dest
+ * the destination node to base on.
+ * @return the end angle or <code>Double.NaN</code> for defaults.
+ */
+ double getEndAngle(Object source, Object dest);
+
+ /**
+ * Gets the distance between the start point and the start control point, as
+ * a fraction of the distance between the start point and end point.
+ *
+ * @param source
+ * the source node to base on.
+ * @param dest
+ * the destination node to base on.
+ * @return the start distance or <code>Double.NaN</code> for defaults.
+ */
+ double getStartDistance(Object source, Object dest);
+
+ /**
+ * Gets the distance between the end point and the end control point, as a
+ * fraction of the distance between the start point and end point.
+ *
+ * @param source
+ * the source node to base on.
+ * @param dest
+ * the destination node to base on.
+ * @return the end distance or <code>Double.NaN</code> for defaults.
+ */
+ double getEndDistance(Object source, Object dest);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleProvider.java
new file mode 100644
index 0000000..a418930
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityConnectionStyleProvider.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.services.IDisposable;
+
+/**
+ * An extension for label providers which allows users to set styles for
+ * connections that are based on entity end points.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag bug(151327-Styles) : fix
+public interface IEntityConnectionStyleProvider extends IDisposable {
+
+ /**
+ * Returns the style flags for this connection. Valid flags are those that
+ * begin with CONNECTION in @see org.eclipse.zest.core.ZestStyles. Check
+ * ZestStyles for legal combinations.
+ *
+ * @param src
+ * the source entity.
+ * @param dest
+ * the destination entity.
+ * @return the style flags for this connection.
+ * @see org.eclipse.zest.core.widgets.ZestStyles
+ */
+ public int getConnectionStyle(Object src, Object dest);
+
+ /**
+ * Returns the color for the connection. Null for default.
+ *
+ * @param src
+ * the source entity. Any resources created by this class must be
+ * disposed by this class.
+ * @param dest
+ * the destination entity.
+ * @return the color.
+ * @see #dispose()
+ */
+ public Color getColor(Object src, Object dest);
+
+ /**
+ * Returns the highlighted color for this connection. Null for default.
+ *
+ * @param src
+ * the source entity. Any resources created by this class must be
+ * disposed by this class.
+ * @param dest
+ * the destination entity.
+ * @return the highlighted color. Null for default.
+ * @see #dispose()
+ */
+ public Color getHighlightColor(Object src, Object dest);
+
+ /**
+ * Returns the line width of the connection. -1 for default.
+ *
+ * @param src
+ * the source entity.
+ * @param dest
+ * the destination entity.
+ * @return the line width for the connection. -1 for default.
+ */
+ public int getLineWidth(Object src, Object dest);
+
+ /**
+ * Returns the tooltop for this node. If null is returned Zest will simply
+ * use the default tooltip.
+ *
+ * @param entity
+ * @return
+ */
+ public IFigure getTooltip(Object entity);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityStyleProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityStyleProvider.java
new file mode 100644
index 0000000..a222b7a
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IEntityStyleProvider.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.services.IDisposable;
+
+/**
+ * An extension to Label providers for graphs. Gets specific details about the
+ * style of an entity before it is created. This style provider offers:
+ *
+ * -Background and forground colours -Hilighted and unhighlighted colours
+ * (colours defined by selections). -Border color. -Highlighted and
+ * unhighlighted colours for borders. -Border width -Font for text inside the
+ * entity.
+ *
+ * Any method may return null if the Zest defaults are preferred.
+ *
+ * NOTE: It is up to the implementors of this interface to dispose of any Colors
+ * or Fonts that are created by this class. The dispose() method will be called
+ * at the end of the entity's life-cycle so that this class may dispose of its
+ * resources.
+ *
+ * @author Del Myers
+ * @see org.eclipse.jface.viewers.IColorProvider
+ * @tag bug(151327-Styles) : created to solve this bug
+ */
+public interface IEntityStyleProvider extends IDisposable {
+
+ /**
+ * Returns the forground colour of this entity. May return null for
+ * defaults. Any resources created by this class must be disposed by this
+ * class.
+ *
+ * @param entity
+ * the entity to be styled.
+ * @return the forground colour of this entity.
+ * @see #dispose()
+ */
+ public Color getNodeHighlightColor(Object entity);
+
+ /**
+ * Returns the background colour for this entity. May return null for
+ * defaults. Any resources created by this class must be disposed by this
+ * class.
+ *
+ * @param entity
+ * the entity to be styled.
+ * @return the background colour for this entity.
+ * @see #dispose()
+ */
+ public Color getBorderColor(Object entity);
+
+ /**
+ * Returns the border highlight colour for this entity. May return null for
+ * defaults. Any resources created by this class must be disposed by this
+ * class.
+ *
+ * @param entity
+ * the entity to be styled.
+ * @return the border highlight colour for this entity.
+ * @see #dispose()
+ */
+ public Color getBorderHighlightColor(Object entity);
+
+ /**
+ * Returns the border width for this entity. May return -1 for defaults.
+ *
+ * @param entity
+ * the entity to be styled.
+ * @return the border width, or -1 for defaults.
+ */
+ public int getBorderWidth(Object entity);
+
+ /**
+ * Returns true iff the adjacent entities should be highlighted when this
+ * node is selected. Zest's default action is true.
+ *
+ * @return true iff the adjacent entities should be highlighted when this
+ * node is selected.
+ */
+ // @tag ADJACENT : Removed highlight adjacent
+ // public boolean highlightAdjacentEntities(Object entity);
+ /**
+ * Returns the color that adjacent entities will be drawn when this entity
+ * is selected. Will be ignored if HighlightAdjacentEntities() returns
+ * false. May return null for defaults. Any resources created by this class
+ * must be disposed by this class.
+ *
+ * @param entity
+ * the entity to be styled.
+ * @return the color for adjacent entities.
+ * @see #highlightAdjacentEntities(Object entity)
+ * @see #dispose()
+ */
+ // @tag ADJACENT : Removed highlight adjacent
+ // public Color getAdjacentEntityHighlightColor(Object entity);
+ /**
+ * Returns the colour that this node should be coloured. This will be
+ * ignored if getNodeColour returns null. Any resources created by this
+ * class must be diposed by this class.
+ *
+ * @param entity
+ * The entity to be styled
+ * @return The colour for the node
+ * @see #dispose()
+ */
+ public Color getBackgroundColour(Object entity);
+
+ public Color getForegroundColour(Object entity);
+
+ /**
+ * Returns the tooltop for this node. If null is returned Zest will simply
+ * use the default tooltip.
+ *
+ * @param entity
+ * @return
+ */
+ public IFigure getTooltip(Object entity);
+
+ public boolean fisheyeNode(Object entity);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IFigureProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IFigureProvider.java
new file mode 100644
index 0000000..49af9c9
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IFigureProvider.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 EclipseSource and others. 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:
+ * EclipseSource - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.draw2d.IFigure;
+
+/**
+ * Allows a user to create a figure for an element in graph model. To use this
+ * interface, it should be implemented and passed to
+ * {@link GraphViewer#setLabelProvider()}
+ */
+public interface IFigureProvider {
+
+ /**
+ * Creates a custom figure for a graph model element
+ */
+ public IFigure getFigure(Object element);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphContentProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphContentProvider.java
new file mode 100644
index 0000000..7fda779
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphContentProvider.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+
+/**
+ * A graph content provider.
+ *
+ * @author Ian Bull
+ */
+public interface IGraphContentProvider extends IStructuredContentProvider {
+
+ /**
+ * Gets the source Object for the given relationship. Note, at least one of
+ * the source or destination must not be null. If both are null, then
+ * nothing can be displayed in the graph (a relationship cannot exist
+ * without nodes to be connected to). However, if one of getSource() or
+ * getDestination() returns null, then the resulting graph will contain an
+ * unconnected node for the non-null object returned from the other method.
+ *
+ * @param rel
+ * the relationship.
+ * @return the source, or null for an unconnected destination.
+ */
+ public Object getSource(Object rel);
+
+ /**
+ * Gets the target Object for the given relationship. Note, at least one of
+ * the source or destination must not be null. If both are null, then
+ * nothing can be displayed in the graph (a relationship cannot exist
+ * without nodes to be connected to). However, if one of getSource() or
+ * getDestination() returns null, then the resulting graph will contain an
+ * unconnected node for the non-null object returned from the other method.
+ *
+ * @param rel
+ * the relationship.
+ * @return the destination, or null for an unconnected source.
+ */
+ public Object getDestination(Object rel);
+
+ /**
+ * Returns all the relationships in the graph for the given input.
+ *
+ * @input the input model object.
+ * @return all the relationships in the graph for the given input.
+ */
+ public Object[] getElements(Object input);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityContentProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityContentProvider.java
new file mode 100644
index 0000000..5d5e57b
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityContentProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+
+/**
+ *
+ * @author Ian Bull
+ *
+ */
+public interface IGraphEntityContentProvider extends IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement);
+
+ /**
+ * Gets the elements this object is connected to
+ *
+ * @param entity
+ * @return
+ */
+ public Object[] getConnectedTo(Object entity);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityRelationshipContentProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityRelationshipContentProvider.java
new file mode 100644
index 0000000..5ed24a3
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IGraphEntityRelationshipContentProvider.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+
+/**
+ * A content provider that is node-relationship centric. Call-backs return model
+ * nodes to the user, and ask for relationships. Both nodes and relationships
+ * are represented by the user's model.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag bug.154580-Content.fix : new content provider that returns relationships
+// for the given source and destination.
+public interface IGraphEntityRelationshipContentProvider extends
+ IStructuredContentProvider {
+ /**
+ * Gets the relationships between the given source and destination nodes.
+ *
+ * @param source
+ * the source node.
+ * @param dest
+ * the destination node.
+ * @return objects represtenting the different relationships between the
+ * nodes.
+ */
+ public Object[] getRelationships(Object source, Object dest);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/INestedContentProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/INestedContentProvider.java
new file mode 100644
index 0000000..a6a82cc
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/INestedContentProvider.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 EclipseSource and others. 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:
+ * EclipseSource - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * A content provider for nested graphs. Any entity based content provider
+ * (IGraphEntityContentProvider or IGraphEntityRelationshipContentProvider) can
+ * also implement this interface. Any node that "hasChildren" will be rendered
+ * as a container.
+ *
+ * Note: Containers cannot contain other containers.
+ *
+ * @author irbull
+ */
+public interface INestedContentProvider {
+
+ /**
+ * Does the current node have children? If so, it will be rendered as a
+ * container.
+ *
+ * @param element
+ * The current node
+ * @return True if it has children, false otherwise
+ */
+ public boolean hasChildren(Object element);
+
+ /**
+ * Gets the children of this node. This method will not be called if
+ * hasChildren returns false.
+ *
+ * @param element
+ * The current node
+ * @return The list of children for this node.
+ */
+ public Object[] getChildren(Object element);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ISelfStyleProvider.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ISelfStyleProvider.java
new file mode 100644
index 0000000..4039023
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ISelfStyleProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 EclipseSource and others. 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: EclipseSource - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * Provides a mechanism to style nodes and edges when they are created.
+ *
+ * After each node or edge is created, the self styling method will be called
+ * with both the element and the widget.
+ */
+public interface ISelfStyleProvider {
+
+ /**
+ * Styles a connection
+ */
+ public void selfStyleConnection(Object element, GraphConnection connection);
+
+ /**
+ * Styles a node
+ */
+ public void selfStyleNode(Object element, GraphNode node);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IZoomableWorkbenchPart.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IZoomableWorkbenchPart.java
new file mode 100644
index 0000000..f977988
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/IZoomableWorkbenchPart.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * An interface that can be added to IWorkbenchParts based on ZEST views so that
+ * zooming is supported.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag bug.156286-Zooming.fix : experimental
+public interface IZoomableWorkbenchPart {
+ /**
+ * Returns the viewer that is zoomable.
+ *
+ * @return the viewer that is zoomable.
+ */
+ AbstractZoomableViewer getZoomableViewer();
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomContributionViewItem.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomContributionViewItem.java
new file mode 100644
index 0000000..31223a2
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomContributionViewItem.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.CoolItem;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+/**
+ * A contribution item that adds a combo to a toolbar or coolbar, or a list of
+ * zooms to a menu. Can only be used for one toolbar, coolbar, or menu.
+ *
+ * In order to use this item, let your workbench part implement
+ * IZoomableWorkbenchPart. If the workbench part then supplies a viewer that is
+ * zoomable, the combo or menu created by this item will be enabled.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag zest.bug.156286-Zooming.fix : create a contribution item that can set
+// zooming on Zest views.
+public class ZoomContributionViewItem extends ContributionItem implements
+ ZoomListener {
+ /**
+ * Zooms to fit the width.
+ */
+ public static final String FIT_WIDTH = ZoomManager.FIT_WIDTH;
+ /**
+ * Zooms to fit the height.
+ */
+ public static final String FIT_HEIGHT = ZoomManager.FIT_HEIGHT;
+ /**
+ * Zooms to fit entirely within the viewport.
+ */
+ public static final String FIT_ALL = ZoomManager.FIT_ALL;
+
+ private String[] zoomLevels;
+ private ZoomManager zoomManager;
+ private Combo combo;
+ private Menu fMenu;
+ private MenuAdapter menuAdapter = new MenuAdapter() {
+ public void menuShown(MenuEvent e) {
+ refresh(true);
+ }
+ };
+
+ /**
+ * Creates a new contribution item that will work on the given part
+ * service.initialZooms will be used to populate the combo or the menu.
+ * Valid values for initialZooms are percentage numbers (e.g., "100%"), or
+ * FIT_WIDTH, FIT_HEIGHT, FIT_ALL.
+ *
+ * @param partService
+ * service used to see whether the view is zoomable.
+ */
+ public ZoomContributionViewItem(IZoomableWorkbenchPart part) {
+ zoomManager = part.getZoomableViewer().getZoomManager();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets
+ * .Menu, int)
+ */
+ public void fill(Menu menu, int index) {
+ if (this.fMenu == null || this.fMenu != menu) {
+ if (this.fMenu != null) {
+ this.fMenu.removeMenuListener(menuAdapter);
+ this.fMenu = null;
+ }
+ this.fMenu = menu;
+ menu.addMenuListener(menuAdapter);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets
+ * .CoolBar, int)
+ */
+ public void fill(CoolBar parent, int index) {
+ CoolItem item = new CoolItem(parent, SWT.DROP_DOWN);
+ Combo combo = createCombo(parent);
+ item.setControl(combo);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets
+ * .ToolBar, int)
+ */
+ public void fill(ToolBar parent, int index) {
+ ToolItem item = new ToolItem(parent, SWT.DROP_DOWN);
+ Combo combo = createCombo(parent);
+ item.setControl(combo);
+ }
+
+ private Combo createCombo(Composite parent) {
+ this.combo = new Combo(parent, SWT.DROP_DOWN);
+ this.combo.setItems(zoomLevels);
+ this.combo.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ int selection = combo.getSelectionIndex();
+ if (selection > 0) {
+ doZoom(combo.getItem(selection));
+ } else {
+ doZoom(combo.getItem(0));
+ }
+ }
+ });
+ return this.combo;
+ }
+
+ private void doZoom(String zoom) {
+ if (zoomManager != null) {
+ zoomManager.setZoomAsText(zoom);
+ }
+ }
+
+ private void refresh(boolean rebuild) {
+ //
+ if (combo != null && !combo.isDisposed()) {
+ refreshCombo(rebuild);
+ } else if (fMenu != null && !fMenu.isDisposed()) {
+ refreshMenu(rebuild);
+ }
+ }
+
+ /**
+ * @param rebuild
+ */
+ private void refreshMenu(boolean rebuild) {
+ fMenu.setEnabled(false);
+ if (zoomManager == null) {
+ return;
+ }
+ if (rebuild) {
+ zoomLevels = zoomManager.getZoomLevelsAsText();
+ MenuItem[] oldItems = fMenu.getItems();
+ for (int i = 0; i < oldItems.length; i++) {
+ if (oldItems[i].getData() == this) {
+ oldItems[i].dispose();
+ }
+ }
+ for (int i = 0; i < zoomLevels.length; i++) {
+ MenuItem item = new MenuItem(fMenu, SWT.RADIO);
+ item.setText(zoomLevels[i]);
+ item.setData(this);
+ item.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MenuItem source = (MenuItem) e.getSource();
+ doZoom(source.getText());
+ }
+ });
+ }
+ }
+ String zoom = zoomManager.getZoomAsText();
+ MenuItem[] items = fMenu.getItems();
+ for (int i = 0; i < items.length; i++) {
+ MenuItem item = items[i];
+ if (item.getData() == this) {
+ item.setSelection(false);
+ if (zoom.equalsIgnoreCase(item.getText())) {
+ item.setSelection(true);
+ }
+ }
+ }
+ fMenu.setEnabled(true);
+ }
+
+ /**
+ * @param rebuild
+ */
+ private void refreshCombo(boolean rebuild) {
+ combo.setEnabled(false);
+ if (zoomManager == null) {
+ return;
+ }
+ if (rebuild) {
+ combo.setItems(zoomManager.getZoomLevelsAsText());
+ }
+ String zoom = zoomManager.getZoomAsText();
+ int index = combo.indexOf(zoom);
+ if (index > 0) {
+ combo.select(index);
+ }
+ combo.setEnabled(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.gef.editparts.ZoomListener#zoomChanged(double)
+ */
+ public void zoomChanged(double z) {
+ refresh(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.ContributionItem#dispose()
+ */
+
+ public void dispose() {
+ if (combo != null) {
+ combo = null;
+ }
+ if (fMenu != null) {
+ fMenu = null;
+ }
+ // @tag zest.bug.159667-ZoomDispose : make sure that we no longer listen
+ // to the part service.
+ super.dispose();
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomListener.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomListener.java
new file mode 100644
index 0000000..ea86ef5
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomListener.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others. 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: IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+/**
+ * Listens to zoom level changes.
+ *
+ * @author Eric Bordeau
+ * @since 2.0
+ */
+public interface ZoomListener {
+
+ /**
+ * Called whenever the ZoomManager's zoom level changes.
+ *
+ * @param zoom
+ * the new zoom level.
+ */
+ void zoomChanged(double zoom);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomManager.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomManager.java
new file mode 100644
index 0000000..cf97e90
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/ZoomManager.java
@@ -0,0 +1,611 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others. 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: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.FreeformFigure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.draw2d.ScalableFreeformLayeredPane;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.viewers.internal.SharedMessages;
+
+/**
+ * Manage the primary zoom function in a graphical viewer. This class is used by
+ * the zoom contribution items, including:
+ * <UL>
+ * <LI>{@link org.eclipse.gef.ui.actions.ZoomInAction}
+ * <LI>{@link org.eclipse.gef.ui.actions.ZoomOutAction}
+ * <LI>and {@link org.eclipse.gef.ui.actions.ZoomComboContributionItem}
+ * </UL>
+ * <P>
+ * A ZoomManager controls how zoom in and zoom out are performed. It also
+ * determines the list of choices the user sees in the drop-down Combo on the
+ * toolbar. The zoom manager controls a <code>ScalableFigure</code>, which
+ * performs the actual zoom, and also a <code>Viewport</code>. The viewport is
+ * needed so that the scrolled location is preserved as the zoom level changes.
+ * <p>
+ * <b>NOTE:</b> For the settings of {@link #FIT_ALL Page}, {@link #FIT_WIDTH
+ * Width} and {@link #FIT_HEIGHT Height} to work properly, the given
+ * <code>Viewport</code> should have its scrollbars always visible or never
+ * visible. Otherwise, these settings may cause undesired effects.
+ *
+ * @author Dan Lee
+ * @author Eric Bordeau
+ * @since 2.0
+ */
+public class ZoomManager {
+
+ /** Style bit meaning don't animate any zooms */
+ public static final int ANIMATE_NEVER = 0;
+ /** Style bit meaning animate during {@link #zoomIn()} and {@link #zoomOut()} */
+ public static final int ANIMATE_ZOOM_IN_OUT = 1;
+
+ private List listeners = new ArrayList();
+
+ private double multiplier = 1.0;
+ private ScalableFigure pane;
+ private Viewport viewport;
+ private double zoom = 1.0;
+ // private int zoomAnimationStyle = ANIMATE_NEVER;
+ private String currentZoomContant = null;
+ private double[] zoomLevels = { .5, .75, 1.0, 1.5, 2.0, 2.5, 3, 4 };
+
+ /**
+ * String constant for the "Height" zoom level. At this zoom level, the zoom
+ * manager will adopt a zoom setting such that the entire height of the
+ * diagram will be visible on the screen.
+ */
+ public static final String FIT_HEIGHT = SharedMessages.FitHeightAction_Label;
+ /**
+ * String constant for the "Width" zoom level. At this zoom level, the zoom
+ * manager will adopt a zoom setting such that the entire width of the
+ * diagram will be visible on the screen.
+ */
+ public static final String FIT_WIDTH = SharedMessages.FitWidthAction_Label;
+ /**
+ * String constant for the "Page" zoom level. At this zoom level, the zoom
+ * manager will adopt a zoom setting such that the entire diagram will be
+ * visible on the screen.
+ */
+ public static final String FIT_ALL = SharedMessages.FitAllAction_Label;
+ private List zoomLevelContributions = Collections.EMPTY_LIST;
+
+ //DecimalFormat format = new DecimalFormat("####%"); //$NON-NLS-1$
+
+ /**
+ * Creates a new ZoomManager.
+ *
+ * @param pane
+ * The ScalableFigure associated with this ZoomManager
+ * @param viewport
+ * The Viewport assoicated with this ZoomManager
+ */
+ public ZoomManager(ScalableFigure pane, Viewport viewport) {
+ this.pane = pane;
+ this.viewport = viewport;
+ zoomLevelContributions = new ArrayList();
+ zoomLevelContributions.add(FIT_ALL);
+ }
+
+ /**
+ * @deprecated Use {@link #ZoomManager(ScalableFigure, Viewport)} instead.
+ * Creates a new ZoomManager
+ * @param pane
+ * The ScalableFreeformLayeredPane associated with this
+ * ZoomManager
+ * @param viewport
+ * The Viewport assoicated with this viewport
+ */
+ public ZoomManager(ScalableFreeformLayeredPane pane, Viewport viewport) {
+ this.pane = pane;
+ this.viewport = viewport;
+ }
+
+ /**
+ * Adds the given ZoomListener to this ZoomManager's list of listeners.
+ *
+ * @param listener
+ * the ZoomListener to be added
+ */
+ public void addZoomListener(ZoomListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * returns <code>true</code> if the zoommanager can perform
+ * <code>zoomIn()</code>.
+ *
+ * @return boolean true if zoomIn can be called
+ */
+ public boolean canZoomIn() {
+ return getZoom() < getMaxZoom();
+ }
+
+ /**
+ * returns <code>true</code> if the zoommanager can perform
+ * <code>zoomOut()</code>.
+ *
+ * @return boolean true if zoomOut can be called
+ */
+ public boolean canZoomOut() {
+ return getZoom() > getMinZoom();
+ }
+
+ /**
+ * Notifies listeners that the zoom level has changed.
+ */
+ protected void fireZoomChanged() {
+ Iterator iter = listeners.iterator();
+ while (iter.hasNext()) {
+ ((ZoomListener) iter.next()).zoomChanged(zoom);
+ }
+ }
+
+ private double getFitXZoomLevel(int which) {
+ IFigure fig = getScalableFigure();
+
+ Dimension available = getViewport().getClientArea().getSize();
+ Dimension desired;
+ if (fig instanceof FreeformFigure) {
+ desired = ((FreeformFigure) fig).getFreeformExtent().getCopy()
+ .union(0, 0).getSize();
+ } else {
+ desired = fig.getPreferredSize().getCopy();
+ }
+
+ desired.width -= fig.getInsets().getWidth();
+ desired.height -= fig.getInsets().getHeight();
+
+ while (fig != getViewport()) {
+ available.width -= fig.getInsets().getWidth();
+ available.height -= fig.getInsets().getHeight();
+ fig = fig.getParent();
+ }
+
+ double scaleX = Math.min(available.width * zoom / desired.width,
+ getMaxZoom());
+ double scaleY = Math.min(available.height * zoom / desired.height,
+ getMaxZoom());
+ if (which == 0) {
+ return scaleX;
+ }
+ if (which == 1) {
+ return scaleY;
+ }
+ return Math.min(scaleX, scaleY);
+ }
+
+ /**
+ * Calculates and returns the zoom percent required so that the entire
+ * height of the {@link #getScalableFigure() scalable figure} is visible on
+ * the screen. This is the zoom level associated with {@link #FIT_HEIGHT}.
+ *
+ * @return zoom setting required to fit the scalable figure vertically on
+ * the screen
+ */
+ protected double getFitHeightZoomLevel() {
+ return getFitXZoomLevel(1);
+ }
+
+ /**
+ * Calculates and returns the zoom percentage required to fit the entire
+ * {@link #getScalableFigure() scalable figure} on the screen. This is the
+ * zoom setting associated with {@link #FIT_ALL}. It is the minimum of
+ * {@link #getFitHeightZoomLevel()} and {@link #getFitWidthZoomLevel()}.
+ *
+ * @return zoom setting required to fit the entire scalable figure on the
+ * screen
+ */
+ protected double getFitPageZoomLevel() {
+ return getFitXZoomLevel(2);
+ }
+
+ /**
+ * Calculates and returns the zoom percentage required so that the entire
+ * width of the {@link #getScalableFigure() scalable figure} is visible on
+ * the screen. This is the zoom setting associated with {@link #FIT_WIDTH}.
+ *
+ * @return zoom setting required to fit the scalable figure horizontally on
+ * the screen
+ */
+ protected double getFitWidthZoomLevel() {
+ return getFitXZoomLevel(0);
+ }
+
+ /**
+ * Returns the maxZoom.
+ *
+ * @return double
+ */
+ public double getMaxZoom() {
+ return getZoomLevels()[getZoomLevels().length - 1];
+ }
+
+ /**
+ * Returns the minZoom.
+ *
+ * @return double
+ */
+ public double getMinZoom() {
+ return getZoomLevels()[0];
+ }
+
+ /**
+ * Returns the mutltiplier. This value is used to use zoom levels internally
+ * that are proportionally different than those displayed to the user. e.g.
+ * with a multiplier value of 2.0, the zoom level 1.0 will be displayed as
+ * "200%".
+ *
+ * @return double The multiplier
+ */
+ public double getUIMultiplier() {
+ return multiplier;
+ }
+
+ /**
+ * Returns the zoom level that is one level higher than the current level.
+ * If zoom level is at maximum, returns the maximum.
+ *
+ * @return double The next zoom level
+ */
+ public double getNextZoomLevel() {
+ for (int i = 0; i < zoomLevels.length; i++) {
+ if (zoomLevels[i] > zoom) {
+ return zoomLevels[i];
+ }
+ }
+ return getMaxZoom();
+ }
+
+ /**
+ * Returns the zoom level that is one level higher than the current level.
+ * If zoom level is at maximum, returns the maximum.
+ *
+ * @return double The previous zoom level
+ */
+ public double getPreviousZoomLevel() {
+ for (int i = 1; i < zoomLevels.length; i++) {
+ if (zoomLevels[i] >= zoom) {
+ return zoomLevels[i - 1];
+ }
+ }
+ return getMinZoom();
+ }
+
+ /**
+ * Returns the figure which performs the actual zooming.
+ *
+ * @return the scalable figure
+ */
+ public ScalableFigure getScalableFigure() {
+ return pane;
+ }
+
+ /**
+ * Returns the viewport.
+ *
+ * @return Viewport
+ */
+ public Viewport getViewport() {
+ return viewport;
+ }
+
+ /**
+ * Returns the current zoom level.
+ *
+ * @return double the zoom level
+ */
+ public double getZoom() {
+ return zoom;
+ }
+
+ private String format(double d) {
+ return "" + ((int) (d * 100)) + "%";
+ }
+
+ /**
+ * Returns the current zoom level as a percentage formatted String
+ *
+ * @return String The current zoom level as a String
+ */
+ public String getZoomAsText() {
+ if (currentZoomContant != null) {
+ return currentZoomContant;
+ }
+
+ // String newItem = format.format(zoom * multiplier);
+ String newItem = format(zoom * multiplier);
+ return newItem;
+ }
+
+ /**
+ * Returns the list of strings that should be appended to the list of
+ * numerical zoom levels. These could be things such as Fit Width, Fit Page,
+ * etc. May return <code>null</code>.
+ *
+ * @return the list of contributed zoom levels
+ */
+ public List getZoomLevelContributions() {
+ return zoomLevelContributions;
+ }
+
+ /**
+ * Returns the zoomLevels.
+ *
+ * @return double[]
+ */
+ public double[] getZoomLevels() {
+ return zoomLevels;
+ }
+
+ /**
+ * Returns the list of zoom levels as Strings in percent notation, plus any
+ * additional zoom levels that were contributed using
+ * {@link #setZoomLevelContributions(List)}.
+ *
+ * @return List The list of zoom levels
+ */
+ public String[] getZoomLevelsAsText() {
+ String[] zoomLevelStrings = new String[zoomLevels.length
+ + zoomLevelContributions.size()];
+
+ if (zoomLevelContributions != null) {
+ for (int i = 0; i < zoomLevelContributions.size(); i++) {
+ zoomLevelStrings[i] = (String) zoomLevelContributions.get(i);
+ }
+ }
+ for (int i = 0; i < zoomLevels.length; i++) {
+ // zoomLevelStrings[i + zoomLevelContributions.size()] =
+ // format.format(zoomLevels[i] * multiplier);
+ zoomLevelStrings[i + zoomLevelContributions.size()] = format(zoomLevels[i]
+ * multiplier);
+ }
+
+ return zoomLevelStrings;
+ }
+
+ /**
+ * Sets the zoom level to the given value. Min-max range check is not done.
+ *
+ * @param zoom
+ * the new zoom level
+ */
+ protected void primSetZoom(double zoom) {
+ Point p1 = getViewport().getClientArea().getCenter();
+ Point p2 = p1.getCopy();
+ Point p = getViewport().getViewLocation();
+ double prevZoom = this.zoom;
+ this.zoom = zoom;
+ pane.setScale(zoom);
+ fireZoomChanged();
+ getViewport().validate();
+
+ p2.scale(zoom / prevZoom);
+ Dimension dif = p2.getDifference(p1);
+ p.x += dif.width;
+ p.y += dif.height;
+ setViewLocation(p);
+ }
+
+ /**
+ * Removes the given ZoomListener from this ZoomManager's list of listeners.
+ *
+ * @param listener
+ * the ZoomListener to be removed
+ */
+ public void removeZoomListener(ZoomListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Sets the UI multiplier. The UI multiplier is applied to all zoom settings
+ * when they are presented to the user ({@link #getZoomAsText()}).
+ * Similarly, the multiplier is inversely applied when the user specifies a
+ * zoom level ({@link #setZoomAsText(String)}).
+ * <P>
+ * When the UI multiplier is <code>1.0</code>, the User will see the exact
+ * zoom level that is being applied. If the value is <code>2.0</code>, then
+ * a scale of <code>0.5</code> will be labeled "100%" to the User.
+ *
+ * @param multiplier
+ * The mutltiplier to set
+ */
+ public void setUIMultiplier(double multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ /**
+ * Sets the Viewport's view associated with this ZoomManager to the passed
+ * Point
+ *
+ * @param p
+ * The new location for the Viewport's view.
+ */
+ public void setViewLocation(Point p) {
+ viewport.setViewLocation(p.x, p.y);
+
+ }
+
+ /**
+ * Sets the zoom level to the given value. If the zoom is out of the min-max
+ * range, it will be ignored.
+ *
+ * @param zoom
+ * the new zoom level
+ */
+ public void setZoom(double zoom) {
+ currentZoomContant = null;
+ zoom = Math.min(getMaxZoom(), zoom);
+ zoom = Math.max(getMinZoom(), zoom);
+ if (this.zoom != zoom) {
+ primSetZoom(zoom);
+ }
+ }
+
+ /**
+ * Sets which zoom methods get animated.
+ *
+ * @param style
+ * the style bits determining the zoom methods to be animated.
+ */
+ public void setZoomAnimationStyle(int style) {
+ // zoomAnimationStyle = style;
+ }
+
+ /**
+ * Sets zoom to the passed string. The string must be composed of numeric
+ * characters only with the exception of a decimal point and a '%' as the
+ * last character. If the zoom level contribution list has been set, this
+ * method should be overridden to provide the appropriate zoom
+ * implementation for the new zoom levels.
+ *
+ * @param zoomString
+ * The new zoom level
+ */
+ public void setZoomAsText(String zoomString) {
+ currentZoomContant = null;
+ if (zoomString.equalsIgnoreCase(FIT_HEIGHT)) {
+ currentZoomContant = FIT_HEIGHT;
+ primSetZoom(getFitHeightZoomLevel());
+ viewport.getUpdateManager().performUpdate();
+ viewport.setViewLocation(viewport.getHorizontalRangeModel()
+ .getValue(), viewport.getVerticalRangeModel().getMinimum());
+ } else if (zoomString.equalsIgnoreCase(FIT_ALL)) {
+ currentZoomContant = FIT_ALL;
+ primSetZoom(getFitPageZoomLevel());
+ viewport.getUpdateManager().performUpdate();
+ viewport.setViewLocation(viewport.getHorizontalRangeModel()
+ .getMinimum(), viewport.getVerticalRangeModel()
+ .getMinimum());
+ } else if (zoomString.equalsIgnoreCase(FIT_WIDTH)) {
+ currentZoomContant = FIT_WIDTH;
+ primSetZoom(getFitWidthZoomLevel());
+ viewport.getUpdateManager().performUpdate();
+ viewport.setViewLocation(viewport.getHorizontalRangeModel()
+ .getMinimum(), viewport.getVerticalRangeModel().getValue());
+ } else {
+ try {
+ // Trim off the '%'
+ if (zoomString.charAt(zoomString.length() - 1) == '%') {
+ zoomString = zoomString.substring(0,
+ zoomString.length() - 1);
+ }
+ double newZoom = Double.parseDouble(zoomString) / 100;
+ setZoom(newZoom / multiplier);
+ } catch (Exception e) {
+ Display.getCurrent().beep();
+ }
+ }
+ }
+
+ /**
+ * Sets the list of zoom level contributions (as strings). If you contribute
+ * something <b>other than</b> {@link #FIT_HEIGHT}, {@link #FIT_WIDTH} and
+ * {@link #FIT_ALL} you must subclass this class and override this method to
+ * implement your contributed zoom function.
+ *
+ * @param contributions
+ * the list of contributed zoom levels
+ */
+ public void setZoomLevelContributions(List contributions) {
+ zoomLevelContributions = contributions;
+ }
+
+ /**
+ * Sets the zoomLevels.
+ *
+ * @param zoomLevels
+ * The zoomLevels to set
+ */
+ public void setZoomLevels(double[] zoomLevels) {
+ this.zoomLevels = zoomLevels;
+ }
+
+ /**
+ * Sets the zoom level to be one level higher
+ */
+ public void zoomIn() {
+ setZoom(getNextZoomLevel());
+ }
+
+ /**
+ * Currently does nothing.
+ *
+ * @param rect
+ * a rectangle
+ */
+ public void zoomTo(Rectangle rect) {
+ }
+
+ // private void performAnimatedZoom(Rectangle rect, boolean zoomIn, int
+ // iterationCount) {
+ // double finalRatio;
+ // double zoomIncrement;
+ //
+ // if (zoomIn) {
+ // finalRatio = zoom / getNextZoomLevel();
+ // zoomIncrement = (getNextZoomLevel() - zoom) / iterationCount;
+ // } else {
+ // finalRatio = zoom / getPreviousZoomLevel();
+ // zoomIncrement = (getPreviousZoomLevel() - zoom) / iterationCount;
+ // }
+ //
+ // getScalableFigure().translateToRelative(rect);
+ // Point originalViewLocation = getViewport().getViewLocation();
+ // Point finalViewLocation = calculateViewLocation(rect, finalRatio);
+ //
+ // double xIncrement =
+ // (double) (finalViewLocation.x - originalViewLocation.x) / iterationCount;
+ // double yIncrement =
+ // (double) (finalViewLocation.y - originalViewLocation.y) / iterationCount;
+ //
+ // double originalZoom = zoom;
+ // Point currentViewLocation = new Point();
+ // for (int i = 1; i < iterationCount; i++) {
+ // currentViewLocation.x = (int)(originalViewLocation.x + (xIncrement * i));
+ // currentViewLocation.y = (int)(originalViewLocation.y + (yIncrement * i));
+ // setZoom(originalZoom + zoomIncrement * i);
+ // getViewport().validate();
+ // setViewLocation(currentViewLocation);
+ // getViewport().getUpdateManager().performUpdate();
+ // }
+ //
+ // if (zoomIn)
+ // setZoom(getNextZoomLevel());
+ // else
+ // setZoom(getPreviousZoomLevel());
+ //
+ // getViewport().validate();
+ // setViewLocation(finalViewLocation);
+ // }
+ //
+ // private Point calculateViewLocation(Rectangle zoomRect, double ratio) {
+ // Point viewLocation = new Point();
+ // viewLocation.x = (int)(zoomRect.x / ratio);
+ // viewLocation.y = (int)(zoomRect.y / ratio);
+ // return viewLocation;
+ // }
+
+ /**
+ * Sets the zoom level to be one level lower
+ */
+ public void zoomOut() {
+ setZoom(getPreviousZoomLevel());
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/AbstractStylingModelFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/AbstractStylingModelFactory.java
new file mode 100644
index 0000000..a7e2d3c
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/AbstractStylingModelFactory.java
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * Copyright 2005, 2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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:
+ * The Chisel Group, University of Victoria
+ * Mateusz Matela <mateusz.matela@gmail.com> - Adapt Zest to changes in layout - https://bugs.eclipse.org/bugs/show_bug.cgi?id=283179
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer;
+import org.eclipse.zest.core.viewers.IFigureProvider;
+import org.eclipse.zest.core.viewers.INestedContentProvider;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphContainer;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * Base class that can be used for model factories. Offers facilities to style
+ * the items that have been created by the factory.
+ *
+ * @author Del Myers
+ */
+// @tag zest.bug.160367-Refreshing.fix : update the factory to use the
+// IStylingGraphModelFactory
+public abstract class AbstractStylingModelFactory implements
+ IStylingGraphModelFactory {
+ private AbstractStructuredGraphViewer viewer;
+ private int connectionStyle;
+ private int nodeStyle;
+
+ /**
+ *
+ */
+ public AbstractStylingModelFactory(AbstractStructuredGraphViewer viewer) {
+ this.viewer = viewer;
+ this.connectionStyle = SWT.NONE;
+ this.nodeStyle = SWT.NONE;
+ }
+
+ public void styleConnection(GraphConnection conn) {
+ // recount the source and target connections on the node.
+ // this isn't a great way to do it, because it results in
+ // an n^2 algorithm. But, if anyone can figure out a better way
+ // go ahead and try it.
+ GraphNode source = conn.getSource();
+ GraphNode dest = conn.getDestination();
+ LinkedList rightList = getConnectionList(source, dest);
+
+ LinkedList leftList = null;
+
+ if (dest != source) {
+ leftList = getConnectionList(dest, source);
+ }
+
+ // adjust the arcs going from source to destination
+ adjustCurves(rightList);
+ // adjust the arcs going from destination to source
+ if (leftList != null) {
+ adjustCurves(leftList);
+ }
+ }
+
+ /**
+ * Takes a list of IGraphModelConnections and adjusts the curve depths and
+ * the bezier curves based on the number of curves in the list.
+ *
+ * @param rightList
+ */
+ protected void adjustCurves(List connections) {
+ // @tag TODO curves : add back this code to adjust the curves
+ // int scale = 3;
+ // for (int i = 0; i < connections.size(); i++) {
+ // GraphConnection conn = (GraphConnection) connections.get(i);
+ // if (conn.getSource() == conn.getDestination()) {
+ // scale = 5;
+ // }
+ // // even if the connection isn't curved in the style, the edit part
+ // // may decide that it should be curved if source and dest are equal.
+ // // @tag drawing(arcs) : check here if arcs are too close when being
+ // // drawn. Adjust the constant.
+ // int lineWidth = conn.getLineWidth();
+ // conn.setCurveDepth((i + 1) * (scale + lineWidth));
+ //
+ // // @tag zest(bug(152530-Bezier(fix))) : set the angles, etc based on
+ // // the count.
+ // // limit the angle to 90 degrees.
+ // conn.setStartAngle(90.0 - 85.0 / Math.pow(i, 1.0 / 9.0));
+ // conn.setEndAngle(85.0 / Math.pow(i, 1.0 / 9.0) - 90.0);
+ // // limit the length to 1
+ // conn.setStartLength(.75 - .25 / (Math.sqrt(i)));
+ // conn.setEndLength(.75 - .25 / (Math.sqrt(i)));
+ // }
+ }
+
+ /**
+ * @param source
+ * @param dest
+ * @return
+ */
+ private LinkedList getConnectionList(GraphNode source, GraphNode dest) {
+ LinkedList list = new LinkedList();
+ Iterator i = source.getSourceConnections().iterator();
+ while (i.hasNext()) {
+ GraphConnection c = (GraphConnection) i.next();
+ if (c.getDestination() == dest) {
+ list.add(c);
+ }
+ }
+ return list;
+ }
+
+ public void styleItem(GraphItem item) {
+ GraphItemStyler.styleItem(item, getLabelProvider());
+ if (item instanceof GraphConnection) {
+ styleConnection((GraphConnection) item);
+ }
+ }
+
+ public StructuredViewer getViewer() {
+ return viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * getLabelProvider()
+ */
+ public IBaseLabelProvider getLabelProvider() {
+ return viewer.getLabelProvider();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * getContentProvider()
+ */
+ public IStructuredContentProvider getContentProvider() {
+ return (IStructuredContentProvider) viewer.getContentProvider();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * createConnection(org.eclipse.zest.core.internal.graphmodel.GraphModel,
+ * java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+ public GraphConnection createConnection(Graph graph, Object element,
+ Object source, Object dest) {
+ if (source == null || dest == null) {
+ return null;
+ }
+ GraphConnection oldConnection = viewer.getGraphModelConnection(element);
+ GraphNode sn = viewer.getGraphModelNode(source);
+ GraphNode dn = viewer.getGraphModelNode(dest);
+ if (oldConnection != null) {
+ if (sn != oldConnection.getSource()
+ || dn != oldConnection.getDestination()) {
+ viewer.removeGraphModelConnection(oldConnection);
+ } else {
+ styleItem(oldConnection);
+ return oldConnection;
+ }
+ }
+ if (sn == null) {
+ sn = createNode(graph, source);
+ }
+ if (dn == null) {
+ dn = createNode(graph, dest);
+ }
+ GraphConnection c = viewer.addGraphModelConnection(element, sn, dn);
+ styleItem(c);
+ return c;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * createNode(org.eclipse.zest.core.internal.graphmodel.GraphModel,
+ * java.lang.Object)
+ */
+ public GraphNode createNode(Graph graph, Object element, IFigure figure) {
+ GraphNode node = null;
+ if (getContentProvider() instanceof INestedContentProvider) {
+ boolean isContainer = ((INestedContentProvider) getContentProvider())
+ .hasChildren(element);
+ if (isContainer) {
+ node = viewer.addGraphModelContainer(element);
+ styleItem(node);
+ Object[] childNodes = ((INestedContentProvider) getContentProvider())
+ .getChildren(element);
+ childNodes = filter(getViewer().getInput(), childNodes);
+ if (childNodes == null) {
+ return node;
+ }
+ for (int i = 0; i < childNodes.length; i++) {
+ GraphNode childNode = viewer.addGraphModelNode(
+ (GraphContainer) node, childNodes[i]);
+ styleItem(childNode);
+ }
+ ((GraphContainer) node).applyLayout();
+ return node;
+ }
+ }
+ node = viewer.addGraphModelNode(element, figure);
+ styleItem(node);
+ return node;
+ }
+
+ public GraphNode createNode(Graph graph, Object element) {
+ IFigure nodeFigure = null;
+ if (getLabelProvider() instanceof IFigureProvider) {
+ nodeFigure = ((IFigureProvider) getLabelProvider())
+ .getFigure(element);
+ }
+ return this.createNode(graph, element, nodeFigure);
+ }
+
+ public void setConnectionStyle(int style) {
+ this.connectionStyle = style;
+ }
+
+ /**
+ * @return the connectionStyle
+ */
+ public int getConnectionStyle() {
+ return connectionStyle;
+ }
+
+ public void setNodeStyle(int style) {
+ this.nodeStyle = style;
+ }
+
+ /**
+ * @return the nodeStyle
+ */
+ public int getNodeStyle() {
+ return nodeStyle;
+ }
+
+ /**
+ * Default implementation simply restyles the item, regardless of the
+ * properties.
+ */
+ public void update(GraphItem item) {
+ styleItem(item);
+ }
+
+ /**
+ * Default implementation simply restyles the items, regardless of the
+ * properties.
+ */
+ public void update(GraphItem[] items) {
+ for (int i = 0; i < items.length; i++) {
+ styleItem(items[i]);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * refreshGraph(org.eclipse.zest.core.internal.graphmodel.GraphModel)
+ */
+ public void refreshGraph(Graph graph) {
+ // with this kind of graph, it is just as easy and cost-effective to
+ // rebuild the whole thing.
+
+ Map oldMap = viewer.getNodesMap();
+ HashMap nodesMap = new HashMap();
+ // have to copy the Map data accross so that it doesn't get overwritten
+ for (Iterator keys = oldMap.keySet().iterator(); keys.hasNext();) {
+ Object key = keys.next();
+ nodesMap.put(key, oldMap.get(key));
+ }
+ clearGraph(graph);
+ doBuildGraph(graph);
+ // update the positions on the new nodes to match the old ones.
+ GraphNode[] nodes = getNodesArray(graph);
+ // save a little time, go with the smallest list as the primary list
+ if (nodes.length < nodesMap.keySet().size()) {
+ for (int i = 0; i < nodes.length; i++) {
+ GraphNode oldNode = (GraphNode) nodesMap
+ .get(nodes[i].getData());
+ if (oldNode != null) {
+ nodes[i].setLocation(oldNode.getLocation().x, oldNode
+ .getLocation().y);
+ if (oldNode.isSizeFixed()) {
+ nodes[i].setSize(oldNode.getSize().width, oldNode
+ .getSize().height);
+ }
+ }
+ }
+ } else {
+ for (Iterator i = nodesMap.keySet().iterator(); i.hasNext();) {
+ Object key = i.next();
+ GraphNode node = viewer.getGraphModelNode(key);
+ if (node != null) {
+ GraphNode oldNode = (GraphNode) nodesMap.get(key);
+ node.setLocation(oldNode.getLocation().x, oldNode
+ .getLocation().y);
+ if (oldNode.isSizeFixed()) {
+ node.setSize(oldNode.getSize().width,
+ oldNode.getSize().height);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Convenience method for clearing all the elements in the graph.
+ *
+ * @param graph
+ */
+ public void clearGraph(Graph graph) {
+ graph.setSelection(null);
+ Object[] nodeElements = viewer.getNodeElements();
+ for (int i = 0; i < nodeElements.length; i++) {
+ viewer.removeGraphModelNode(nodeElements[i]);
+ }
+ Object[] connectionElements = viewer.getConnectionElements();
+ for (int i = 0; i < connectionElements.length; i++) {
+ viewer.removeGraphModelConnection(connectionElements[i]);
+ }
+ }
+
+ /**
+ * Builds the graph model from the viewer's content provider. There is no
+ * guarantee that the model will be cleared before this method is called.
+ *
+ * @param graph
+ */
+ protected void doBuildGraph(Graph model) {
+ clearGraph(model);
+ model.setConnectionStyle(getConnectionStyle());
+ model.setNodeStyle(getNodeStyle());
+ }
+
+ /**
+ * Determines if this element should be filtered or not.
+ *
+ * @param parent
+ * @param element
+ * @return
+ */
+ protected boolean filterElement(Object parent, Object element) {
+ ViewerFilter[] filters = getViewer().getFilters();
+ for (int i = 0; i < filters.length; i++) {
+ boolean selected = filters[i].select(viewer, parent, element);
+ if (!selected) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * isFiltered(java.lang.Object)
+ */
+ protected Object[] filter(Object parent, Object[] elements) {
+ Object[] result = elements;
+ ViewerFilter[] filters = getViewer().getFilters();
+ for (int i = 0; i < filters.length; i++) {
+ result = filters[i].filter(viewer, parent, result);
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object)
+ */
+ public void refresh(Graph graph, Object element) {
+ refresh(graph, element, false);
+ }
+
+ /**
+ * Converts the list of GraphNode objects into an array and return it.
+ *
+ * @return GraphModelNode[]
+ */
+ protected GraphNode[] getNodesArray(Graph graph) {
+ GraphNode[] nodesArray = new GraphNode[graph.getNodes().size()];
+ nodesArray = (GraphNode[]) graph.getNodes().toArray(nodesArray);
+ return nodesArray;
+ }
+
+ /**
+ * Converts the list of GraphConnections objects into an array and return
+ * it.
+ *
+ * @param graph
+ * @return
+ */
+ protected GraphConnection[] getConnectionArray(Graph graph) {
+ GraphConnection[] connectionArray = new GraphConnection[graph
+ .getConnections().size()];
+ connectionArray = (GraphConnection[]) graph.getConnections().toArray(
+ connectionArray);
+ return connectionArray;
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java
new file mode 100644
index 0000000..1926f2b
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphItemStyler.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+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.IConnectionStyleProvider;
+import org.eclipse.zest.core.viewers.IEntityConnectionStyleProvider;
+import org.eclipse.zest.core.viewers.IEntityStyleProvider;
+import org.eclipse.zest.core.viewers.ISelfStyleProvider;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+/*
+ * Helper class used to style graph elements based on graph element stylers.
+ *
+ * @author Del Myers
+ */
+// @tag bug(151327-Styles) : created to help resolve this bug
+public class GraphItemStyler {
+ public static void styleItem(GraphItem item,
+ final IBaseLabelProvider labelProvider) {
+
+ if (item instanceof GraphNode) {
+ GraphNode node = (GraphNode) item;
+ // set defaults.
+ if (node.getGraphModel().getNodeStyle() != ZestStyles.NONE) {
+ node.setNodeStyle(node.getGraphModel().getNodeStyle());
+ } else {
+ node.setNodeStyle(SWT.NONE);
+ }
+ Object entity = node.getData();
+ if (labelProvider instanceof IEntityStyleProvider) {
+ styleNode(node, (IEntityStyleProvider) labelProvider);
+ }
+ if (labelProvider instanceof IColorProvider) {
+ IColorProvider colorProvider = (IColorProvider) labelProvider;
+ node.setForegroundColor(colorProvider.getForeground(entity));
+ node.setBackgroundColor(colorProvider.getBackground(entity));
+ }
+ if (labelProvider instanceof IFontProvider) {
+ IFontProvider fontProvider = (IFontProvider) labelProvider;
+ node.setFont(fontProvider.getFont(entity));
+ }
+ if (labelProvider instanceof ILabelProvider) {
+ String text = ((ILabelProvider) labelProvider).getText(node
+ .getData());
+ node.setText((text != null) ? text : "");
+ node.setImage(((ILabelProvider) labelProvider).getImage(node
+ .getData()));
+ }
+ if (labelProvider instanceof ISelfStyleProvider) {
+ ((ISelfStyleProvider) labelProvider)
+ .selfStyleNode(entity, node);
+ }
+ } else if (item instanceof GraphConnection) {
+ GraphConnection conn = (GraphConnection) item;
+
+ // set defaults
+ if (conn.getGraphModel().getConnectionStyle() != ZestStyles.NONE) {
+ int s = conn.getGraphModel().getConnectionStyle();
+ conn.setConnectionStyle(s);
+ } else {
+ conn.setConnectionStyle(SWT.NONE);
+ }
+ if (labelProvider instanceof ILabelProvider) {
+ String text = ((ILabelProvider) labelProvider).getText(conn
+ .getExternalConnection());
+ conn.setText((text != null) ? text : "");
+ conn.setImage(((ILabelProvider) labelProvider).getImage(conn
+ .getExternalConnection()));
+ }
+ if (labelProvider instanceof IEntityConnectionStyleProvider) {
+ styleEntityConnection(conn,
+ (IEntityConnectionStyleProvider) labelProvider);
+ } else if (labelProvider instanceof IConnectionStyleProvider) {
+ styleConnection(conn, (IConnectionStyleProvider) labelProvider);
+ }
+ int swt = getLineStyleForZestStyle(conn.getConnectionStyle());
+ conn.setLineStyle(swt);
+ if (labelProvider instanceof ISelfStyleProvider) {
+ ((ISelfStyleProvider) labelProvider).selfStyleConnection(conn
+ .getData(), conn);
+ }
+ }
+ }
+
+ /**
+ * @param conn
+ * @param provider
+ */
+ private static void styleConnection(GraphConnection conn,
+ IConnectionStyleProvider provider) {
+ Object rel = conn.getExternalConnection();
+ Color c;
+ int style = provider.getConnectionStyle(rel);
+ if (!ZestStyles.validateConnectionStyle(style)) {
+ throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (style != ZestStyles.NONE) {
+ conn.setConnectionStyle(style);
+ }
+ // @tag bug(152530-Bezier(fix))
+ // @tat TODO curves bezier: Add back the bezier connection stuff
+ // if (ZestStyles.checkStyle(conn.getConnectionStyle(),
+ // ZestStyles.CONNECTIONS_BEZIER)
+ // && provider instanceof IConnectionStyleBezierExtension) {
+ // IConnectionStyleBezierExtension bezier =
+ // (IConnectionStyleBezierExtension) provider;
+ // double d;
+ // if (!Double.isNaN((d = bezier.getStartAngle(rel)))) {
+ // conn.setStartAngle(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getEndAngle(rel)))) {
+ // conn.setEndAngle(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getStartDistance(rel)))) {
+ // conn.setStartLength(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getEndDistance(rel)))) {
+ // conn.setEndLength(d);
+ // }
+ // }
+ if ((c = provider.getHighlightColor(rel)) != null) {
+ conn.setHighlightColor(c);
+ }
+ if ((c = provider.getColor(rel)) != null) {
+ conn.setLineColor(c);
+ }
+ IFigure tooltip;
+ if ((tooltip = provider.getTooltip(rel)) != null) {
+ conn.setTooltip(tooltip);
+ }
+ int w = -1;
+ if ((w = provider.getLineWidth(rel)) >= 0) {
+ conn.setLineWidth(w);
+ }
+ }
+
+ /**
+ * @param conn
+ * @param provider
+ */
+ private static void styleEntityConnection(GraphConnection conn,
+ IEntityConnectionStyleProvider provider) {
+ Object src = conn.getSource().getData();
+ Object dest = conn.getDestination().getData();
+ Color c;
+ int style = provider.getConnectionStyle(src, dest);
+ if (!ZestStyles.validateConnectionStyle(style)) {
+ throw new SWTError(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (style != ZestStyles.NONE) {
+ conn.setConnectionStyle(style);
+ }
+ // @tag bug(152530-Bezier(fisx))
+ // @tag TODO curved connections bezier : add back the bezier connection
+ // stuff
+ // if (ZestStyles.checkStyle(conn.getConnectionStyle(),
+ // ZestStyles.CONNECTIONS_BEZIER)
+ // && provider instanceof IEntityConnectionStyleBezierExtension) {
+ // IEntityConnectionStyleBezierExtension bezier =
+ // (IEntityConnectionStyleBezierExtension) provider;
+ // double d;
+ // if (!Double.isNaN((d = bezier.getStartAngle(src, dest)))) {
+ // conn.setStartAngle(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getEndAngle(src, dest)))) {
+ // conn.setEndAngle(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getStartDistance(src, dest)))) {
+ // conn.setStartLength(d);
+ // }
+ // if (!Double.isNaN((d = bezier.getEndDistance(src, dest)))) {
+ // conn.setEndLength(d);
+ // }
+ // }
+ if ((c = provider.getColor(src, dest)) != null) {
+ conn.setLineColor(c);
+ }
+ if ((c = provider.getHighlightColor(src, dest)) != null) {
+ conn.setHighlightColor(c);
+ }
+ int w = -1;
+ if ((w = provider.getLineWidth(src, dest)) >= 0) {
+ conn.setLineWidth(w);
+ }
+ }
+
+ /**
+ * Styles the given node according to the properties in the style provider.
+ *
+ * @param node
+ * the graph element to style.
+ * @param data
+ * the element that is being styled.
+ * @param provider
+ * the style provier.
+ */
+ // @tag bug(151327-Styles) : resolution
+ private static void styleNode(GraphNode node, IEntityStyleProvider provider) {
+ Object entity = node.getData();
+ // @tag ADJACENT : Removed highlight adjacent
+ // node.setHighlightAdjacentNodes(provider.highlightAdjacentEntities(entity));
+
+ // @tag ADJACENT : Removed highlight adjacent
+ /*
+ * if (provider.highlightAdjacentEntities(entity)) { Color c =
+ * provider.getAdjacentEntityHighlightColor(entity); if (c != null) {
+ * node.setHighlightAdjacentColor(c); } }
+ */
+ Color c;
+ IFigure figure;
+ int width = -1;
+ if (provider.fisheyeNode(entity) == true) {
+ node.setNodeStyle(node.getNodeStyle() | ZestStyles.NODES_FISHEYE);
+ }
+ if ((c = provider.getBorderColor(entity)) != null) {
+ node.setBorderColor(c);
+ }
+ if ((c = provider.getBorderHighlightColor(entity)) != null) {
+ node.setBorderHighlightColor(c);
+ }
+ if ((c = provider.getNodeHighlightColor(entity)) != null) {
+ node.setHighlightColor(c);
+ }
+ if ((c = provider.getBackgroundColour(entity)) != null) {
+ node.setBackgroundColor(c);
+ }
+ if ((c = provider.getForegroundColour(entity)) != null) {
+ node.setForegroundColor(c);
+ }
+ if ((width = provider.getBorderWidth(entity)) >= 0) {
+ node.setBorderWidth(width);
+ }
+ if ((figure = provider.getTooltip(entity)) != null) {
+ node.setTooltip(figure);
+ }
+
+ }
+
+ /**
+ * Returns the SWT line style for the given zest connection style.
+ *
+ */
+ public static int getLineStyleForZestStyle(int style) {
+ int lineStyles = ZestStyles.CONNECTIONS_DASH_DOT
+ | ZestStyles.CONNECTIONS_DASH | ZestStyles.CONNECTIONS_DOT
+ | ZestStyles.CONNECTIONS_SOLID;
+ style = style & lineStyles;
+ if (style == 0) {
+ style = ZestStyles.CONNECTIONS_SOLID;
+ }
+ switch (style) {
+ case ZestStyles.CONNECTIONS_DASH_DOT:
+ return SWT.LINE_DASHDOT;
+ case ZestStyles.CONNECTIONS_DASH:
+ return SWT.LINE_DASH;
+ case ZestStyles.CONNECTIONS_DOT:
+ return SWT.LINE_DOT;
+ }
+ return SWT.LINE_SOLID;
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityFactory.java
new file mode 100644
index 0000000..d71471b
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityFactory.java
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer;
+import org.eclipse.zest.core.viewers.EntityConnectionData;
+import org.eclipse.zest.core.viewers.IFigureProvider;
+import org.eclipse.zest.core.viewers.IGraphEntityContentProvider;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/*
+ *
+ * @author Ian Bull
+ */
+public class GraphModelEntityFactory extends AbstractStylingModelFactory {
+
+ AbstractStructuredGraphViewer viewer = null;
+
+ public GraphModelEntityFactory(AbstractStructuredGraphViewer viewer) {
+ super(viewer);
+ this.viewer = viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#
+ * createGraphModel()
+ */
+ public Graph createGraphModel(Graph model) {
+ doBuildGraph(model);
+ return model;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.AbstractStylingModelFactory
+ * #doBuildGraph(org.eclipse.zest.core.internal.graphmodel.GraphModel)
+ */
+ protected void doBuildGraph(Graph model) {
+ super.doBuildGraph(model);
+ Object inputElement = getViewer().getInput();
+ Object entities[] = getContentProvider().getElements(inputElement);
+ if (entities == null) {
+ return;
+ }
+ for (int i = 0; i < entities.length; i++) {
+ Object data = entities[i];
+ IFigureProvider figureProvider = null;
+ if (getLabelProvider() instanceof IFigureProvider) {
+ figureProvider = (IFigureProvider) getLabelProvider();
+ }
+ if (!filterElement(inputElement, data)) {
+ if (figureProvider != null) {
+ createNode(model, data, figureProvider.getFigure(data));
+ } else {
+ createNode(model, data);
+ }
+ }
+ }
+
+ // We may have other entities (such as children of containers)
+ Set keySet = ((AbstractStructuredGraphViewer) getViewer())
+ .getNodesMap().keySet();
+ entities = keySet.toArray();
+
+ for (int i = 0; i < entities.length; i++) {
+ Object data = entities[i];
+
+ // If this element is filtered, continue to the next one.
+ if (filterElement(inputElement, data)) {
+ continue;
+ }
+ Object[] related = ((IGraphEntityContentProvider) getContentProvider())
+ .getConnectedTo(data);
+
+ if (related != null) {
+ for (int j = 0; j < related.length; j++) {
+ // if the node this node is connected to is filtered,
+ // don't display this edge
+ if (filterElement(inputElement, related[j])) {
+ continue;
+ }
+ EntityConnectionData connectionData = new EntityConnectionData(
+ data, related[j]);
+ if (filterElement(inputElement, connectionData)) {
+ continue;
+ }
+ createConnection(model, connectionData, data, related[j]);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object)
+ */
+ public void refresh(Graph graph, Object element, boolean refreshLabels) {
+ if (element == null) {
+ return;
+ }
+ GraphNode node = viewer.getGraphModelNode(element);
+ if (node == null) {
+ // check to make sure that the user didn't send us an edge.
+ GraphConnection conn = viewer.getGraphModelConnection(element);
+ if (conn != null) {
+ // refresh on the connected nodes.
+ refresh(graph, conn.getSource().getData(), refreshLabels);
+ refresh(graph, conn.getDestination().getData(), refreshLabels);
+ return;
+ }
+ }
+ // can only refresh on nodes in this kind of factory.
+ if (node == null) {
+ // do nothing
+ return;
+ }
+ reconnect(graph, element, refreshLabels);
+
+ if (refreshLabels) {
+ update(node);
+ for (Iterator it = node.getSourceConnections().iterator(); it
+ .hasNext();) {
+ update((GraphItem) it.next());
+ }
+ for (Iterator it = node.getTargetConnections().iterator(); it
+ .hasNext();) {
+ update((GraphItem) it.next());
+ }
+ }
+ }
+
+ /**
+ * @param graph
+ * @param element
+ * @param refreshLabels
+ */
+ private void reconnect(Graph graph, Object element, boolean refreshLabels) {
+ GraphNode node = viewer.getGraphModelNode(element);
+ Object[] related = ((IGraphEntityContentProvider) getContentProvider())
+ .getConnectedTo(element);
+ List connections = node.getSourceConnections();
+ LinkedList toAdd = new LinkedList();
+ LinkedList toDelete = new LinkedList();
+ LinkedList toKeep = new LinkedList();
+ HashSet oldExternalConnections = new HashSet();
+ HashSet newExternalConnections = new HashSet();
+ for (Iterator it = connections.iterator(); it.hasNext();) {
+ oldExternalConnections.add(((GraphConnection) it.next())
+ .getExternalConnection());
+ }
+ for (int i = 0; i < related.length; i++) {
+ newExternalConnections.add(new EntityConnectionData(element,
+ related[i]));
+ }
+ for (Iterator it = oldExternalConnections.iterator(); it.hasNext();) {
+ Object next = it.next();
+ if (!newExternalConnections.contains(next)) {
+ toDelete.add(next);
+ } else {
+ toKeep.add(next);
+ }
+ }
+ for (Iterator it = newExternalConnections.iterator(); it.hasNext();) {
+ Object next = it.next();
+ if (!oldExternalConnections.contains(next)) {
+ toAdd.add(next);
+ }
+ }
+ for (Iterator it = toDelete.iterator(); it.hasNext();) {
+ viewer.removeGraphModelConnection(it.next());
+ }
+ toDelete.clear();
+ LinkedList newNodeList = new LinkedList();
+ for (Iterator it = toAdd.iterator(); it.hasNext();) {
+ EntityConnectionData data = (EntityConnectionData) it.next();
+ GraphNode dest = viewer.getGraphModelNode(data.dest);
+ if (dest == null) {
+ newNodeList.add(data.dest);
+ }
+ createConnection(graph, data, data.source, data.dest);
+ }
+ toAdd.clear();
+ if (refreshLabels) {
+ for (Iterator i = toKeep.iterator(); i.hasNext();) {
+ styleItem(viewer.getGraphModelConnection(i.next()));
+ }
+ }
+ for (Iterator it = newNodeList.iterator(); it.hasNext();) {
+ // refresh the new nodes so that we get a fully-up-to-date graph.
+ refresh(graph, it.next());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object,
+ * boolean)
+ */
+ public void refresh(Graph graph, Object element) {
+ refresh(graph, element, false);
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityRelationshipFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityRelationshipFactory.java
new file mode 100644
index 0000000..39786dc
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelEntityRelationshipFactory.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer;
+import org.eclipse.zest.core.viewers.IGraphEntityRelationshipContentProvider;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphContainer;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/*
+ * A factory for the IGraphEntityRelationshipContentProvider.
+ *
+ * @author Del Myers
+ */
+// @tag bug.154580-Content.fix
+// @tag bug.160367-Refreshing.fix : updated to use new
+// AbstractStylingModelFactory
+public class GraphModelEntityRelationshipFactory extends
+ AbstractStylingModelFactory {
+
+ public GraphModelEntityRelationshipFactory(
+ AbstractStructuredGraphViewer viewer) {
+ super(viewer);
+ if (!(viewer.getContentProvider() instanceof IGraphEntityRelationshipContentProvider)) {
+ throw new IllegalArgumentException(
+ "Expected IGraphEntityRelationshipContentProvider");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.AbstractStylingModelFactory
+ * #createGraphModel()
+ */
+ public Graph createGraphModel(Graph model) {
+ doBuildGraph(model);
+ return model;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.AbstractStylingModelFactory
+ * #doBuildGraph(org.eclipse.zest.core.internal.graphmodel.GraphModel)
+ */
+ protected void doBuildGraph(Graph model) {
+ super.doBuildGraph(model);
+ Object[] nodes = getContentProvider().getElements(
+ getViewer().getInput());
+ nodes = filter(getViewer().getInput(), nodes);
+ createModelNodes(model, nodes);
+ createModelRelationships(model);
+ }
+
+ /**
+ * Creates all the model relationships. Assumes that all of the model nodes
+ * have been created in the graph model already. Runtime O(n^2) + O(r).
+ *
+ * @param model
+ * the model to create the relationship on.
+ */
+ private void createModelRelationships(Graph model) {
+ GraphNode[] modelNodes = getNodesArray(model);
+ List listOfNodes = new ArrayList();
+ for (int i = 0; i < modelNodes.length; i++) {
+ listOfNodes.add(modelNodes[i]);
+ }
+
+ for (int i = 0; i < listOfNodes.size(); i++) {
+ GraphNode node = (GraphNode) listOfNodes.get(i);
+ if (node instanceof GraphContainer) {
+ List childNodes = ((GraphContainer) node).getNodes();
+ listOfNodes.addAll(childNodes);
+ }
+ }
+ modelNodes = (GraphNode[]) listOfNodes
+ .toArray(new GraphNode[listOfNodes.size()]);
+
+ IGraphEntityRelationshipContentProvider content = getCastedContent();
+ for (int i = 0; i < modelNodes.length; i++) {
+ for (int j = 0; j < modelNodes.length; j++) {
+ Object[] rels = content.getRelationships(modelNodes[i]
+ .getData(), modelNodes[j].getData());
+ if (rels != null) {
+ rels = filter(getViewer().getInput(), rels);
+ for (int r = 0; r < rels.length; r++) {
+ createConnection(model, rels[r], modelNodes[i]
+ .getData(), modelNodes[j].getData());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates the model nodes for the given external nodes.
+ *
+ * @param model
+ * the graph model.
+ * @param nodes
+ * the external nodes.
+ */
+ private void createModelNodes(Graph model, Object[] nodes) {
+ for (int i = 0; i < nodes.length; i++) {
+ createNode(model, nodes[i]);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object)
+ */
+ public void refresh(Graph graph, Object element) {
+ refresh(graph, element, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object,
+ * boolean)
+ */
+ public void refresh(Graph graph, Object element, boolean updateLabels) {
+ // with this kind of graph, it is just as easy and cost-effective to
+ // rebuild the whole thing.
+ refreshGraph(graph);
+ }
+
+ private IGraphEntityRelationshipContentProvider getCastedContent() {
+ return (IGraphEntityRelationshipContentProvider) getContentProvider();
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelFactory.java
new file mode 100644
index 0000000..a44c678
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/GraphModelFactory.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.zest.core.viewers.AbstractStructuredGraphViewer;
+import org.eclipse.zest.core.viewers.IFigureProvider;
+import org.eclipse.zest.core.viewers.IGraphContentProvider;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * This factory helps make models (nodes & connections).
+ *
+ * @author Ian Bull
+ * @author Chris Callendar
+ */
+public class GraphModelFactory extends AbstractStylingModelFactory {
+
+ AbstractStructuredGraphViewer viewer = null;
+
+ public GraphModelFactory(AbstractStructuredGraphViewer viewer) {
+ super(viewer);
+ this.viewer = viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see ca.uvic.cs.zest.internal.graphmodel.IGraphModelFactory#createModel()
+ */
+ public Graph createGraphModel(Graph model) {
+ doBuildGraph(model);
+ return model;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.AbstractStylingModelFactory
+ * #doBuildGraph(org.eclipse.zest.core.internal.graphmodel.GraphModel)
+ */
+ protected void doBuildGraph(Graph model) {
+ super.doBuildGraph(model);
+ // make the model have the same styles as the viewer
+ Object rels[] = getContentProvider()
+ .getElements(getViewer().getInput());
+ if (rels != null) {
+ IFigureProvider figureProvider = null;
+ if (getLabelProvider() instanceof IFigureProvider) {
+ figureProvider = (IFigureProvider) getLabelProvider();
+ }
+
+ // If rels returns null then just continue
+ // @tag zest(bug(134928(fix))) : An empty graph causes an NPE
+ for (int i = 0; i < rels.length; i++) {
+ // Check the filter on the source
+ Object source = getCastedContent().getSource(rels[i]);
+ source = filterElement(getViewer().getInput(), source) ? null
+ : source;
+
+ // Check hte filter on the dest
+ Object dest = getCastedContent().getDestination(rels[i]);
+ dest = filterElement(getViewer().getInput(), dest) ? null
+ : dest;
+
+ if (source == null) {
+ // just create the node for the destination
+ if (dest != null) {
+ if (figureProvider != null) {
+ createNode(model, dest, figureProvider
+ .getFigure(dest));
+ } else {
+ createNode(model, dest);
+ }
+ }
+ continue;
+ } else if (dest == null) {
+ // just create the node for the source
+ if (source != null) {
+ if (figureProvider != null) {
+ createNode(model, source, figureProvider
+ .getFigure(dest));
+ } else {
+ createNode(model, source);
+ }
+ }
+ continue;
+ }
+ // If any of the source, dest is null or the edge is filtered,
+ // don't create the graph.
+ if (source != null && dest != null
+ && !filterElement(getViewer().getInput(), rels[i])) {
+ createConnection(model, rels[i], getCastedContent()
+ .getSource(rels[i]), getCastedContent()
+ .getDestination(rels[i]));
+ }
+ }
+ }
+
+ }
+
+ private IGraphContentProvider getCastedContent() {
+ return (IGraphContentProvider) getContentProvider();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object)
+ */
+ public void refresh(Graph graph, Object element) {
+ refresh(graph, element, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.internal.graphmodel.IStylingGraphModelFactory#refresh
+ * (org.eclipse.zest.core.internal.graphmodel.GraphModel, java.lang.Object,
+ * boolean)
+ */
+ public void refresh(Graph graph, Object element, boolean updateLabels) {
+ GraphConnection conn = viewer.getGraphModelConnection(element);
+ if (conn == null) {
+ // did the user send us a node? Check all of the connections on the
+ // node.
+ GraphNode node = viewer.getGraphModelNode(element);
+ if (node != null) {
+ List connections = node.getSourceConnections();
+ for (Iterator it = connections.iterator(); it.hasNext();) {
+ GraphConnection c = (GraphConnection) it.next();
+ refresh(graph, c.getExternalConnection(), updateLabels);
+ }
+ connections = node.getTargetConnections();
+ for (Iterator it = connections.iterator(); it.hasNext();) {
+ GraphConnection c = (GraphConnection) it.next();
+ refresh(graph, c.getExternalConnection(), updateLabels);
+ }
+ }
+ return;
+ }
+ Object oldSource = conn.getSource().getData();
+ Object oldDest = conn.getDestination().getData();
+ Object newSource = getCastedContent().getSource(element);
+ Object newDest = getCastedContent().getDestination(element);
+ if (!(oldSource.equals(newSource) && oldDest.equals(newDest))) {
+ GraphNode internalSource = viewer.getGraphModelNode(newSource);
+ GraphNode internalDest = viewer.getGraphModelNode(newDest);
+ if (internalSource == null) {
+ internalSource = createNode(graph, newSource);
+ } else if (updateLabels) {
+ styleItem(internalSource);
+ }
+ if (internalDest == null) {
+ internalDest = createNode(graph, newDest);
+ } else if (updateLabels) {
+ styleItem(internalDest);
+ }
+ if (updateLabels) {
+ styleItem(conn);
+ }
+ }
+
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/IStylingGraphModelFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/IStylingGraphModelFactory.java
new file mode 100644
index 0000000..cafb8bb
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/IStylingGraphModelFactory.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * A Graph model factory that supports the structural and visual refreshing of
+ * graph elements based on the content provider and label provider in the viewer
+ * that this factory is associated with. Model elements are created using the
+ * content provider supplied by getContentProvider(), and styled using the label
+ * provider supplied by getLabelProvider(). By the end of creation and
+ * refreshing, the graph model elements are expected to be styled according to
+ * the given label provider, however, default styles are dependant on the
+ * particular implementation of IStylingGraphModelFactory. Unless otherwise
+ * documented, clients should expect that the implementation of
+ * IStylingGraphModelFactory adheres to the general defaults found in
+ * {@link IZestGraphDefaults}.
+ *
+ * @author Del Myers
+ */
+
+public interface IStylingGraphModelFactory {
+ /**
+ * Returns the label provider used in this factory.
+ *
+ * @return the label provider used in this factory.
+ */
+ public IBaseLabelProvider getLabelProvider();
+
+ /**
+ * Returns the content provider used in this factory.
+ *
+ * @return the content provider used in this factory.
+ */
+ public IStructuredContentProvider getContentProvider();
+
+ /**
+ * Creates and returns the graph model from this factory based on the label
+ * provider and the label provider returned in getContentProvider() and
+ * getLabelProvider().
+ *
+ * @return the created graph model.
+ */
+ public Graph createGraphModel(Graph model);
+
+ /**
+ * Creates and returns a node on the given graph based on the user model
+ * data, "data", using the content provider returned by
+ * getContentProvider(). They node will also be styled according to the
+ * information given by the label provider. If the node already exists in
+ * the graph, it is restyled and returned; no new node is created.
+ *
+ * @param graph
+ * the graph to create or retrieve the node on.
+ * @param element
+ * the user model data to use in the node.
+ * @return the node created or retrieved for the given graph.
+ */
+ public GraphNode createNode(Graph graph, Object element);
+
+ /**
+ * Creates and returns a connection with the given source and destination
+ * objects from the user model. If the source and destination nodes don't
+ * exist for the given user model objects, they are created using
+ * createNode(GraphModel, Object). If a connection already exists for the
+ * given user data, but with different source or destinations, it is
+ * disconnected and reconnected to the given source and destination. It is
+ * always styled according to the label provider provided by
+ * getLabelProvider().
+ *
+ * @param graph
+ * the graph to create or retrieve the connection on.
+ * @param element
+ * the user model data to use in this connection.
+ * @param source
+ * the user model data used for the source node.
+ * @param dest
+ * the user model data used for the destination node.
+ * @return the created or retrieved connection for the given graph.
+ */
+ public GraphConnection createConnection(Graph graph, Object element,
+ Object source, Object dest);
+
+ /**
+ * Restyles the given graph items according to the label provider supplied
+ * by getLabelProvider().
+ *
+ * @param items
+ * the items to update.
+ */
+ public void update(GraphItem[] items);
+
+ /**
+ * Restyles the given graph item according to the label provider supplied by
+ * getLabelProvider().
+ *
+ * @param item
+ * the item to update.
+ */
+ public void update(GraphItem item);
+
+ /**
+ * Structurally refreshes the graph model nodes and connections associated
+ * with the given user model element. Does nothing if the element does not
+ * currently exist in the view. No restyling is done by default.
+ *
+ * @param graph
+ * @param element
+ * the element to restructure.
+ */
+ public void refresh(Graph graph, Object element);
+
+ /**
+ * Structurally refreshes the graph model nodes and connections associated
+ * with the given user model element. If updateLabels is true, then the
+ * labels are updated as well. Does nothing if the element does not
+ * currently exist in the view.
+ *
+ * @param graph
+ * the graph to find the element on.
+ * @param element
+ * the user model element.
+ * @param updateLabels
+ * true if the labels should be updated as well.
+ */
+ public void refresh(Graph graph, Object element, boolean updateLabels);
+
+ /**
+ * Structurally refreshes the entire graph.
+ *
+ * @param graph
+ * the graph to refresh;
+ */
+ public void refreshGraph(Graph graph);
+
+ /**
+ * Returns the viewer that this factory is building the model for.
+ *
+ * @return the viewer that this factory is building the model for.
+ */
+ public StructuredViewer getViewer();
+
+ public void setConnectionStyle(int style);
+
+ /**
+ * @return the connectionStyle
+ */
+ public int getConnectionStyle();
+
+ public void setNodeStyle(int style);
+
+ /**
+ * @return the nodeStyle
+ */
+ public int getNodeStyle();
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/SharedMessages.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/SharedMessages.java
new file mode 100644
index 0000000..9d4f2e5
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/viewers/internal/SharedMessages.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005-2010 IBM Corporation and others. 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: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.viewers.internal;
+
+/**
+ * This class contains UI strings (translated, if available) that clients can
+ * use.
+ *
+ * @author Eric Bordeau
+ */
+public class SharedMessages {
+
+ /**
+ * The string "Page".
+ */
+ public static String FitAllAction_Label = "Page"; // GEFMessages.FitAllAction_Label;
+ /**
+ * The string "Width".
+ */
+ public static String FitWidthAction_Label = "Width"; // GEFMessages.FitWidthAction_Label;
+ /**
+ * The string "Height".
+ */
+ public static String FitHeightAction_Label = "Height"; // GEFMessages.FitHeightAction_Label;
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/CGraphNode.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/CGraphNode.java
new file mode 100644
index 0000000..8febe86
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/CGraphNode.java
@@ -0,0 +1,51 @@
+package org.eclipse.zest.core.widgets;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+
+/**
+ * A Custom Graph Node
+ */
+public class CGraphNode extends GraphNode {
+
+ IFigure figure = null;
+
+ public CGraphNode(IContainer graphModel, int style, IFigure figure) {
+ super(graphModel, style, figure);
+ }
+
+ public IFigure getFigure() {
+ return super.getFigure();
+ }
+
+ protected IFigure createFigureForModel() {
+ this.figure = (IFigure) this.getData();
+ return this.figure;
+ }
+
+ public void setBackgroundColor(Color c) {
+ getFigure().setBackgroundColor(c);
+ }
+
+ public void setFont(Font font) {
+ getFigure().setFont(font);
+ }
+
+ public Color getBackgroundColor() {
+ return getFigure().getBackgroundColor();
+ }
+
+ public Font getFont() {
+ return getFigure().getFont();
+ }
+
+ public Color getForegroundColor() {
+ return getFigure().getForegroundColor();
+ }
+
+ protected void updateFigureForModel(IFigure currentFigure) {
+ // Undefined
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DAGExpandCollapseManager.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DAGExpandCollapseManager.java
new file mode 100644
index 0000000..edd5ab4
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DAGExpandCollapseManager.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.zest.layouts.interfaces.ConnectionLayout;
+import org.eclipse.zest.layouts.interfaces.ContextListener;
+import org.eclipse.zest.layouts.interfaces.ExpandCollapseManager;
+import org.eclipse.zest.layouts.interfaces.GraphStructureListener;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+
+/**
+ * <p>
+ * An {@link ExpandCollapseManager} specialized for Directed Acyclic Graphs. It
+ * works correctly only when all connections are directed (and of course nodes
+ * form an acyclic graph). It's supposed to be used with
+ * {@link InternalLayoutContext}.
+ * </p>
+ * <p>
+ * When a node is collapsed, all its outgoing connections are hidden and these
+ * successors that have no visible incoming nodes are pruned. When a node is
+ * expanded, all its successors are unpruned and connections pointing to them
+ * are shown.
+ * </p>
+ * </p>
+ * <p>
+ * <b>NOTE:</b> A <code>Graph</code> using this manger should use
+ * {@link DefaultSubgraph}, which doesn't show any information about subgraphs
+ * in the graph. That's because for this manager it doesn't matter which
+ * subgraph a node belongs to (each pruning creates a new subgraph). Also, this
+ * manager adds a label to each collapsed node showing number of its successors.
+ * </p>
+ * One instance of this class can serve only one instance of <code>Graph</code>.
+ *
+ * @since 2.0
+ */
+public class DAGExpandCollapseManager implements ExpandCollapseManager {
+
+ private InternalLayoutContext context;
+
+ private HashSet expandedNodes = new HashSet();
+
+ private HashSet nodesToPrune = new HashSet();
+
+ private HashSet nodesToUnprune = new HashSet();
+
+ private HashSet nodesToUpdate = new HashSet();
+
+ private boolean cleanLayoutScheduled = false;
+
+ public void initExpansion(final LayoutContext context2) {
+ if (!(context2 instanceof InternalLayoutContext)) {
+ throw new RuntimeException(
+ "This manager works only with org.eclipse.zest.core.widgets.InternalLayoutContext");
+ }
+ context = (InternalLayoutContext) context2;
+
+ context.addGraphStructureListener(new GraphStructureListener() {
+ public boolean nodeRemoved(LayoutContext context, NodeLayout node) {
+ if (isExpanded(node)) {
+ collapse(node);
+ }
+ flushChanges(false, true);
+ return false;
+ }
+
+ public boolean nodeAdded(LayoutContext context, NodeLayout node) {
+ resetState(node);
+ flushChanges(false, true);
+ return false;
+ }
+
+ public boolean connectionRemoved(LayoutContext context,
+ ConnectionLayout connection) {
+ NodeLayout target = connection.getTarget();
+ if (!isExpanded(target)
+ && target.getIncomingConnections().length == 0) {
+ expand(target);
+ }
+ flushChanges(false, true);
+ return false;
+ }
+
+ public boolean connectionAdded(LayoutContext context,
+ ConnectionLayout connection) {
+ resetState(connection.getTarget());
+ updateNodeLabel(connection.getSource());
+ flushChanges(false, true);
+ return false;
+ }
+
+ });
+
+ context.addContextListener(new ContextListener.Stub() {
+ public void backgroundEnableChanged(LayoutContext context) {
+ flushChanges(false, false);
+ }
+ });
+ }
+
+ public boolean canCollapse(LayoutContext context, NodeLayout node) {
+ return isExpanded(node) && !node.isPruned()
+ && node.getOutgoingConnections().length > 0;
+ }
+
+ public boolean canExpand(LayoutContext context, NodeLayout node) {
+ return !isExpanded(node) && !node.isPruned()
+ && node.getOutgoingConnections().length > 0;
+ }
+
+ private void collapseAllConnections(NodeLayout node) {
+ ConnectionLayout[] outgoingConnections = node.getOutgoingConnections();
+ for (int i = 0; i < outgoingConnections.length; i++) {
+ outgoingConnections[i].setVisible(false);
+ }
+ flushChanges(true, true);
+ }
+
+ private void expandAllConnections(NodeLayout node) {
+ ConnectionLayout[] outgoingConnections = node.getOutgoingConnections();
+ for (int i = 0; i < outgoingConnections.length; i++) {
+ outgoingConnections[i].setVisible(true);
+ }
+ flushChanges(true, true);
+ }
+
+ public void setExpanded(LayoutContext context, NodeLayout node,
+ boolean expanded) {
+
+ // if (isExpanded(node) == expanded)
+ // return;
+ if (expanded) {
+ if (canExpand(context, node)) {
+ expand(node);
+ }
+ expandAllConnections(node);
+ } else {
+ if (canCollapse(context, node)) {
+ collapse(node);
+ }
+ collapseAllConnections(node);
+ }
+ flushChanges(true, true);
+ }
+
+ private void expand(NodeLayout node) {
+ setExpanded(node, true);
+ NodeLayout[] successingNodes = node.getSuccessingNodes();
+ for (int i = 0; i < successingNodes.length; i++) {
+ unpruneNode(successingNodes[i]);
+ }
+ updateNodeLabel(node);
+ }
+
+ private void collapse(NodeLayout node) {
+ if (isExpanded(node)) {
+ setExpanded(node, false);
+ } else {
+ return;
+ }
+ NodeLayout[] successors = node.getSuccessingNodes();
+ for (int i = 0; i < successors.length; i++) {
+ checkPruning(successors[i]);
+ if (isPruned(successors[i])) {
+ collapse(successors[i]);
+ }
+ }
+ updateNodeLabel(node);
+ }
+
+ private void checkPruning(NodeLayout node) {
+ boolean prune = true;
+ NodeLayout[] predecessors = node.getPredecessingNodes();
+ for (int j = 0; j < predecessors.length; j++) {
+ if (isExpanded(predecessors[j])) {
+ prune = false;
+ break;
+ }
+ }
+ if (prune) {
+ pruneNode(node);
+ } else {
+ unpruneNode(node);
+ }
+ }
+
+ /**
+ * By default nodes at the top (having no predecessors) are expanded. The
+ * rest are collapsed and pruned if they don't have any expanded
+ * predecessors
+ *
+ * @param target
+ */
+ private void resetState(NodeLayout node) {
+ NodeLayout[] predecessors = node.getPredecessingNodes();
+ if (predecessors.length == 0) {
+ expand(node);
+ } else {
+ collapse(node);
+ checkPruning(node);
+ }
+ }
+
+ /**
+ * If given node belongs to a layout context using
+ * {@link PrunedSuccessorsSubgraph}, update of the nodes's label is forced.
+ *
+ * @param node
+ * node to update
+ */
+ private void updateNodeLabel(NodeLayout node) {
+ nodesToUpdate.add(node);
+ }
+
+ private void updateNodeLabel2(InternalNodeLayout node) {
+ SubgraphFactory subgraphFactory = node.getOwnerLayoutContext()
+ .getSubgraphFactory();
+ if (subgraphFactory instanceof DefaultSubgraph.PrunedSuccessorsSubgraphFactory) {
+ ((DefaultSubgraph.PrunedSuccessorsSubgraphFactory) subgraphFactory)
+ .updateLabelForNode(node);
+ }
+ }
+
+ private void pruneNode(NodeLayout node) {
+ if (isPruned(node)) {
+ return;
+ }
+ nodesToUnprune.remove(node);
+ nodesToPrune.add(node);
+ }
+
+ private void unpruneNode(NodeLayout node) {
+ if (!isPruned(node)) {
+ return;
+ }
+ nodesToPrune.remove(node);
+ nodesToUnprune.add(node);
+ }
+
+ private boolean isPruned(NodeLayout node) {
+ if (nodesToUnprune.contains(node)) {
+ return false;
+ }
+ if (nodesToPrune.contains(node)) {
+ return true;
+ }
+ return node.isPruned();
+ }
+
+ private void flushChanges(boolean force, boolean clean) {
+ cleanLayoutScheduled = cleanLayoutScheduled || clean;
+ if (!force && !context.isBackgroundLayoutEnabled()) {
+ return;
+ }
+
+ for (Iterator iterator = nodesToUnprune.iterator(); iterator.hasNext();) {
+ NodeLayout node = (NodeLayout) iterator.next();
+ node.prune(null);
+ }
+ nodesToUnprune.clear();
+
+ if (!nodesToPrune.isEmpty()) {
+ context.createSubgraph((NodeLayout[]) nodesToPrune
+ .toArray(new NodeLayout[nodesToPrune.size()]));
+ nodesToPrune.clear();
+ }
+
+ for (Iterator iterator = nodesToUpdate.iterator(); iterator.hasNext();) {
+ InternalNodeLayout node = (InternalNodeLayout) iterator.next();
+ updateNodeLabel2(node);
+ }
+ nodesToUpdate.clear();
+
+ (context).applyLayout(cleanLayoutScheduled);
+ cleanLayoutScheduled = false;
+ context.flushChanges(true);
+ }
+
+ private boolean isExpanded(NodeLayout node) {
+ return expandedNodes.contains(node);
+ }
+
+ private void setExpanded(NodeLayout node, boolean expanded) {
+ if (expanded) {
+ expandedNodes.add(node);
+ } else {
+ expandedNodes.remove(node);
+ }
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DefaultSubgraph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DefaultSubgraph.java
new file mode 100644
index 0000000..4093f68
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/DefaultSubgraph.java
@@ -0,0 +1,380 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.zest.core.widgets.custom.LabelSubgraph;
+import org.eclipse.zest.core.widgets.custom.TriangleSubgraph;
+import org.eclipse.zest.core.widgets.custom.TriangleSubgraph.TriangleParameters;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentDimension;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle;
+import org.eclipse.zest.layouts.interfaces.ConnectionLayout;
+import org.eclipse.zest.layouts.interfaces.EntityLayout;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+import org.eclipse.zest.layouts.interfaces.SubgraphLayout;
+
+/**
+ * Default implementation of {@link SubgraphLayout}. Every subgraph added to
+ * Zest {@link Graph} should inherit from this class. The default implementation
+ * is very simple. A node pruned to this subgraph is minimized and all
+ * connections adjacent to it are made invisible. No additional graphic elements
+ * are added to the graph, but subclasses may add them.
+ *
+ * @since 2.0
+ */
+public class DefaultSubgraph implements SubgraphLayout {
+
+ /**
+ * Default factory for {@link DefaultSubgraph}. It creates one subgraph for
+ * a whole graph and throws every node intimageo it.
+ */
+ public static class DefaultSubgraphFactory implements SubgraphFactory {
+ private HashMap contextToSubgraph = new HashMap();
+
+ public SubgraphLayout createSubgraph(NodeLayout[] nodes,
+ LayoutContext context) {
+ DefaultSubgraph subgraph = (DefaultSubgraph) contextToSubgraph
+ .get(context);
+ if (subgraph == null) {
+ subgraph = new DefaultSubgraph(context);
+ contextToSubgraph.put(context, subgraph);
+ }
+ subgraph.addNodes(nodes);
+ return subgraph;
+ }
+ };
+
+ public static class LabelSubgraphFactory implements SubgraphFactory {
+ private Color defaultForegroundColor = ColorConstants.black;
+ private Color defaultBackgroundColor = ColorConstants.yellow;
+
+ /**
+ * Changes the default foreground color for newly created subgraphs.
+ *
+ * @param c
+ * color to use
+ */
+ public void setDefualtForegroundColor(Color c) {
+ defaultForegroundColor = c;
+ }
+
+ /**
+ * Changes the default background color for newly created subgraphs.
+ *
+ * @param c
+ * color to use
+ */
+ public void setDefaultBackgroundColor(Color c) {
+ defaultBackgroundColor = c;
+ }
+
+ public SubgraphLayout createSubgraph(NodeLayout[] nodes,
+ LayoutContext context) {
+ return new LabelSubgraph(nodes, context, defaultForegroundColor,
+ defaultBackgroundColor);
+ }
+ };
+
+ public static class TriangleSubgraphFactory implements SubgraphFactory {
+ private TriangleParameters parameters = new TriangleParameters();
+
+ public SubgraphLayout createSubgraph(NodeLayout[] nodes,
+ LayoutContext context) {
+ return new TriangleSubgraph(nodes, context,
+ (TriangleParameters) parameters.clone());
+ }
+
+ /**
+ *
+ * @return initial color of triangles created with this factory
+ */
+ public Color getColor() {
+ return parameters.color;
+ }
+
+ /**
+ * Changes the default color for newly created subgraphs.
+ *
+ * @param color
+ * color to use
+ */
+ public void setColor(Color color) {
+ parameters.color = color;
+ }
+
+ /**
+ *
+ * @return initial direction of triangles created with this factory
+ */
+ public int getDirection() {
+ return parameters.direction;
+ }
+
+ /**
+ * Changes the default direction for newly cretaed subgraphs.
+ *
+ * @param direction
+ * direction to use, can be {@link SubgraphLayout#TOP_DOWN},
+ * {@link SubgraphLayout#BOTTOM_UP},
+ * {@link SubgraphLayout#LEFT_RIGHT}, or
+ * {@link SubgraphLayout#RIGHT_LEFT}
+ */
+ public void setDirection(int direction) {
+ parameters.direction = direction;
+ }
+
+ /**
+ *
+ * @return maximum height of triangles created with this factory
+ */
+ public double getReferenceHeight() {
+ return parameters.referenceHeight;
+ }
+
+ /**
+ * Sets the maximum height for the triangle visualizing this subgraph.
+ *
+ * @param referenceHeight
+ * height to use
+ */
+ public void setReferenceHeight(double referenceHeight) {
+ parameters.referenceHeight = referenceHeight;
+ }
+
+ /**
+ *
+ * @return maximum base length of triangles created with this factory
+ */
+ public double getReferenceBase() {
+ return parameters.referenceBase;
+ }
+
+ /**
+ * Sets the maximum base length for the triangle visualizing this
+ * subgraph.
+ *
+ * @param referenceBase
+ * base length to use
+ */
+
+ public void setReferenceBase(double referenceBase) {
+ parameters.referenceBase = referenceBase;
+ }
+ };
+
+ /**
+ * Factory for {@link PrunedSuccessorsSubgraph}. It creates one subgraph for
+ * a whole graph and throws every node into it.
+ */
+ public static class PrunedSuccessorsSubgraphFactory implements
+ SubgraphFactory {
+ private HashMap contextToSubgraph = new HashMap();
+
+ public SubgraphLayout createSubgraph(NodeLayout[] nodes,
+ LayoutContext context) {
+ PrunedSuccessorsSubgraph subgraph = (PrunedSuccessorsSubgraph) contextToSubgraph
+ .get(context);
+ if (subgraph == null) {
+ subgraph = new PrunedSuccessorsSubgraph(context);
+ contextToSubgraph.put(context, subgraph);
+ }
+ subgraph.addNodes(nodes);
+ return subgraph;
+ }
+
+ /**
+ * Updates a label for given node (creates the label if necessary).
+ *
+ * @param node
+ * node to update
+ */
+ public void updateLabelForNode(InternalNodeLayout node) {
+ InternalLayoutContext context = node.getOwnerLayoutContext();
+ PrunedSuccessorsSubgraph subgraph = (PrunedSuccessorsSubgraph) contextToSubgraph
+ .get(context);
+ if (subgraph == null) {
+ subgraph = new PrunedSuccessorsSubgraph(context);
+ contextToSubgraph.put(context, subgraph);
+ }
+ subgraph.updateNodeLabel(node);
+ }
+
+ };
+
+ protected final InternalLayoutContext context;
+
+ protected final Set nodes = new HashSet();
+
+ protected boolean disposed = false;
+
+ protected DefaultSubgraph(LayoutContext context2) {
+ if (context2 instanceof InternalLayoutContext) {
+ this.context = (InternalLayoutContext) context2;
+ } else {
+ throw new RuntimeException(
+ "This subgraph can be only created with LayoutContext provided by Zest Graph");
+ }
+ }
+
+ public boolean isGraphEntity() {
+ return false;
+ }
+
+ public void setSize(double width, double height) {
+ // do nothing
+ context.checkChangesAllowed();
+ }
+
+ public void setLocation(double x, double y) {
+ // do nothing
+ context.checkChangesAllowed();
+ }
+
+ public boolean isResizable() {
+ return false;
+ }
+
+ public boolean isMovable() {
+ return false;
+ }
+
+ public EntityLayout[] getSuccessingEntities() {
+ return new EntityLayout[0];
+ }
+
+ public DisplayIndependentDimension getSize() {
+ DisplayIndependentRectangle bounds = context.getBounds();
+ return new DisplayIndependentDimension(bounds.width, bounds.height);
+ }
+
+ public double getPreferredAspectRatio() {
+ return 0;
+ }
+
+ public EntityLayout[] getPredecessingEntities() {
+ return new EntityLayout[0];
+ }
+
+ public DisplayIndependentPoint getLocation() {
+ DisplayIndependentRectangle bounds = context.getBounds();
+ return new DisplayIndependentPoint(bounds.x + bounds.width / 2,
+ bounds.y + bounds.height / 2);
+ }
+
+ public boolean isDirectionDependant() {
+ return false;
+ }
+
+ public void setDirection(int direction) {
+ context.checkChangesAllowed();
+ // do nothing
+ }
+
+ public void removeNodes(NodeLayout[] nodes) {
+ context.checkChangesAllowed();
+ for (int i = 0; i < nodes.length; i++) {
+ if (this.nodes.remove(nodes[i])) {
+ nodes[i].prune(null);
+ nodes[i].setMinimized(false);
+ refreshConnectionsVisibility(nodes[i].getIncomingConnections());
+ refreshConnectionsVisibility(nodes[i].getOutgoingConnections());
+ }
+ }
+ if (this.nodes.isEmpty()) {
+ dispose();
+ }
+ }
+
+ public void removeDisposedNodes() {
+ for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
+ InternalNodeLayout node = (InternalNodeLayout) iterator.next();
+ if (node.isDisposed()) {
+ iterator.remove();
+ }
+ }
+ }
+
+ public NodeLayout[] getNodes() {
+ InternalNodeLayout[] result = new InternalNodeLayout[nodes.size()];
+ int i = 0;
+ for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
+ result[i] = (InternalNodeLayout) iterator.next();
+ if (!context.isLayoutItemFiltered(result[i].getNode())) {
+ i++;
+ }
+ }
+ if (i == nodes.size()) {
+ return result;
+ }
+
+ NodeLayout[] result2 = new NodeLayout[i];
+ System.arraycopy(result, 0, result2, 0, i);
+ return result2;
+ }
+
+ public int countNodes() {
+ return nodes.size();
+ }
+
+ public void addNodes(NodeLayout[] nodes) {
+ context.checkChangesAllowed();
+ for (int i = 0; i < nodes.length; i++) {
+ if (this.nodes.add(nodes[i])) {
+ nodes[i].prune(this);
+ nodes[i].setMinimized(true);
+ refreshConnectionsVisibility(nodes[i].getIncomingConnections());
+ refreshConnectionsVisibility(nodes[i].getOutgoingConnections());
+ }
+ }
+ }
+
+ protected void refreshConnectionsVisibility(ConnectionLayout[] connections) {
+ for (int i = 0; i < connections.length; i++) {
+ connections[i].setVisible(!connections[i].getSource().isPruned()
+ && !connections[i].getTarget().isPruned());
+ }
+ }
+
+ /**
+ * Makes sure that value returned by {@link #getLocation()} will be equal to
+ * current location of this subgraph.
+ */
+ protected void refreshLocation() {
+ // do nothing, to be reimplemented in subclasses
+ }
+
+ /**
+ * Makes sure that value returned by {@link #getSize()} will be equal to
+ * current size of this subgraph.
+ */
+ protected void refreshSize() {
+ // do nothing, to be reimplemented in subclasses
+ }
+
+ protected void applyLayoutChanges() {
+ // do nothing
+ }
+
+ protected void dispose() {
+ if (!disposed) {
+ context.removeSubgrah(this);
+ disposed = true;
+ }
+ }
+
+}; \ No newline at end of file
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FigureSubgraph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FigureSubgraph.java
new file mode 100644
index 0000000..35d69db
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FigureSubgraph.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentDimension;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint;
+import org.eclipse.zest.layouts.interfaces.EntityLayout;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+
+/**
+ * A subgraph layout that represents a subgraph as a single figure. An entity
+ * representing subgraph is not resizable by layout algorithm unless proper
+ * methods are redefined in a subclass.
+ *
+ * @since 2.0
+ */
+public abstract class FigureSubgraph extends DefaultSubgraph {
+
+ protected IFigure figure;
+ private DisplayIndependentPoint location;
+ private boolean isLayoutBeingApplied = false;
+
+ /**
+ * Listens to changes in this subgraph's figure and fires proper event in
+ * its layout context.
+ */
+ protected class SubgraphFigrueListener implements FigureListener {
+ private Rectangle previousBounds = figure.getBounds().getCopy();
+
+ public void figureMoved(IFigure source) {
+ if (Animation.isAnimating() || isLayoutBeingApplied) {
+ return;
+ }
+ Rectangle newBounds = figure.getBounds();
+ if (!newBounds.getSize().equals(previousBounds.getSize())) {
+ (context).fireSubgraphResizedEvent(FigureSubgraph.this);
+ } else if (!newBounds.getLocation().equals(previousBounds.getLocation())) {
+ (context).fireSubgraphMovedEvent(FigureSubgraph.this);
+ }
+ previousBounds = newBounds.getCopy();
+ }
+ };
+
+ /**
+ * Creates a figure for this subgraph and stores it in {@link #figure}.
+ *
+ * This method may not be called right after creation of the subgraph but
+ * later when the figure is actually needed (lazy initialization).
+ */
+ protected abstract void createFigure();
+
+ /**
+ * Updates the figure stored in {@link #figure} depending on current nodes
+ * contained in this subgraph. If this method creates a new instance of
+ * IFigure, it should remember to add a {@link SubgraphFigrueListener} to
+ * it.
+ */
+ protected abstract void updateFigure();
+
+ public IFigure getFigure() {
+ if (figure == null) {
+ createFigure();
+ updateFigure();
+ figure.addFigureListener(new SubgraphFigrueListener());
+ (context).container.addSubgraphFigure(figure);
+ }
+ return figure;
+ }
+
+ protected FigureSubgraph(NodeLayout[] nodes, LayoutContext context) {
+ super(context);
+ addNodes(nodes);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * All nodes added to this subgraph are moved to the center of the figure
+ * (so that collapsing and expanding animation looks cool).
+ */
+ public void addNodes(NodeLayout[] nodes) {
+ int initialCount = this.nodes.size();
+ super.addNodes(nodes);
+ if (this.nodes.size() > initialCount && figure != null) {
+ updateFigure();
+ if (location != null) {
+ for (int i = 0; i < nodes.length; i++) {
+ nodes[i].setLocation(location.x, location.y);
+ }
+ }
+ }
+ }
+
+ public void removeNodes(NodeLayout[] nodes) {
+ int initialCount = this.nodes.size();
+ super.removeNodes(nodes);
+ if (this.nodes.size() < initialCount && figure != null && !disposed) {
+ updateFigure();
+ }
+ }
+
+ public EntityLayout[] getSuccessingEntities() {
+ // TODO Auto-generated method stub
+ return super.getSuccessingEntities();
+ }
+
+ public EntityLayout[] getPredecessingEntities() {
+ // TODO Auto-generated method stub
+ return super.getPredecessingEntities();
+ }
+
+ public DisplayIndependentDimension getSize() {
+ Dimension size = getFigure().getSize();
+ return new DisplayIndependentDimension(size.width, size.height);
+ }
+
+ public DisplayIndependentPoint getLocation() {
+ if (location == null) {
+ Point location2 = getFigure().getBounds().getLocation();
+ Dimension size = getFigure().getSize();
+ return new DisplayIndependentPoint(location2.x + size.width / 2, location2.y + size.height / 2);
+ }
+ return new DisplayIndependentPoint(location);
+ }
+
+ public void setLocation(double x, double y) {
+ super.setLocation(x, y);
+ for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
+ NodeLayout node = (NodeLayout) iterator.next();
+ node.setLocation(x, y);
+ }
+
+ if (location != null) {
+ location.x = x;
+ location.y = y;
+ } else {
+ location = new DisplayIndependentPoint(x, y);
+ // the first location change will be applied immediately
+ applyLayoutChanges();
+ }
+ }
+
+ protected void refreshLocation() {
+ Rectangle bounds = figure.getBounds();
+ if (location == null) {
+ location = new DisplayIndependentPoint(0, 0);
+ }
+ location.x = bounds.x + bounds.width / 2;
+ location.y = bounds.y + bounds.height / 2;
+ }
+
+ public boolean isGraphEntity() {
+ return true;
+ }
+
+ public boolean isMovable() {
+ return true;
+ }
+
+ protected void dispose() {
+ if (!disposed) {
+ super.dispose();
+ if (figure != null) {
+ context.container.getGraph().removeSubgraphFigure(figure);
+ }
+ }
+ }
+
+ protected void applyLayoutChanges() {
+ getFigure();
+ if (location != null) {
+ isLayoutBeingApplied = true;
+ Dimension size = figure.getSize();
+ figure.setLocation(new PrecisionPoint(location.x - size.width / 2, location.y - size.height / 2));
+ isLayoutBeingApplied = false;
+ }
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FisheyeListener.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FisheyeListener.java
new file mode 100644
index 0000000..5ad36f9
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/FisheyeListener.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import org.eclipse.draw2d.IFigure;
+
+/**
+ * Interface for listener that can be added to {@link Graph} and receive
+ * notifications when fisheye figures are added, removed or replaced in it.
+ *
+ * @since 2.0
+ */
+public interface FisheyeListener {
+
+ /**
+ * Called when a fisheye figure is added to an observed graph.
+ *
+ * @param graph
+ * observed graph
+ * @param originalFigure
+ * figure to be fisheyed
+ * @param fisheyeFigure
+ * the added fisheye figure
+ */
+ public void fisheyeAdded(Graph graph, IFigure originalFigure,
+ IFigure fisheyeFigure);
+
+ /**
+ * Called when a fisheye figure is removed form an observed graph.
+ *
+ * @param graph
+ * observed graph
+ * @param originalFigure
+ * figure that was fisheyed
+ * @param fisheyeFigure
+ * the removed fisheye figure
+ */
+ public void fisheyeRemoved(Graph graph, IFigure originalFigure,
+ IFigure fisheyeFigure);
+
+ /**
+ * Called when one fisheye figure is replaced by another in an observed
+ * graph.
+ *
+ * @param graph
+ * observed graph
+ * @param oldFisheyeFigure
+ * fisheye figure that is replaced
+ * @param newFisheyeFigure
+ * fisheye figure that replaces the old figure
+ */
+ public void fisheyeReplaced(Graph graph, IFigure oldFisheyeFigure,
+ IFigure newFisheyeFigure);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java
new file mode 100644
index 0000000..582fbfc
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/Graph.java
@@ -0,0 +1,1217 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.CoordinateListener;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.FreeformViewport;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LayoutAnimator;
+import org.eclipse.draw2d.MouseMotionListener;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.SWTEventDispatcher;
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.draw2d.ScalableFreeformLayeredPane;
+import org.eclipse.draw2d.ScrollPane;
+import org.eclipse.draw2d.TreeSearch;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.zest.core.widgets.internal.ContainerFigure;
+import org.eclipse.zest.core.widgets.internal.ZestRootLayer;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle;
+import org.eclipse.zest.layouts.interfaces.ExpandCollapseManager;
+
+/**
+ * @since 1.0
+ */
+public class Graph extends FigureCanvas implements IContainer {
+
+ // CLASS CONSTANTS
+ public static final int ANIMATION_TIME = 500;
+ public static final int FISHEYE_ANIMATION_TIME = 100;
+
+ // @tag CGraph.Colors : These are the colour constants for the graph, they
+ // are disposed on clean-up
+ public Color LIGHT_BLUE = new Color(null, 216, 228, 248);
+ public Color LIGHT_BLUE_CYAN = new Color(null, 213, 243, 255);
+ public Color GREY_BLUE = new Color(null, 139, 150, 171);
+ public Color DARK_BLUE = new Color(null, 1, 70, 122);
+ public Color LIGHT_YELLOW = new Color(null, 255, 255, 206);
+
+ public Color HIGHLIGHT_COLOR = ColorConstants.yellow;
+ public Color HIGHLIGHT_ADJACENT_COLOR = ColorConstants.orange;
+ public Color DEFAULT_NODE_COLOR = LIGHT_BLUE;
+
+ /**
+ * These are all the children of this graph. These lists contains all nodes
+ * and connections that have added themselves to this graph.
+ */
+ private List nodes;
+ protected List connections;
+ HashSet subgraphFigures;
+ private List selectedItems = null;
+ private ArrayList fisheyeListeners = new ArrayList();
+ private List selectionListeners = null;
+
+ /** This maps all visible nodes to their model element. */
+ private HashMap figure2ItemMap = null;
+
+ private int connectionStyle;
+ private int nodeStyle;
+ private ScalableFreeformLayeredPane fishEyeLayer = null;
+ private InternalLayoutContext layoutContext = null;
+ private volatile boolean shouldSheduleLayout;
+ private volatile Runnable scheduledLayoutRunnable = null;
+ private volatile boolean scheduledLayoutClean = false;
+ private Dimension preferredSize = null;
+ int style = 0;
+
+ private ScalableFreeformLayeredPane rootlayer;
+ private ZestRootLayer zestRootLayer;
+
+ /**
+ * Constructor for a Graph. This widget represents the root of the graph,
+ * and can contain graph items such as graph nodes and graph connections.
+ *
+ * @param parent
+ * @param style
+ */
+ public Graph(Composite parent, int style) {
+ super(parent, style | SWT.DOUBLE_BUFFERED);
+ this.style = style;
+ this.setBackground(ColorConstants.white);
+
+ this.setViewport(new FreeformViewport());
+
+ this.getVerticalBar().addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Graph.this.redraw();
+ }
+
+ });
+ this.getHorizontalBar().addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Graph.this.redraw();
+ }
+ });
+
+ // @tag CGraph.workaround : this allows me to handle mouse events
+ // outside of the canvas
+ this.getLightweightSystem().setEventDispatcher(
+ new SWTEventDispatcher() {
+ public void dispatchMouseMoved(
+ org.eclipse.swt.events.MouseEvent me) {
+ super.dispatchMouseMoved(me);
+
+ // If the current event is null, return
+ if (getCurrentEvent() == null) {
+ return;
+ }
+
+ if (getMouseTarget() == null) {
+ setMouseTarget(getRoot());
+ }
+ if ((me.stateMask & SWT.BUTTON_MASK) != 0) {
+ // Sometimes getCurrentEvent() returns null
+ getMouseTarget().handleMouseDragged(
+ getCurrentEvent());
+ } else {
+ getMouseTarget()
+ .handleMouseMoved(getCurrentEvent());
+ }
+ }
+ });
+
+ this.setContents(createLayers());
+ DragSupport dragSupport = new DragSupport();
+ this.getLightweightSystem().getRootFigure().addMouseListener(
+ dragSupport);
+ this.getLightweightSystem().getRootFigure().addMouseMotionListener(
+ dragSupport);
+
+ this.nodes = new ArrayList();
+ this.preferredSize = new Dimension(-1, -1);
+ this.connectionStyle = ZestStyles.NONE;
+ this.nodeStyle = ZestStyles.NONE;
+ this.connections = new ArrayList();
+ this.subgraphFigures = new HashSet();
+ this.selectedItems = new ArrayList();
+ this.selectionListeners = new ArrayList();
+ this.figure2ItemMap = new HashMap();
+
+ this.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ if (shouldSheduleLayout) {
+ applyLayoutInternal(true);
+ shouldSheduleLayout = false;
+ }
+ }
+ });
+
+ this.addControlListener(new ControlListener() {
+
+ public void controlResized(ControlEvent e) {
+ if (preferredSize.width == -1 || preferredSize.height == -1) {
+ getLayoutContext().fireBoundsChangedEvent();
+ }
+ }
+
+ public void controlMoved(ControlEvent e) {
+ // do nothing
+ }
+ });
+ }
+
+ /**
+ * This adds a listener to the set of listeners that will be called when a
+ * selection event occurs.
+ *
+ * @param selectionListener
+ */
+ public void addSelectionListener(SelectionListener selectionListener) {
+ if (!selectionListeners.contains(selectionListener)) {
+ selectionListeners.add(selectionListener);
+ }
+ }
+
+ public void removeSelectionListener(SelectionListener selectionListener) {
+ if (selectionListeners.contains(selectionListener)) {
+ selectionListeners.remove(selectionListener);
+ }
+ }
+
+ /**
+ * Gets a list of the GraphModelNode children objects under the root node in
+ * this diagram. If the root node is null then all the top level nodes are
+ * returned.
+ *
+ * @return List of GraphModelNode objects
+ */
+ public List getNodes() {
+ return nodes;
+ }
+
+ /**
+ * Gets the root layer for this graph
+ *
+ * @return
+ */
+ public ScalableFigure getRootLayer() {
+ return rootlayer;
+ }
+
+ /**
+ * Sets the default connection style.
+ *
+ * @param connection
+ * style the connection style to set
+ * @see org.eclipse.mylar.zest.core.widgets.ZestStyles
+ */
+ public void setConnectionStyle(int connectionStyle) {
+ this.connectionStyle = connectionStyle;
+ }
+
+ /**
+ * Gets the default connection style.
+ *
+ * @return the connection style
+ * @see org.eclipse.mylar.zest.core.widgets.ZestStyles
+ */
+ public int getConnectionStyle() {
+ return connectionStyle;
+ }
+
+ /**
+ * Sets the default node style.
+ *
+ * @param nodeStyle
+ * the node style to set
+ * @see org.eclipse.mylar.zest.core.widgets.ZestStyles
+ */
+ public void setNodeStyle(int nodeStyle) {
+ this.nodeStyle = nodeStyle;
+ }
+
+ /**
+ * Gets the default node style.
+ *
+ * @return the node style
+ * @see org.eclipse.mylar.zest.core.widgets.ZestStyles
+ */
+ public int getNodeStyle() {
+ return nodeStyle;
+ }
+
+ /**
+ * Gets the list of GraphModelConnection objects.
+ *
+ * @return list of GraphModelConnection objects
+ */
+ public List getConnections() {
+ return this.connections;
+ }
+
+ /**
+ * Changes the selection to the list of items
+ *
+ * @param l
+ */
+ public void setSelection(GraphItem[] nodes) {
+ clearSelection();
+ if (nodes != null) {
+ for (int i = 0; i < nodes.length; i++) {
+ if (nodes[i] != null && nodes[i] instanceof GraphItem) {
+ selectedItems.add(nodes[i]);
+ (nodes[i]).highlight();
+ }
+ }
+ }
+ // TODO shouldn't this method fire a selection event?
+ }
+
+ public void selectAll() {
+ clearSelection();
+ for (int i = 0; i < nodes.size(); i++) {
+ selectedItems.add(nodes.get(i));
+ ((GraphNode) nodes.get(i)).highlight();
+ }
+ // TODO shouldn't this method fire a selection event?
+ }
+
+ /**
+ * Gets the list of currently selected GraphNodes
+ *
+ * @return Currently selected graph node
+ */
+ public List getSelection() {
+ return selectedItems;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Widget#toString()
+ */
+ public String toString() {
+ return "GraphModel {" + nodes.size() + " nodes, " + connections.size()
+ + " connections}";
+ }
+
+ /**
+ * Dispose of the nodes and edges when the graph is disposed.
+ */
+ public void dispose() {
+ while (nodes.size() > 0) {
+ GraphNode node = (GraphNode) nodes.get(0);
+ if (node != null && !node.isDisposed()) {
+ node.dispose();
+ }
+ }
+ while (connections.size() > 0) {
+ GraphConnection connection = (GraphConnection) connections.get(0);
+ if (connection != null && !connection.isDisposed()) {
+ connection.dispose();
+ }
+ }
+ super.dispose();
+
+ LIGHT_BLUE.dispose();
+ LIGHT_BLUE_CYAN.dispose();
+ GREY_BLUE.dispose();
+ DARK_BLUE.dispose();
+ LIGHT_YELLOW.dispose();
+ }
+
+ /**
+ * Runs the layout on this graph. If the view is not visible layout will be
+ * deferred until after the view is available.
+ */
+ public void applyLayout() {
+ scheduleLayoutOnReveal(true);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void applyLayoutNow() {
+ getLayoutContext().applyLayout(true);
+ layoutContext.flushChanges(false);
+ }
+
+ /**
+ * Enables or disables dynamic layout (that is layout algorithm performing
+ * layout in background or when certain events occur). Dynamic layout should
+ * be disabled before doing a long series of changes in the graph to make
+ * sure that layout algorithm won't interfere with these changes.
+ *
+ * Enabling dynamic layout causes the layout algorithm to be applied even if
+ * it's not actually a dynamic algorithm.
+ *
+ * @param enabled
+ *
+ * @since 2.0
+ */
+ public void setDynamicLayout(boolean enabled) {
+ if (getLayoutContext().isBackgroundLayoutEnabled() != enabled) {
+ layoutContext.setBackgroundLayoutEnabled(enabled);
+ if (enabled) {
+ scheduleLayoutOnReveal(false);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return true if dynamic layout is enabled (see
+ * {@link #setDynamicLayout(boolean)})
+ * @since 2.0
+ */
+ public boolean isDynamicLayoutEnabled() {
+ return getLayoutContext().isBackgroundLayoutEnabled();
+ }
+
+ private void applyLayoutInternal(boolean clean) {
+ if (getLayoutContext().getLayoutAlgorithm() == null) {
+ return;
+ }
+ scheduledLayoutClean = scheduledLayoutClean || clean;
+ synchronized (this) {
+ if (scheduledLayoutRunnable == null) {
+ Display.getDefault().asyncExec(
+ scheduledLayoutRunnable = new Runnable() {
+ public void run() {
+ Animation.markBegin();
+ getLayoutContext().applyLayout(
+ scheduledLayoutClean);
+ layoutContext.flushChanges(false);
+ Animation.run(ANIMATION_TIME);
+ getLightweightSystem().getUpdateManager()
+ .performUpdate();
+ synchronized (Graph.this) {
+ scheduledLayoutRunnable = null;
+ scheduledLayoutClean = false;
+ }
+ }
+ });
+ }
+ }
+ }
+
+ /**
+ * Sets the preferred size of the layout area. Size of ( -1, -1) uses the
+ * current canvas size.
+ *
+ * @param width
+ * @param height
+ */
+ public void setPreferredSize(int width, int height) {
+ this.preferredSize = new Dimension(width, height);
+ getLayoutContext().fireBoundsChangedEvent();
+ }
+
+ /**
+ * @return the preferred size of the layout area.
+ * @since 2.0
+ */
+ public Dimension getPreferredSize() {
+ if (preferredSize.width < 0 || preferredSize.height < 0) {
+ org.eclipse.swt.graphics.Point size = getSize();
+ double scale = getRootLayer().getScale();
+ return new Dimension((int) (size.x / scale + 0.5), (int) (size.y
+ / scale + 0.5));
+ }
+ return preferredSize;
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public InternalLayoutContext getLayoutContext() {
+ if (layoutContext == null) {
+ layoutContext = new InternalLayoutContext(this);
+ }
+ return layoutContext;
+ }
+
+ /**
+ * @param algorithm
+ * @since 2.0
+ */
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm,
+ boolean applyLayout) {
+ getLayoutContext().setLayoutAlgorithm(algorithm);
+ if (applyLayout) {
+ applyLayout();
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ public LayoutAlgorithm getLayoutAlgorithm() {
+ return getLayoutContext().getLayoutAlgorithm();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void setSubgraphFactory(SubgraphFactory factory) {
+ getLayoutContext().setSubgraphFactory(factory);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public SubgraphFactory getSubgraphFactory() {
+ return getLayoutContext().getSubgraphFactory();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void setExpandCollapseManager(
+ ExpandCollapseManager expandCollapseManager) {
+ getLayoutContext().setExpandCollapseManager(expandCollapseManager);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public ExpandCollapseManager getExpandCollapseManager() {
+ return getLayoutContext().getExpandCollapseManager();
+ }
+
+ /**
+ * Adds a filter used for hiding elements from layout algorithm.
+ *
+ * NOTE: If a node or subgraph if filtered out, all connections adjacent to
+ * it should also be filtered out. Otherwise layout algorithm may behave in
+ * an unexpected way.
+ *
+ * @param filter
+ * filter to add
+ * @since 2.0
+ */
+ public void addLayoutFilter(LayoutFilter filter) {
+ getLayoutContext().addFilter(filter);
+ }
+
+ /**
+ * Removes given layout filter. If it had not been added to this graph, this
+ * method does nothing.
+ *
+ * @param filter
+ * filter to remove
+ * @since 2.0
+ */
+ public void removeLayoutFilter(LayoutFilter filter) {
+ getLayoutContext().removeFilter(filter);
+ }
+
+ /**
+ * Finds a figure at the location X, Y in the graph
+ *
+ * This point should be translated to relative before calling findFigureAt
+ */
+ public IFigure getFigureAt(int x, int y) {
+ IFigure figureUnderMouse = this.getContents().findFigureAt(x, y,
+ new TreeSearch() {
+
+ public boolean accept(IFigure figure) {
+ return true;
+ }
+
+ public boolean prune(IFigure figure) {
+ IFigure parent = figure.getParent();
+ // @tag TODO Zest : change these to from getParent to
+ // their
+ // actual layer names
+
+ if (parent == fishEyeLayer) {
+ // If it node is on the fish eye layer, don't worry
+ // about
+ // it.
+ return true;
+ }
+ if (parent instanceof ContainerFigure
+ && figure instanceof PolylineConnection) {
+ return false;
+ }
+ if (parent == zestRootLayer
+ || parent == zestRootLayer.getParent()
+ || parent == zestRootLayer.getParent()
+ .getParent()) {
+ return false;
+ }
+ GraphItem item = (GraphItem) figure2ItemMap.get(figure);
+ if (item != null
+ && item.getItemType() == GraphItem.CONTAINER) {
+ return false;
+ } else if (figure instanceof FreeformLayer
+ || parent instanceof FreeformLayer
+ || figure instanceof ScrollPane
+ || parent instanceof ScrollPane
+ || parent instanceof ScalableFreeformLayeredPane
+ || figure instanceof ScalableFreeformLayeredPane
+ || figure instanceof FreeformViewport
+ || parent instanceof FreeformViewport) {
+ return false;
+ }
+ return true;
+ }
+
+ });
+ return figureUnderMouse;
+
+ }
+
+ private class DragSupport implements MouseMotionListener,
+ org.eclipse.draw2d.MouseListener {
+
+ Point dragStartLocation = null;
+ IFigure draggedSubgraphFigure = null;
+ /** locations of dragged items relative to cursor position */
+ ArrayList relativeLocations = new ArrayList();
+ GraphItem fisheyedItem = null;
+ boolean isDragging = false;
+
+ public void mouseDragged(org.eclipse.draw2d.MouseEvent me) {
+ if (!isDragging) {
+ return;
+ }
+ if (selectedItems.isEmpty()) {
+ IFigure figureUnderMouse = getFigureAt(dragStartLocation.x,
+ dragStartLocation.y);
+ if (subgraphFigures.contains(figureUnderMouse)) {
+ draggedSubgraphFigure = figureUnderMouse;
+ }
+ }
+
+ Point mousePoint = new Point(me.x, me.y);
+ if (!selectedItems.isEmpty() || draggedSubgraphFigure != null) {
+
+ if (relativeLocations.isEmpty()) {
+ for (Iterator iterator = selectedItems.iterator(); iterator
+ .hasNext();) {
+ GraphItem item = (GraphItem) iterator.next();
+ if ((item.getItemType() == GraphItem.NODE)
+ || (item.getItemType() == GraphItem.CONTAINER)) {
+ relativeLocations.add(getRelativeLocation(item
+ .getFigure()));
+ }
+ }
+ if (draggedSubgraphFigure != null) {
+ relativeLocations
+ .add(getRelativeLocation(draggedSubgraphFigure));
+ }
+ }
+
+ Iterator locationsIterator = relativeLocations.iterator();
+ for (Iterator selectionIterator = selectedItems.iterator(); selectionIterator
+ .hasNext();) {
+ GraphItem item = (GraphItem) selectionIterator.next();
+ if ((item.getItemType() == GraphItem.NODE)
+ || (item.getItemType() == GraphItem.CONTAINER)) {
+ Point pointCopy = mousePoint.getCopy();
+ Point relativeLocation = (Point) locationsIterator
+ .next();
+
+ item.getFigure().getParent().translateToRelative(
+ pointCopy);
+ item.getFigure().getParent().translateFromParent(
+ pointCopy);
+
+ ((GraphNode) item)
+ .setLocation(relativeLocation.x + pointCopy.x,
+ relativeLocation.y + pointCopy.y);
+ } else {
+ // There is no movement for connection
+ }
+ }
+ if (draggedSubgraphFigure != null) {
+ Point pointCopy = mousePoint.getCopy();
+ draggedSubgraphFigure.getParent().translateToRelative(
+ pointCopy);
+ draggedSubgraphFigure.getParent().translateFromParent(
+ pointCopy);
+ Point relativeLocation = (Point) locationsIterator.next();
+ pointCopy.x += relativeLocation.x;
+ pointCopy.y += relativeLocation.y;
+
+ draggedSubgraphFigure.setLocation(pointCopy);
+ }
+ }
+ }
+
+ private Point getRelativeLocation(IFigure figure) {
+ Point location = figure.getBounds().getTopLeft();
+ Point mousePointCopy = dragStartLocation.getCopy();
+ figure.getParent().translateToRelative(mousePointCopy);
+ figure.getParent().translateFromParent(mousePointCopy);
+ location.x -= mousePointCopy.x;
+ location.y -= mousePointCopy.y;
+ return location;
+ }
+
+ public void mouseEntered(org.eclipse.draw2d.MouseEvent me) {
+
+ }
+
+ public void mouseExited(org.eclipse.draw2d.MouseEvent me) {
+
+ }
+
+ public void mouseHover(org.eclipse.draw2d.MouseEvent me) {
+
+ }
+
+ /**
+ * This tracks whenever a mouse moves. The only thing we care about is
+ * fisheye(ing) nodes. This means whenever the mouse moves we check if
+ * we need to fisheye on a node or not.
+ */
+ public void mouseMoved(org.eclipse.draw2d.MouseEvent me) {
+ Point mousePoint = new Point(me.x, me.y);
+ getRootLayer().translateToRelative(mousePoint);
+ IFigure figureUnderMouse = getFigureAt(mousePoint.x, mousePoint.y);
+
+ if (figureUnderMouse != null) {
+ // There is a figure under this mouse
+ GraphItem itemUnderMouse = (GraphItem) figure2ItemMap
+ .get(figureUnderMouse);
+ if (itemUnderMouse == fisheyedItem) {
+ return;
+ }
+ if (fisheyedItem != null) {
+ ((GraphNode) fisheyedItem).fishEye(false, true);
+ fisheyedItem = null;
+ }
+ if (itemUnderMouse != null
+ && itemUnderMouse.getItemType() == GraphItem.NODE) {
+ fisheyedItem = itemUnderMouse;
+ IFigure fisheyedFigure = ((GraphNode) itemUnderMouse)
+ .fishEye(true, true);
+ if (fisheyedFigure == null) {
+ // If there is no fisheye figure (this means that the
+ // node does not support a fish eye)
+ // then remove the fisheyed item
+ fisheyedItem = null;
+ }
+ }
+ } else {
+ if (fisheyedItem != null) {
+ ((GraphNode) fisheyedItem).fishEye(false, true);
+ fisheyedItem = null;
+ }
+ }
+ }
+
+ public void mouseDoubleClicked(org.eclipse.draw2d.MouseEvent me) {
+
+ }
+
+ public void mousePressed(org.eclipse.draw2d.MouseEvent me) {
+ isDragging = true;
+ Point mousePoint = new Point(me.x, me.y);
+ dragStartLocation = mousePoint.getCopy();
+
+ getRootLayer().translateToRelative(mousePoint);
+
+ if (me.getState() == org.eclipse.draw2d.MouseEvent.ALT) {
+ double scale = getRootLayer().getScale();
+ scale *= 1.05;
+ getRootLayer().setScale(scale);
+ Point newMousePoint = mousePoint.getCopy().scale(1.05);
+ Point delta = new Point(newMousePoint.x - mousePoint.x,
+ newMousePoint.y - mousePoint.y);
+ Point newViewLocation = getViewport().getViewLocation()
+ .getCopy().translate(delta);
+ getViewport().setViewLocation(newViewLocation);
+
+ clearSelection();
+ return;
+ } else if (me.getState() == (org.eclipse.draw2d.MouseEvent.ALT | org.eclipse.draw2d.MouseEvent.SHIFT)) {
+ double scale = getRootLayer().getScale();
+ scale /= 1.05;
+ getRootLayer().setScale(scale);
+
+ Point newMousePoint = mousePoint.getCopy().scale(1 / 1.05);
+ Point delta = new Point(newMousePoint.x - mousePoint.x,
+ newMousePoint.y - mousePoint.y);
+ Point newViewLocation = getViewport().getViewLocation()
+ .getCopy().translate(delta);
+ getViewport().setViewLocation(newViewLocation);
+ clearSelection();
+ return;
+ } else {
+ boolean hasSelection = selectedItems.size() > 0;
+ IFigure figureUnderMouse = getFigureAt(mousePoint.x,
+ mousePoint.y);
+ getRootLayer().translateFromParent(mousePoint);
+
+ if (figureUnderMouse != null) {
+ figureUnderMouse.getParent()
+ .translateFromParent(mousePoint);
+ }
+ // If the figure under the mouse is the canvas, and CTRL is not
+ // being held down, then select
+ // nothing
+ if (figureUnderMouse == null || figureUnderMouse == Graph.this) {
+ if (me.getState() != org.eclipse.draw2d.MouseEvent.CONTROL) {
+ clearSelection();
+ if (hasSelection) {
+ fireWidgetSelectedEvent(null);
+ hasSelection = false;
+ }
+ }
+ return;
+ }
+
+ GraphItem itemUnderMouse = (GraphItem) figure2ItemMap
+ .get(figureUnderMouse);
+ if (itemUnderMouse == null) {
+ if (me.getState() != org.eclipse.draw2d.MouseEvent.CONTROL) {
+ clearSelection();
+ if (hasSelection) {
+ fireWidgetSelectedEvent(null);
+ hasSelection = false;
+ }
+ }
+ return;
+ }
+ if (selectedItems.contains(itemUnderMouse)) {
+ // We have already selected this node, and CTRL is being
+ // held down, remove this selection
+ // @tag Zest.selection : This deselects when you have CTRL
+ // pressed
+ if (me.getState() == org.eclipse.draw2d.MouseEvent.CONTROL) {
+ selectedItems.remove(itemUnderMouse);
+ (itemUnderMouse).unhighlight();
+ fireWidgetSelectedEvent(itemUnderMouse);
+ }
+ return;
+ }
+
+ if (me.getState() != org.eclipse.draw2d.MouseEvent.CONTROL) {
+ clearSelection();
+ }
+
+ if (itemUnderMouse.getItemType() == GraphItem.NODE) {
+ // @tag Zest.selection : This is where the nodes are
+ // selected
+ selectedItems.add(itemUnderMouse);
+ ((GraphNode) itemUnderMouse).highlight();
+ fireWidgetSelectedEvent(itemUnderMouse);
+ } else if (itemUnderMouse.getItemType() == GraphItem.CONNECTION) {
+ selectedItems.add(itemUnderMouse);
+ ((GraphConnection) itemUnderMouse).highlight();
+ fireWidgetSelectedEvent(itemUnderMouse);
+
+ } else if (itemUnderMouse.getItemType() == GraphItem.CONTAINER) {
+ selectedItems.add(itemUnderMouse);
+ ((GraphContainer) itemUnderMouse).highlight();
+ fireWidgetSelectedEvent(itemUnderMouse);
+ }
+ }
+
+ }
+
+ public void mouseReleased(org.eclipse.draw2d.MouseEvent me) {
+ isDragging = false;
+ relativeLocations.clear();
+ draggedSubgraphFigure = null;
+ }
+
+ }
+
+ private void clearSelection() {
+ if (selectedItems.size() > 0) {
+ Iterator iterator = selectedItems.iterator();
+ while (iterator.hasNext()) {
+ GraphItem item = (GraphItem) iterator.next();
+ item.unhighlight();
+ iterator.remove();
+ }
+ }
+ }
+
+ private void fireWidgetSelectedEvent(Item item) {
+ Iterator iterator = selectionListeners.iterator();
+ while (iterator.hasNext()) {
+ SelectionListener selectionListener = (SelectionListener) iterator
+ .next();
+ Event swtEvent = new Event();
+ swtEvent.item = item;
+ swtEvent.widget = this;
+ SelectionEvent event = new SelectionEvent(swtEvent);
+ selectionListener.widgetSelected(event);
+ }
+
+ }
+
+ /**
+ * Converts the list of GraphModelConnection objects into an array and
+ * returns it.
+ *
+ * @return GraphModelConnection[]
+ */
+ GraphConnection[] getConnectionsArray() {
+ GraphConnection[] connsArray = new GraphConnection[connections.size()];
+ connsArray = (GraphConnection[]) connections.toArray(connsArray);
+ return connsArray;
+ }
+
+ void removeConnection(GraphConnection connection) {
+ IFigure figure = connection.getConnectionFigure();
+ PolylineConnection sourceContainerConnectionFigure = connection
+ .getSourceContainerConnectionFigure();
+ PolylineConnection targetContainerConnectionFigure = connection
+ .getTargetContainerConnectionFigure();
+ connection.removeFigure();
+ this.getConnections().remove(connection);
+ this.selectedItems.remove(connection);
+ figure2ItemMap.remove(figure);
+ if (sourceContainerConnectionFigure != null) {
+ figure2ItemMap.remove(sourceContainerConnectionFigure);
+ }
+ if (targetContainerConnectionFigure != null) {
+ figure2ItemMap.remove(targetContainerConnectionFigure);
+ }
+ getLayoutContext().fireConnectionRemovedEvent(connection.getLayout());
+ }
+
+ void removeNode(GraphNode node) {
+ IFigure figure = node.getNodeFigure();
+ if (figure.getParent() != null) {
+ figure.getParent().remove(figure);
+ }
+ this.getNodes().remove(node);
+ this.selectedItems.remove(node);
+ figure2ItemMap.remove(figure);
+ node.getLayout().dispose();
+ }
+
+ void addConnection(GraphConnection connection, boolean addToEdgeLayer) {
+ this.getConnections().add(connection);
+ if (addToEdgeLayer) {
+ zestRootLayer.addConnection(connection.getFigure());
+ }
+ getLayoutContext().fireConnectionAddedEvent(connection.getLayout());
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void addNode(GraphNode node) {
+ this.getNodes().add(node);
+ zestRootLayer.addNode(node.getFigure());
+ getLayoutContext().fireNodeAddedEvent(node.getLayout());
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void addSubgraphFigure(IFigure figure) {
+ zestRootLayer.addSubgraph(figure);
+ subgraphFigures.add(figure);
+ }
+
+ void removeSubgraphFigure(IFigure figure) {
+ subgraphFigures.remove(figure);
+ figure.getParent().remove(figure);
+ }
+
+ void registerItem(GraphItem item) {
+ if (item.getItemType() == GraphItem.NODE) {
+ IFigure figure = item.getFigure();
+ figure2ItemMap.put(figure, item);
+ } else if (item.getItemType() == GraphItem.CONNECTION) {
+ IFigure figure = item.getFigure();
+ figure2ItemMap.put(figure, item);
+ if (((GraphConnection) item).getSourceContainerConnectionFigure() != null) {
+ figure2ItemMap.put(((GraphConnection) item)
+ .getSourceContainerConnectionFigure(), item);
+ }
+ if (((GraphConnection) item).getTargetContainerConnectionFigure() != null) {
+ figure2ItemMap.put(((GraphConnection) item)
+ .getTargetContainerConnectionFigure(), item);
+ }
+ } else if (item.getItemType() == GraphItem.CONTAINER) {
+ IFigure figure = item.getFigure();
+ figure2ItemMap.put(figure, item);
+ } else {
+ throw new RuntimeException("Unknown item type: "
+ + item.getItemType());
+ }
+ }
+
+ /**
+ * Schedules a layout to be performed after the view is revealed (or
+ * immediately, if the view is already revealed).
+ *
+ * @param clean
+ */
+ private void scheduleLayoutOnReveal(final boolean clean) {
+
+ final boolean[] isVisibleSync = new boolean[1];
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ isVisibleSync[0] = isVisible();
+ }
+ });
+
+ if (isVisibleSync[0]) {
+ applyLayoutInternal(clean);
+ } else {
+ shouldSheduleLayout = true;
+ }
+ }
+
+ private ScalableFigure createLayers() {
+ rootlayer = new ScalableFreeformLayeredPane();
+ rootlayer.setLayoutManager(new FreeformLayout());
+ zestRootLayer = new ZestRootLayer();
+
+ zestRootLayer.setLayoutManager(new FreeformLayout());
+
+ fishEyeLayer = new ScalableFreeformLayeredPane();
+ fishEyeLayer.setLayoutManager(new FreeformLayout());
+
+ rootlayer.add(zestRootLayer);
+ rootlayer.add(fishEyeLayer);
+
+ zestRootLayer.addLayoutListener(LayoutAnimator.getDefault());
+ fishEyeLayer.addLayoutListener(LayoutAnimator.getDefault());
+
+ rootlayer.addCoordinateListener(new CoordinateListener() {
+ public void coordinateSystemChanged(IFigure source) {
+ if (preferredSize.width == -1 && preferredSize.height == -1) {
+ getLayoutContext().fireBoundsChangedEvent();
+ }
+ }
+ });
+
+ return rootlayer;
+ }
+
+ /**
+ * This removes the fisheye from the graph. It uses an animation to make the
+ * fisheye shrink, and then it finally clears the fisheye layer. This
+ * assumes that there is ever only 1 node on the fisheye layer at any time.
+ *
+ * @param fishEyeFigure
+ * The fisheye figure
+ * @param regularFigure
+ * The regular figure (i.e. the non fisheye version)
+ */
+ void removeFishEye(final IFigure fishEyeFigure,
+ final IFigure regularFigure, boolean animate) {
+
+ if (!fishEyeLayer.getChildren().contains(fishEyeFigure)) {
+ return;
+ }
+ if (animate) {
+ Animation.markBegin();
+ }
+
+ Rectangle bounds = regularFigure.getBounds().getCopy();
+ regularFigure.translateToAbsolute(bounds);
+
+ double scale = rootlayer.getScale();
+ fishEyeLayer.setScale(1 / scale);
+ fishEyeLayer.translateToRelative(bounds);
+ fishEyeLayer.translateFromParent(bounds);
+
+ fishEyeLayer.setConstraint(fishEyeFigure, bounds);
+
+ for (Iterator iterator = fisheyeListeners.iterator(); iterator
+ .hasNext();) {
+ FisheyeListener listener = (FisheyeListener) iterator.next();
+ listener.fisheyeRemoved(this, regularFigure, fishEyeFigure);
+ }
+
+ if (animate) {
+ Animation.run(FISHEYE_ANIMATION_TIME * 2);
+ }
+ this.getRootLayer().getUpdateManager().performUpdate();
+ fishEyeLayer.removeAll();
+
+ }
+
+ /**
+ * Replaces the old fisheye figure with a new one.
+ *
+ * @param oldFigure
+ * @param newFigure
+ */
+ boolean replaceFishFigure(IFigure oldFigure, IFigure newFigure) {
+ if (this.fishEyeLayer.getChildren().contains(oldFigure)) {
+ Rectangle bounds = oldFigure.getBounds();
+ newFigure.setBounds(bounds);
+ this.fishEyeLayer.remove(oldFigure);
+ this.fishEyeLayer.add(newFigure);
+
+ for (Iterator iterator = fisheyeListeners.iterator(); iterator
+ .hasNext();) {
+ FisheyeListener listener = (FisheyeListener) iterator.next();
+ listener.fisheyeReplaced(this, oldFigure, newFigure);
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Add a fisheye version of the node. This works by animating the change
+ * from the original node to the fisheyed one, and then placing the fisheye
+ * node on the fisheye layer.
+ *
+ * @param startFigure
+ * The original node
+ * @param endFigure
+ * The fisheye figure
+ * @param newBounds
+ * The final size of the fisheyed figure
+ */
+ void fishEye(IFigure startFigure, IFigure endFigure, Rectangle newBounds,
+ boolean animate) {
+
+ fishEyeLayer.removeAll();
+
+ if (animate) {
+ Animation.markBegin();
+ }
+
+ double scale = rootlayer.getScale();
+ fishEyeLayer.setScale(1 / scale);
+
+ fishEyeLayer.translateToRelative(newBounds);
+ fishEyeLayer.translateFromParent(newBounds);
+
+ Rectangle bounds = startFigure.getBounds().getCopy();
+ startFigure.translateToAbsolute(bounds);
+ // startFigure.translateToRelative(bounds);
+ fishEyeLayer.translateToRelative(bounds);
+ fishEyeLayer.translateFromParent(bounds);
+
+ endFigure.setLocation(bounds.getLocation());
+ endFigure.setSize(bounds.getSize());
+ fishEyeLayer.add(endFigure);
+ fishEyeLayer.setConstraint(endFigure, newBounds);
+
+ for (Iterator iterator = fisheyeListeners.iterator(); iterator
+ .hasNext();) {
+ FisheyeListener listener = (FisheyeListener) iterator.next();
+ listener.fisheyeAdded(this, startFigure, endFigure);
+ }
+
+ if (animate) {
+ Animation.run(FISHEYE_ANIMATION_TIME);
+ }
+ this.getRootLayer().getUpdateManager().performUpdate();
+ }
+
+ /**
+ * Adds a listener that will be notified when fisheyed figures change in
+ * this graph.
+ *
+ * @param listener
+ * listener to add
+ * @since 2.0
+ */
+ public void addFisheyeListener(FisheyeListener listener) {
+ fisheyeListeners.add(listener);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void removeFisheyeListener(FisheyeListener listener) {
+ fisheyeListeners.remove(listener);
+ }
+
+ public int getItemType() {
+ return GraphItem.GRAPH;
+ }
+
+ GraphItem getGraphItem(IFigure figure) {
+ return (GraphItem) figure2ItemMap.get(figure);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void setExpanded(GraphNode node, boolean expanded) {
+ layoutContext.setExpanded(node.getLayout(), expanded);
+ rootlayer.invalidate();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public boolean canExpand(GraphNode node) {
+ return layoutContext.canExpand(node.getLayout());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public boolean canCollapse(GraphNode node) {
+ return layoutContext.canCollapse(node.getLayout());
+ }
+
+ public Graph getGraph() {
+ return this;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Widget getItem() {
+ return this;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public DisplayIndependentRectangle getLayoutBounds() {
+ Dimension preferredSize = this.getPreferredSize();
+ return new DisplayIndependentRectangle(0, 0, preferredSize.width,
+ preferredSize.height);
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java
new file mode 100644
index 0000000..aa9c125
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphConnection.java
@@ -0,0 +1,739 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.Locator;
+import org.eclipse.draw2d.MidpointLocator;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.widgets.internal.LoopAnchor;
+import org.eclipse.zest.core.widgets.internal.PolylineArcConnection;
+import org.eclipse.zest.core.widgets.internal.RoundedChopboxAnchor;
+import org.eclipse.zest.core.widgets.internal.ZestRootLayer;
+import org.eclipse.zest.layouts.interfaces.ConnectionLayout;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+
+/*
+ * This is the graph connection model which stores the source and destination
+ * nodes and the properties of this connection (color, line width etc).
+ *
+ * @author Chris Callendar
+ *
+ * @author Ian Bull
+ */
+public class GraphConnection extends GraphItem {
+
+ private Font font;
+ private GraphNode sourceNode;
+ private GraphNode destinationNode;
+
+ private double weight;
+ private Color color;
+ private Color highlightColor;
+ private Color foreground;
+ private int lineWidth;
+ private int lineStyle;
+ private final Graph graph;
+
+ private int connectionStyle;
+ private int curveDepth;
+ private boolean isDisposed = false;
+
+ private Label connectionLabel = null;
+ private Connection connectionFigure = null;
+ private Connection sourceContainerConnectionFigure = null;
+ private Connection targetContainerConnectionFigure = null;
+
+ /**
+ * The state of visibility set by the user.
+ */
+ private boolean visible;
+
+ private IFigure tooltip;
+
+ private boolean highlighted;
+ private boolean hasCustomTooltip;
+
+ public GraphConnection(Graph graphModel, int style, GraphNode source,
+ GraphNode destination) {
+ super(graphModel, style);
+
+ this.connectionStyle |= graphModel.getConnectionStyle();
+ this.connectionStyle |= style;
+ this.sourceNode = source;
+ this.destinationNode = destination;
+ this.visible = true;
+ this.color = ColorConstants.lightGray;
+ this.foreground = ColorConstants.lightGray;
+ this.highlightColor = graphModel.DARK_BLUE;
+ this.lineWidth = 1;
+ this.lineStyle = Graphics.LINE_SOLID;
+ setWeight(1.0);
+ this.graph = graphModel;
+ this.curveDepth = 0;
+ this.font = Display.getDefault().getSystemFont();
+ registerConnection(source, destination);
+ }
+
+ private void registerConnection(GraphNode source, GraphNode destination) {
+ if (source.getSourceConnections().contains(this)) {
+ source.removeSourceConnection(this);
+ }
+ if (destination.getTargetConnections().contains(this)) {
+ destination.removeTargetConnection(this);
+ }
+ (source).addSourceConnection(this);
+ (destination).addTargetConnection(this);
+
+ if (source.getParent().getItemType() == GraphItem.CONTAINER
+ && destination.getParent().getItemType() == GraphItem.CONTAINER
+ && (source.getParent() == destination.getParent())) {
+ // 196189: Edges should not draw on the edge layer if both the src
+ // and dest are in the same container
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=196189
+ graph.addConnection(this, false);
+ } else {
+ graph.addConnection(this, true);
+ }
+
+ if ((source.getParent()).getItemType() == GraphItem.CONTAINER) {
+ // If the container of the source is a container, we need to draw
+ // another
+ // arc on that arc layer
+ sourceContainerConnectionFigure = doCreateFigure();
+ ((GraphContainer) source.getParent())
+ .addConnectionFigure(sourceContainerConnectionFigure);
+ this.setVisible(false);
+ }
+
+ if ((destination.getParent()).getItemType() == GraphItem.CONTAINER) { // &&
+ // src_destSameContainer
+ // ==
+ // false)
+ // {
+ // If the container of the source is a container, we need to draw
+ // another
+ // arc on that arc layer
+ targetContainerConnectionFigure = doCreateFigure();
+ ((GraphContainer) destination.getParent())
+ .addConnectionFigure(targetContainerConnectionFigure);
+ this.setVisible(false);
+ }
+ graph.registerItem(this);
+ }
+
+ void removeFigure() {
+ if (connectionFigure.getParent() != null) {
+ connectionFigure.getParent().remove(connectionFigure);
+ }
+ connectionFigure = null;
+ if (sourceContainerConnectionFigure != null) {
+ sourceContainerConnectionFigure.getParent().remove(
+ sourceContainerConnectionFigure);
+ sourceContainerConnectionFigure = null;
+ }
+ if (targetContainerConnectionFigure != null) {
+ targetContainerConnectionFigure.getParent().remove(
+ targetContainerConnectionFigure);
+ targetContainerConnectionFigure = null;
+ }
+
+ }
+
+ public void dispose() {
+ super.dispose();
+ this.isDisposed = true;
+ (getSource()).removeSourceConnection(this);
+ (getDestination()).removeTargetConnection(this);
+ graph.removeConnection(this);
+ if (sourceContainerConnectionFigure != null) {
+ sourceContainerConnectionFigure.getParent().remove(
+ sourceContainerConnectionFigure);
+ }
+ if (targetContainerConnectionFigure != null) {
+ targetContainerConnectionFigure.getParent().remove(
+ targetContainerConnectionFigure);
+ }
+ }
+
+ public boolean isDisposed() {
+ return isDisposed;
+ }
+
+ public Connection getConnectionFigure() {
+ if (connectionFigure == null) {
+ connectionFigure = doCreateFigure();
+ }
+ return connectionFigure;
+ }
+
+ /**
+ * Gets the external connection object.
+ *
+ * @return Object
+ */
+ public Object getExternalConnection() {
+ return this.getData();
+ }
+
+ /**
+ * Returns a string like 'source -> destination'
+ *
+ * @return String
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer("GraphModelConnection: ");
+ buffer.append(sourceNode != null ? sourceNode.getText() : "null");
+ buffer.append(isDirected() ? " --> " : " --- ");
+ buffer.append(destinationNode != null ? destinationNode.getText()
+ : "null");
+ buffer.append(" (weight=").append(getWeightInLayout()).append(")");
+ return buffer.toString();
+ }
+
+ /**
+ * Returns the style of this connection. Valid styles are those that begin
+ * with CONNECTION in ZestStyles.
+ *
+ * @return the style of this connection.
+ * @see #ZestStyles
+ */
+ public int getConnectionStyle() {
+ return connectionStyle;
+ }
+
+ /**
+ * Returns the style of this connection. Valid styles are those that begin
+ * with CONNECTION in ZestStyles.
+ *
+ * @return the style of this connection.
+ * @see #ZestStyles
+ */
+ public void setConnectionStyle(int style) {
+ this.connectionStyle = style;
+ updateFigure(this.connectionFigure);
+ }
+
+ /**
+ * Gets the weight of this connection. The weight must be in {-1, [0-1]}. A
+ * weight of -1 means that there is no force/tension between the nodes. A
+ * weight of 0 results in the maximum spring length being used (farthest
+ * apart). A weight of 1 results in the minimum spring length being used
+ * (closest together).
+ *
+ * @see org.eclipse.mylar.zest.layouts.LayoutRelationship#getWeightInLayout()
+ * @return the weight: {-1, [0 - 1]}.
+ */
+ public double getWeightInLayout() {
+ return weight;
+ }
+
+ /**
+ * Gets the font for the label on this connection
+ *
+ * @return
+ */
+ public Font getFont() {
+ return this.font;
+ }
+
+ /**
+ * Sets the font for the label on this connection.
+ *
+ */
+ public void setFont(Font f) {
+ this.font = f;
+ }
+
+ /**
+ * Sets the weight for this connection. The weight must be in {-1, [0-1]}. A
+ * weight of -1 means that there is no force/tension between the nodes. A
+ * weight of 0 results in the maximum spring length being used (farthest
+ * apart). A weight of 1 results in the minimum spring length being used
+ * (closest together).
+ *
+ */
+ public void setWeight(double weight) {
+ if (weight < 0) {
+ this.weight = -1;
+ } else if (weight > 1) {
+ this.weight = 1;
+ } else {
+ this.weight = weight;
+ }
+ }
+
+ /**
+ * Returns the color of this connection.
+ *
+ * @return Color
+ */
+ public Color getLineColor() {
+ return color;
+ }
+
+ /**
+ * Sets the highlight color.
+ *
+ * @param color
+ * the color to use for highlighting.
+ */
+ public void setHighlightColor(Color color) {
+ this.highlightColor = color;
+ }
+
+ /**
+ * @return the highlight color
+ */
+ public Color getHighlightColor() {
+ return highlightColor;
+ }
+
+ /**
+ * Perminently sets the color of this line to the given color. This will
+ * become the color of the line when it is not highlighted. If you would
+ * like to temporarily change the color of the line, use changeLineColor.
+ *
+ * @param color
+ * the color to be set.
+ * @see changeLineColor(Color color)
+ */
+ public void setLineColor(Color color) {
+ this.foreground = color;
+ changeLineColor(foreground);
+ }
+
+ /**
+ * Sets the connection color.
+ *
+ * @param color
+ */
+ public void changeLineColor(Color color) {
+ this.color = color;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Sets the tooltip on this node. This tooltip will display if the mouse
+ * hovers over the node. Setting the tooltip has no effect if a custom
+ * figure has been set.
+ */
+ public void setTooltip(IFigure tooltip) {
+ hasCustomTooltip = true;
+ this.tooltip = tooltip;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Gets the current tooltip for this node. The tooltip returned is
+ * meaningless if a custom figure has been set.
+ */
+ public IFigure getTooltip() {
+ return this.tooltip;
+ }
+
+ /**
+ * Returns the connection line width.
+ *
+ * @return int
+ */
+ public int getLineWidth() {
+ return lineWidth;
+ }
+
+ /**
+ * Sets the connection line width.
+ *
+ * @param lineWidth
+ */
+ public void setLineWidth(int lineWidth) {
+ this.lineWidth = lineWidth;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Returns the connection line style.
+ *
+ * @return int
+ */
+ public int getLineStyle() {
+ return lineStyle;
+ }
+
+ /**
+ * Sets the connection line style.
+ *
+ * @param lineStyle
+ */
+ public void setLineStyle(int lineStyle) {
+ this.lineStyle = lineStyle;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Gets the source node for this relationship
+ *
+ * @return GraphModelNode
+ */
+ public GraphNode getSource() {
+ return this.sourceNode;
+ }
+
+ /**
+ * Gets the target node for this relationship
+ *
+ * @return GraphModelNode
+ */
+ public GraphNode getDestination() {
+ return this.destinationNode;
+ }
+
+ /**
+ * Highlights this node. Uses the default highlight color.
+ */
+ public void highlight() {
+ if (highlighted) {
+ return;
+ }
+ IFigure parentFigure = connectionFigure.getParent();
+ if (parentFigure instanceof ZestRootLayer) {
+ ((ZestRootLayer) parentFigure)
+ .highlightConnection(connectionFigure);
+ }
+ highlighted = true;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Unhighlights this node. Uses the default color.
+ */
+ public void unhighlight() {
+ if (!highlighted) {
+ return;
+ }
+ IFigure parentFigure = connectionFigure.getParent();
+ if (parentFigure instanceof ZestRootLayer) {
+ ((ZestRootLayer) parentFigure)
+ .unHighlightConnection(connectionFigure);
+ }
+ highlighted = false;
+ updateFigure(connectionFigure);
+ }
+
+ /**
+ * Returns true if this connection is highlighted, false otherwise
+ *
+ * @return
+ */
+ public boolean isHighlighted() {
+ return highlighted;
+ }
+
+ /**
+ * Gets the graph model that this connection is in
+ *
+ * @return The graph model that this connection is contained in
+ */
+ public Graph getGraphModel() {
+ return this.graph;
+ }
+
+ /**
+ * Sets the curve depth of the arc. The curve depth is defined as the
+ * maximum distance from any point on the chord (i.e. a vector normal to the
+ * chord with magnitude d).
+ *
+ * If 0 is set, a Polyline Connection will be used, otherwise a
+ * PolylineArcConnectoin will be used. Negative depths are also supported.
+ *
+ * @param depth
+ * The depth of the curve
+ */
+ public void setCurveDepth(int depth) {
+ if (this.curveDepth == 0 && depth != 0 || this.curveDepth != 0
+ && depth == 0) {
+ // There is currently no curve, so we have to create
+ // a curved connection
+ graph.removeConnection(this);
+ this.curveDepth = depth;
+ this.connectionFigure = doCreateFigure();
+ registerConnection(sourceNode, destinationNode);
+ updateFigure(this.connectionFigure);
+ } else {
+ this.curveDepth = depth;
+ updateFigure(this.connectionFigure);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.mylar.zest.core.widgets.IGraphItem#getItemType()
+ */
+ public int getItemType() {
+ return CONNECTION;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.mylar.zest.core.internal.graphmodel.GraphItem#setVisible(
+ * boolean)
+ */
+ public void setVisible(boolean visible) {
+ if (getSource().isVisible() && getDestination().isVisible() && visible) {
+ this.getFigure().setVisible(visible);
+ if (sourceContainerConnectionFigure != null) {
+ sourceContainerConnectionFigure.setVisible(visible);
+ }
+ if (targetContainerConnectionFigure != null) {
+ targetContainerConnectionFigure.setVisible(visible);
+ }
+ this.visible = visible;
+ } else {
+ this.getFigure().setVisible(false);
+ if (sourceContainerConnectionFigure != null) {
+ sourceContainerConnectionFigure.setVisible(false);
+ }
+ if (targetContainerConnectionFigure != null) {
+ targetContainerConnectionFigure.setVisible(false);
+ }
+ this.visible = false;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.mylar.zest.core.widgets.IGraphItem#isVisible()
+ */
+ public boolean isVisible() {
+ return visible;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Item#setText(java.lang.String)
+ */
+ public void setText(String string) {
+ super.setText(string);
+
+ if (this.connectionFigure != null) {
+ updateFigure(this.connectionFigure);
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ public boolean isDirected() {
+ return ZestStyles.checkStyle(connectionStyle,
+ ZestStyles.CONNECTIONS_DIRECTED);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void setDirected(boolean directed) {
+ if (directed) {
+ setConnectionStyle(connectionStyle
+ | ZestStyles.CONNECTIONS_DIRECTED);
+ } else {
+ setConnectionStyle(connectionStyle
+ & (-1 - ZestStyles.CONNECTIONS_DIRECTED));
+ }
+ }
+
+ PolylineConnection getSourceContainerConnectionFigure() {
+ return (PolylineConnection) sourceContainerConnectionFigure;
+ }
+
+ PolylineConnection getTargetContainerConnectionFigure() {
+ return (PolylineConnection) targetContainerConnectionFigure;
+ }
+
+ private void updateFigure(Connection connection) {
+ if (sourceContainerConnectionFigure != null) {
+ doUpdateFigure(sourceContainerConnectionFigure);
+ }
+ if (targetContainerConnectionFigure != null) {
+ doUpdateFigure(targetContainerConnectionFigure);
+ }
+ doUpdateFigure(connection);
+ }
+
+ private void doUpdateFigure(Connection connection) {
+ if (connection == null) {
+ return;
+ }
+ Shape connectionShape = (Shape) connection;
+
+ connectionShape.setLineStyle(getLineStyle());
+
+ if (this.getText() != null || this.getImage() != null) {
+ if (this.getImage() != null) {
+ this.connectionLabel.setIcon(this.getImage());
+ }
+ if (this.getText() != null) {
+ this.connectionLabel.setText(this.getText());
+ }
+ this.connectionLabel.setFont(this.getFont());
+ }
+
+ if (highlighted) {
+ connectionShape.setForegroundColor(getHighlightColor());
+ connectionShape.setLineWidth(getLineWidth() * 2);
+ } else {
+ connectionShape.setForegroundColor(getLineColor());
+ connectionShape.setLineWidth(getLineWidth());
+ }
+
+ if (connection instanceof PolylineArcConnection) {
+ PolylineArcConnection arcConnection = (PolylineArcConnection) connection;
+ arcConnection.setDepth(curveDepth);
+ }
+ if ((connectionStyle & ZestStyles.CONNECTIONS_DIRECTED) > 0) {
+ PolygonDecoration decoration = new PolygonDecoration();
+ if (getLineWidth() < 3) {
+ decoration.setScale(9, 3);
+ } else {
+ double logLineWith = getLineWidth() / 2.0;
+ decoration.setScale(7 * logLineWith, 3 * logLineWith);
+ }
+ ((PolylineConnection) connection).setTargetDecoration(decoration);
+ }
+
+ IFigure toolTip;
+ if (this.getTooltip() == null && getText() != null
+ && getText().length() > 0 && hasCustomTooltip == false) {
+ toolTip = new Label();
+ ((Label) toolTip).setText(getText());
+ } else {
+ toolTip = this.getTooltip();
+ }
+ connection.setToolTip(toolTip);
+ }
+
+ private Connection doCreateFigure() {
+ Connection connectionFigure = null;
+ ChopboxAnchor sourceAnchor = null;
+ ChopboxAnchor targetAnchor = null;
+ this.connectionLabel = new Label();
+ Locator labelLocator = null;
+
+ if (getSource() == getDestination()) {
+ // If this is a self loop, create a looped arc and put the locator
+ // at the top
+ // of the connection
+ connectionFigure = new PolylineArcConnection();
+ sourceAnchor = new LoopAnchor(getSource().getNodeFigure());
+ targetAnchor = new LoopAnchor(getDestination().getNodeFigure());
+ labelLocator = new MidpointLocator(connectionFigure, 0) {
+ protected Point getReferencePoint() {
+ Point p = Point.SINGLETON;
+ p.x = getConnection().getPoints().getPoint(getIndex()).x;
+ p.y = (int) (getConnection().getPoints().getPoint(
+ getIndex()).y - (curveDepth * 1.5));
+ return p;
+ }
+ };
+ } else {
+ if (curveDepth != 0) {
+ connectionFigure = new PolylineArcConnection();
+ ((PolylineArcConnection) connectionFigure)
+ .setDepth(this.curveDepth);
+ } else {
+ connectionFigure = new PolylineConnection();
+ }
+ sourceAnchor = new RoundedChopboxAnchor(
+ getSource().getNodeFigure(), 8);
+ targetAnchor = new RoundedChopboxAnchor(getDestination()
+ .getNodeFigure(), 8);
+ labelLocator = new MidpointLocator(connectionFigure, 0);
+ }
+
+ connectionFigure.setSourceAnchor(sourceAnchor);
+ connectionFigure.setTargetAnchor(targetAnchor);
+ connectionFigure.add(this.connectionLabel, labelLocator);
+
+ doUpdateFigure(connectionFigure);
+ return connectionFigure;
+ }
+
+ IFigure getFigure() {
+ return this.getConnectionFigure();
+ }
+
+ private InternalConnectionLayout layout;
+
+ InternalConnectionLayout getLayout() {
+ if (layout == null) {
+ layout = new InternalConnectionLayout();
+ }
+ return layout;
+ }
+
+ class InternalConnectionLayout implements ConnectionLayout {
+ private boolean visible = GraphConnection.this.isVisible();
+
+ public NodeLayout getSource() {
+ return sourceNode.getLayout();
+ }
+
+ public NodeLayout getTarget() {
+ return destinationNode.getLayout();
+ }
+
+ public double getWeight() {
+ return GraphConnection.this.getWeightInLayout();
+ }
+
+ public boolean isDirected() {
+ return !ZestStyles.checkStyle(getConnectionStyle(),
+ ZestStyles.CONNECTIONS_DIRECTED);
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ graph.getLayoutContext().checkChangesAllowed();
+ this.visible = visible;
+ }
+
+ void applyLayout() {
+ if (GraphConnection.this.isVisible() != this.visible) {
+ GraphConnection.this.setVisible(this.visible);
+ }
+ }
+ }
+
+ void applyLayoutChanges() {
+ if (layout != null) {
+ layout.applyLayout();
+ }
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphContainer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphContainer.java
new file mode 100644
index 0000000..13f8731
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphContainer.java
@@ -0,0 +1,947 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.draw2d.ActionEvent;
+import org.eclipse.draw2d.ActionListener;
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.Clickable;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.FreeformViewport;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.LayoutAnimator;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.ScrollPane;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.Triangle;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.zest.core.widgets.internal.AspectRatioFreeformLayer;
+import org.eclipse.zest.core.widgets.internal.ContainerFigure;
+import org.eclipse.zest.core.widgets.internal.ZestRootLayer;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle;
+
+/**
+ * A Container that can be added to a Graph. Nodes can be added to this
+ * container. The container supports collapsing and expanding and has the same
+ * properties as the nodes. Containers cannot have custom figures.
+ *
+ * @author Ian Bull
+ */
+public class GraphContainer extends GraphNode implements IContainer {
+
+ static class ExpandGraphLabel extends Figure implements ActionListener {
+
+ private boolean isExpanded;
+ private Expander expander = new Expander();
+ private Color darkerBackground;
+
+ class Expander extends Clickable {
+ private Triangle triangle;
+
+ public Expander() {
+ setStyle(Clickable.STYLE_TOGGLE);
+ triangle = new Triangle();
+ triangle.setSize(10, 10);
+ triangle.setBackgroundColor(ColorConstants.black);
+ triangle.setForegroundColor(ColorConstants.black);
+ triangle.setFill(true);
+ triangle.setDirection(Triangle.EAST);
+ triangle.setLocation(new Point(5, 3));
+ this.setLayoutManager(new FreeformLayout());
+ this.add(triangle);
+ this.setPreferredSize(15, 15);
+ this.addActionListener(ExpandGraphLabel.this);
+ }
+
+ public void open() {
+ triangle.setDirection(Triangle.SOUTH);
+ }
+
+ public void close() {
+ triangle.setDirection(Triangle.EAST);
+ }
+
+ }
+
+ /**
+ * Sets the expander state (the little triangle) to
+ * ExpanderGraphLabel.OPEN or ExpanderGraphLabel.CLOSED
+ *
+ * @param state
+ */
+ public void setExpandedState(boolean expanded) {
+ if (expanded) {
+ expander.open();
+ } else {
+ expander.close();
+ }
+ this.isExpanded = expanded;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.ActionListener#actionPerformed(org.eclipse.draw2d
+ * .ActionEvent)
+ */
+ public void actionPerformed(ActionEvent event) {
+ if (isExpanded) {
+ container.close(true);
+ } else {
+ container.open(true);
+ }
+ }
+
+ private final int arcWidth = 8;
+ private final Label label;
+ private final GraphContainer container;
+ private final ToolbarLayout layout;
+
+ public ExpandGraphLabel(GraphContainer container, String text,
+ Image image, boolean cacheLabel) {
+ this.label = new Label(text) {
+
+ /**
+ * <b>This method is overwritten so that the text is not
+ * truncated.</b><br>
+ *
+ * {@inheritDoc}
+ *
+ */
+ protected void paintFigure(Graphics graphics) {
+ if (isOpaque()) {
+ super.paintFigure(graphics);
+ }
+ Rectangle bounds = getBounds();
+ graphics.translate(bounds.x, bounds.y);
+ if (getIcon() != null) {
+ graphics.drawImage(getIcon(), getIconLocation());
+ }
+ if (!isEnabled()) {
+ graphics.translate(1, 1);
+ graphics.setForegroundColor(ColorConstants.buttonLightest);
+ graphics.drawText(getSubStringText(), getTextLocation());
+ graphics.translate(-1, -1);
+ graphics.setForegroundColor(ColorConstants.buttonDarker);
+ }
+ graphics.drawText(getText(), getTextLocation());
+ graphics.translate(-bounds.x, -bounds.y);
+ }
+ };
+ this.setText(text);
+ this.setImage(image);
+ this.container = container;
+ this.setFont(Display.getDefault().getSystemFont());
+ layout = new ToolbarLayout(true);
+ layout.setSpacing(5);
+ layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ this.setLayoutManager(layout);
+ this.add(this.expander);
+ this.add(this.label);
+ }
+
+ private Color getDarkerBackgroundColor() {
+ if (darkerBackground == null) {
+ Color baseColor = getBackgroundColor();
+ int blue = (int) (baseColor.getBlue() * 0.8 + 0.5);
+ int red = (int) (baseColor.getRed() * 0.8 + 0.5);
+ int green = (int) (baseColor.getGreen() * 0.8 + 0.5);
+ darkerBackground = new Color(Display.getCurrent(), new RGB(red,
+ green, blue));
+ }
+ return darkerBackground;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Label#paintFigure(org.eclipse.draw2d.Graphics)
+ */
+ public void paint(Graphics graphics) {
+
+ graphics.setForegroundColor(getDarkerBackgroundColor());
+ graphics.setBackgroundColor(getBackgroundColor());
+
+ graphics.pushState();
+
+ // fill in the background
+ Rectangle bounds = getBounds().getCopy();
+ Rectangle r = bounds.getCopy();
+ r.y += arcWidth / 2;
+ r.height -= arcWidth;
+
+ Rectangle top = bounds.getCopy();
+ top.height /= 2;
+ graphics.setForegroundColor(getBackgroundColor());
+ graphics.setBackgroundColor(getBackgroundColor());
+ graphics.fillRoundRectangle(top, arcWidth, arcWidth);
+
+ top.y = top.y + top.height;
+ graphics.setForegroundColor(darkerBackground);
+ graphics.setBackgroundColor(darkerBackground);
+ graphics.fillRoundRectangle(top, arcWidth, arcWidth);
+
+ graphics.setBackgroundColor(darkerBackground);
+ graphics.setForegroundColor(getBackgroundColor());
+ graphics.fillGradient(r, true);
+
+ super.paint(graphics);
+ graphics.popState();
+ graphics.setForegroundColor(darkerBackground);
+ graphics.setBackgroundColor(darkerBackground);
+ // paint the border
+ bounds.setSize(bounds.width - 1, bounds.height - 1);
+ graphics.drawRoundRectangle(bounds, arcWidth, arcWidth);
+ }
+
+ public void setBackgroundColor(Color bg) {
+ super.setBackgroundColor(bg);
+ if (darkerBackground != null) {
+ darkerBackground.dispose();
+ }
+ darkerBackground = null;
+ }
+
+ public void setTextT(String string) {
+ this.setPreferredSize(null);
+ this.label.setText(string);
+ this.add(label);
+ this.layout.layout(this);
+ this.invalidate();
+ this.revalidate();
+ this.validate();
+ }
+
+ public void setText(String string) {
+ this.label.setText(string);
+ }
+
+ public void setImage(Image image) {
+ this.label.setIcon(image);
+ }
+
+ public void setFocus() {
+ expander.requestFocus();
+ }
+
+ }
+
+ static final double SCALED_WIDTH = 300;
+ static final double SCALED_HEIGHT = 200;
+ private static final int CONTAINER_HEIGHT = 200;
+ private static final int MIN_WIDTH = 250;
+ private static final int MIN_HEIGHT = 30;
+ private static final int ANIMATION_TIME = 100;
+ private static final int SUBLAYER_OFFSET = 2;
+
+ private static SelectionListener selectionListener;
+
+ private ExpandGraphLabel expandGraphLabel;
+
+ private List childNodes = null;
+ private int childAreaHeight = CONTAINER_HEIGHT;
+
+ private ZestRootLayer zestLayer;
+ private ScrollPane scrollPane;
+ private LayoutAlgorithm layoutAlgorithm;
+ private boolean isExpanded = false;
+ private AspectRatioFreeformLayer scalledLayer;
+ private InternalLayoutContext layoutContext;
+
+ /**
+ * Creates a new GraphContainer. A GraphContainer may contain nodes, and has
+ * many of the same properties as a graph node.
+ *
+ * @param graph
+ * The graph that the container is being added to
+ * @param style
+ *
+ * @since 2.0
+ */
+ public GraphContainer(Graph graph, int style) {
+ super(graph, style, "");
+ initModel(graph, "", null);
+ close(false);
+ childNodes = new ArrayList();
+ registerToParent(graph);
+ }
+
+ /**
+ * Custom figures cannot be set on a GraphContainer.
+ */
+ public void setCustomFigure(IFigure nodeFigure) {
+ throw new RuntimeException(
+ "Operation not supported: Containers cannot have custom figures");
+ }
+
+ /**
+ * Close this node.
+ *
+ * @param animate
+ */
+ public void close(boolean animate) {
+ if (animate) {
+ Animation.markBegin();
+ }
+ isExpanded = false;
+
+ expandGraphLabel.setExpandedState(false);
+ Rectangle newBounds = scrollPane.getBounds().getCopy();
+ newBounds.height = 0;
+
+ scrollPane.setSize(scrollPane.getSize().width, 0);
+ updateFigureForModel(this.zestLayer);
+ scrollPane.setVisible(false);
+ List children = this.zestLayer.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ IFigure child = (IFigure) iterator.next();
+ GraphItem item = getGraph().getGraphItem(child);
+ item.setVisible(false);
+ }
+ Rectangle containerBounds = new Rectangle(this.getLocation(),
+ new Dimension(this.getSize().width, CONTAINER_HEIGHT
+ + this.expandGraphLabel.getSize().height));
+ moveNodesUp(containerBounds, this);
+ if (animate) {
+ Animation.run(ANIMATION_TIME);
+ }
+ updateFigureForModel(nodeFigure);
+ }
+
+ private static void addNodeToOrderedList(List orderedNodeList,
+ GraphNode node) {
+ Iterator orderedNodeIterator = orderedNodeList.iterator();
+ int counter = 0;
+ while (orderedNodeIterator.hasNext()) {
+ // Look through the list of nodes below and find the right spot for
+ // this
+ GraphNode nextOrderedNode = (GraphNode) orderedNodeIterator.next();
+ if (nextOrderedNode.getLocation().y
+ + nextOrderedNode.getBounds().height > node.getLocation().y
+ + node.getBounds().height) {
+ break;
+ }
+ counter++;
+ }
+ // Place this in the right location
+ orderedNodeList.add(counter, node);
+ }
+
+ /**
+ * Gets all the nodes below the yValue. The nodes are returned in order.
+ *
+ * @param nodes
+ * @param yValue
+ * @return
+ */
+ private static List getOrderedNodesBelowY(List nodes, int yValue,
+ GraphNode yValueNode) {
+ Iterator iterator = nodes.iterator();
+ LinkedList orderedNode = new LinkedList();
+ while (iterator.hasNext()) {
+ GraphNode node = (GraphNode) iterator.next();
+ if (node == yValueNode) {
+ continue;
+ }
+ if (node.getLocation().y + node.getBounds().height > yValue) {
+ // This node is below the container
+ addNodeToOrderedList(orderedNode, node);
+ }
+ }
+ // Convert this to an arrayList for faster access
+ List arrayList = new ArrayList();
+ iterator = orderedNode.iterator();
+ while (iterator.hasNext()) {
+ arrayList.add(iterator.next());
+ }
+ return arrayList;
+ }
+
+ /**
+ * Checks if the node intersects the stripe between left and right
+ *
+ * @param left
+ * @param right
+ * @param node
+ * @return
+ */
+ private static boolean nodeInStripe(int left, int right, GraphNode node) {
+ return (node.getBounds().x < right && node.getBounds().x
+ + node.getBounds().width > left);
+ }
+
+ void pack(Graph g) {
+ GraphNode highestNode = getHighestNode(g);
+ moveNodesUp(highestNode.getBounds(), highestNode);
+ }
+
+ /**
+ *
+ * @param g
+ * @return
+ */
+ static GraphNode getHighestNode(Graph g) {
+ Iterator iterator = g.getNodes().iterator();
+ GraphNode lowest /* highest on the screen */= null;
+
+ while (iterator.hasNext()) {
+ GraphNode node = (GraphNode) iterator.next();
+ if (lowest == null || lowest.getBounds().y > node.getBounds().y) {
+ lowest = node;
+ }
+ }
+ return lowest;
+
+ }
+
+ /**
+ * Move the nodes below this node up
+ *
+ * @param containerBounds
+ * @param graphContainer
+ */
+ private void moveNodesUp(Rectangle containerBounds, GraphNode graphContainer) {
+
+ // Get all nodes below this container, in order
+ List orderedNodesBelowY = getOrderedNodesBelowY(parent.getGraph()
+ .getNodes(), containerBounds.y, graphContainer);
+ int leftSide = containerBounds.x;
+ int rightSide = containerBounds.x + containerBounds.width;
+ List nodesToConsider = new LinkedList();
+ for (int i = 0; i < orderedNodesBelowY.size(); i++) {
+ nodesToConsider.add(orderedNodesBelowY.get(i));
+ }
+ addNodeToOrderedList(orderedNodesBelowY, graphContainer);
+
+ while (nodesToConsider.size() > 0) {
+ GraphNode node = (GraphNode) nodesToConsider.get(0);
+ if (nodeInStripe(leftSide, rightSide, node)) {
+ leftSide = Math.min(leftSide, node.getBounds().x);
+ rightSide = Math.max(rightSide, node.getBounds().x
+ + node.getBounds().width);
+ // If this node is in the stripe, move it up
+ // the previous node
+ GraphNode previousNode = null;
+ int i = 0;
+ for (; i < orderedNodesBelowY.size(); i++) {
+ if (orderedNodesBelowY.get(i) == node) {
+ break;
+ }
+ }
+ int j = i - 1;
+ while (j >= 0) {
+ GraphNode pastNode = (GraphNode) orderedNodesBelowY.get(j);
+ // if (nodeInStripe(leftSide, rightSide, pastNode)) {
+ if (nodeInStripe(node.getBounds().x, node.getBounds().x
+ + node.getBounds().width, pastNode)) {
+ previousNode = pastNode;
+ break;
+ }
+ j--;
+ }
+ if (previousNode == null) {
+ previousNode = graphContainer;
+ }
+ int previousLocation = previousNode.getBounds().y
+ + previousNode.getBounds().height + 2;
+
+ orderedNodesBelowY.remove(i);
+ node.setLocation(node.getLocation().x, previousLocation);
+ addNodeToOrderedList(orderedNodesBelowY, node);
+
+ }
+ nodesToConsider.remove(node);
+ }
+ }
+
+ /**
+ * Open the container. This opens the graph container to show the nodes
+ * within and update the twistie
+ */
+ public void open(boolean animate) {
+ if (animate) {
+ Animation.markBegin();
+ }
+ isExpanded = true;
+
+ expandGraphLabel.setExpandedState(true);
+
+ scrollPane.setSize(computeChildArea());
+ scrollPane.setVisible(true);
+
+ List children = this.zestLayer.getChildren();
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ IFigure child = (IFigure) iterator.next();
+ GraphItem item = getGraph().getGraphItem(child);
+ item.setVisible(true);
+ }
+
+ updateFigureForModel(nodeFigure);
+
+ Rectangle containerBounds = new Rectangle(this.getLocation(),
+ new Dimension(this.getSize().width, CONTAINER_HEIGHT
+ + this.expandGraphLabel.getSize().height));
+ moveNodesDown(containerBounds, this);
+ moveNodesUp(containerBounds, this);
+ if (animate) {
+ Animation.run(ANIMATION_TIME);
+ }
+ this.getFigure().getUpdateManager().performValidation();
+ }
+
+ /**
+ *
+ * @param containerBounds
+ * @param graphContainer
+ */
+ private void moveNodesDown(Rectangle containerBounds,
+ GraphContainer graphContainer) {
+
+ // Find all nodes below here
+ List nodesBelowHere = getOrderedNodesBelowY(parent.getGraph()
+ .getNodes(), containerBounds.y, graphContainer);
+ Iterator nodesBelowHereIterator = nodesBelowHere.iterator();
+ List nodesToMove = new LinkedList();
+ int left = containerBounds.x;
+ int right = containerBounds.x + containerBounds.width;
+ while (nodesBelowHereIterator.hasNext()) {
+ GraphNode node = (GraphNode) nodesBelowHereIterator.next();
+ if (nodeInStripe(left, right, node)) {
+ nodesToMove.add(node);
+ left = Math.min(left, node.getBounds().x);
+ right = Math.max(right, node.getBounds().x
+ + node.getBounds().width);
+ }
+ }
+ List intersectingNodes = intersectingNodes(containerBounds,
+ nodesToMove, graphContainer);
+ int delta = getMaxMovement(containerBounds, intersectingNodes);
+ if (delta > 0) {
+ shiftNodesDown(nodesToMove, delta);
+ }
+
+ }
+
+ /**
+ * Checks all the nodes in the list of nodesToCheck to see if they intersect
+ * with the bounds set
+ *
+ * @param node
+ * @param nodesToCheck
+ * @return
+ */
+ private List intersectingNodes(Rectangle bounds, List nodesToCheck,
+ GraphNode node) {
+ List result = new LinkedList();
+ Iterator nodes = nodesToCheck.iterator();
+ while (nodes.hasNext()) {
+ GraphNode nodeToCheck = (GraphNode) nodes.next();
+ if (node == nodeToCheck) {
+ continue;
+ }
+ if (bounds.intersects(nodeToCheck.getBounds())) {
+ result.add(nodeToCheck);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the max distance the intersecting nodes need to be shifted to make
+ * room for the expanding node
+ *
+ * @param bounds
+ * @param nodesToMove
+ * @return
+ */
+ private int getMaxMovement(Rectangle bounds, List nodesToMove) {
+ Iterator iterator = nodesToMove.iterator();
+ int maxMovement = 0;
+ while (iterator.hasNext()) {
+ GraphNode node = (GraphNode) iterator.next();
+ int yValue = node.getLocation().y;
+ int distanceFromBottom = (bounds.y + bounds.height) - yValue;
+ maxMovement = Math.max(maxMovement, distanceFromBottom);
+ }
+ return maxMovement + 3;
+ }
+
+ /**
+ * Shifts a collection of nodes down.
+ *
+ * @param nodesToShift
+ * @param amount
+ */
+ private void shiftNodesDown(List nodesToShift, int amount) {
+ Iterator iterator = nodesToShift.iterator();
+ while (iterator.hasNext()) {
+ GraphNode node = (GraphNode) iterator.next();
+
+ node.setLocation(node.getLocation().x, node.getLocation().y
+ + amount);
+ }
+ }
+
+ /**
+ * Gets the graph that this container has been added to.
+ */
+ public Graph getGraph() {
+ return this.graph;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Widget getItem() {
+ return this;
+ }
+
+ public int getItemType() {
+ return CONTAINER;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm,
+ boolean applyLayout) {
+ if (this.layoutAlgorithm != null) {
+ this.layoutAlgorithm.setLayoutContext(null);
+ }
+
+ this.layoutAlgorithm = algorithm;
+ this.layoutAlgorithm.setLayoutContext(getLayoutContext());
+ if (applyLayout) {
+ applyLayout();
+ }
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public InternalLayoutContext getLayoutContext() {
+ if (layoutContext == null) {
+ layoutContext = new InternalLayoutContext(this);
+ }
+ return layoutContext;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public DisplayIndependentRectangle getLayoutBounds() {
+ double width = GraphContainer.SCALED_WIDTH - 10;
+ double height = GraphContainer.SCALED_HEIGHT - 10;
+ return new DisplayIndependentRectangle(25, 25, width - 50, height - 50);
+ }
+
+ public void applyLayout() {
+ if (layoutAlgorithm == null) {
+ setLayoutAlgorithm(new TreeLayoutAlgorithm(), false);
+ }
+ Animation.markBegin();
+ layoutAlgorithm.applyLayout(true);
+ layoutContext.flushChanges(false);
+ Animation.run(ANIMATION_TIME);
+ getFigure().getUpdateManager().performUpdate();
+ }
+
+ /**
+ * Get the scale for this container. This is the scale applied to the
+ * children contained within
+ *
+ * @return
+ */
+ public double getScale() {
+ return this.scalledLayer.getScale();
+ }
+
+ /**
+ * Set the scale for this container. This is the scale applied to the
+ * children contained within.
+ *
+ * @param scale
+ */
+ public void setScale(double scale) {
+ this.scalledLayer.setScale(scale);
+ }
+
+ /***************************************************************************
+ * NON API MEMBERS
+ **************************************************************************/
+ protected void initFigure() {
+ nodeFigure = createContainerFigure();
+ }
+
+ /**
+ * This is a small class to help represent the size of the container. It
+ * should only be used in the computeContainerSize method.
+ */
+ class ContainerDimension {
+ int width;
+ int labelHeight;
+ int expandedHeight;
+ }
+
+ /**
+ * Computes size of the scroll pane that the child nodes will be placed in.
+ *
+ * @return
+ */
+ private Dimension computeChildArea() {
+ ContainerDimension containerDimension = computeContainerSize();
+ Dimension dimension = new Dimension();
+ dimension.width = containerDimension.width;
+ dimension.height = containerDimension.expandedHeight
+ - containerDimension.labelHeight + SUBLAYER_OFFSET;
+ return dimension;
+ }
+
+ /**
+ * Computes the desired size of the container. This method uses the minimum
+ * size, label size and setSize to compute the size.
+ *
+ * @return
+ */
+ private ContainerDimension computeContainerSize() {
+ ContainerDimension dimension = new ContainerDimension();
+ int labelHeight = expandGraphLabel.getPreferredSize().height;
+ int labelWidth = expandGraphLabel.getPreferredSize().width;
+ if (labelWidth < MIN_WIDTH) {
+ labelWidth = MIN_WIDTH;
+ expandGraphLabel.setPreferredSize(labelWidth, labelHeight);
+ }
+
+ dimension.labelHeight = Math.max(labelHeight, MIN_HEIGHT);
+ dimension.width = Math.max(labelWidth, this.size.width);
+ dimension.expandedHeight = Math.max(dimension.labelHeight
+ + childAreaHeight - SUBLAYER_OFFSET, this.size.height);
+
+ return dimension;
+ }
+
+ private double computeHeightScale() {
+ Dimension childArea = computeChildArea();
+ double heightScale = childArea.height / SCALED_HEIGHT;
+ return heightScale;
+ }
+
+ private double computeWidthScale() {
+ Dimension childArea = computeChildArea();
+ double widthScale = childArea.width / SCALED_WIDTH;
+ return widthScale;
+ }
+
+ private IFigure createContainerFigure() {
+ GraphContainer node = this;
+ IFigure containerFigure = new ContainerFigure();
+ containerFigure.setOpaque(true);
+
+ containerFigure.addLayoutListener(LayoutAnimator.getDefault());
+
+ containerFigure.setLayoutManager(new FreeformLayout());
+ expandGraphLabel = new ExpandGraphLabel(this, node.getText(), node
+ .getImage(), false);
+ expandGraphLabel.setText(getText());
+ expandGraphLabel.setImage(getImage());
+ ContainerDimension containerDimension = computeContainerSize();
+
+ scrollPane = new ScrollPane();
+ scrollPane.addLayoutListener(LayoutAnimator.getDefault());
+
+ Viewport viewport = new FreeformViewport();
+
+ scrollPane.setViewport(viewport);
+ viewport.addLayoutListener(LayoutAnimator.getDefault());
+ scrollPane.setScrollBarVisibility(ScrollPane.AUTOMATIC);
+
+ scalledLayer = new AspectRatioFreeformLayer("debug label");
+ scalledLayer.addLayoutListener(LayoutAnimator.getDefault());
+ scalledLayer.setScale(computeWidthScale(), computeHeightScale());
+ zestLayer = new ZestRootLayer();
+ zestLayer.addLayoutListener(LayoutAnimator.getDefault());
+ scalledLayer.add(zestLayer);
+
+ zestLayer.setLayoutManager(new FreeformLayout());
+ scrollPane.setSize(computeChildArea());
+ scrollPane.setLocation(new Point(0, containerDimension.labelHeight
+ - SUBLAYER_OFFSET));
+ scrollPane.setForegroundColor(ColorConstants.gray);
+
+ expandGraphLabel.setBackgroundColor(getBackgroundColor());
+ expandGraphLabel.setForegroundColor(getForegroundColor());
+ expandGraphLabel.setLocation(new Point(0, 0));
+
+ containerFigure.add(scrollPane);
+ containerFigure.add(expandGraphLabel);
+
+ scrollPane.getViewport().setContents(scalledLayer);
+ scrollPane.setBorder(new LineBorder());
+
+ return containerFigure;
+ }
+
+ private void registerToParent(IContainer parent) {
+ if (parent.getItemType() == GRAPH) {
+ createSelectionListener();
+ parent.getGraph().addSelectionListener(selectionListener);
+ }
+ }
+
+ private void createSelectionListener() {
+ if (selectionListener == null) {
+ selectionListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ if (e.item instanceof GraphContainer) {
+ // set focus to expand label so that pressing space
+ // opens/closes
+ // the last selected container
+ ((GraphContainer) e.item).expandGraphLabel.setFocus();
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // ignore
+ }
+ };
+
+ }
+ }
+
+ protected void updateFigureForModel(IFigure currentFigure) {
+
+ if (expandGraphLabel == null) {
+ initFigure();
+ }
+ expandGraphLabel.setTextT(getText());
+ expandGraphLabel.setImage(getImage());
+ expandGraphLabel.setFont(getFont());
+
+ if (highlighted == HIGHLIGHT_ON) {
+ expandGraphLabel.setForegroundColor(getForegroundColor());
+ expandGraphLabel.setBackgroundColor(getHighlightColor());
+ } else {
+ expandGraphLabel.setForegroundColor(getForegroundColor());
+ expandGraphLabel.setBackgroundColor(getBackgroundColor());
+ }
+
+ ContainerDimension containerDimension = computeContainerSize();
+
+ expandGraphLabel.setSize(containerDimension.width,
+ containerDimension.labelHeight);
+ if (isExpanded) {
+ setSize(containerDimension.width, containerDimension.expandedHeight);
+ } else {
+ setSize(containerDimension.width, containerDimension.labelHeight);
+ }
+ scrollPane.setLocation(new Point(expandGraphLabel.getLocation().x,
+ expandGraphLabel.getLocation().y
+ + containerDimension.labelHeight - SUBLAYER_OFFSET));
+
+ }
+
+ void refreshBounds() {
+ if (nodeFigure == null || nodeFigure.getParent() == null) {
+ return; // node figure has not been created yet
+ }
+ GraphNode node = this;
+ Point loc = node.getLocation();
+
+ ContainerDimension containerDimension = computeContainerSize();
+ Dimension size = new Dimension();
+
+ expandGraphLabel.setSize(containerDimension.width,
+ containerDimension.labelHeight);
+ this.childAreaHeight = computeChildArea().height;
+ if (isExpanded) {
+ size.width = containerDimension.width;
+ size.height = containerDimension.expandedHeight;
+ } else {
+ size.width = containerDimension.width;
+ size.height = containerDimension.labelHeight;
+ }
+ Rectangle bounds = new Rectangle(loc, size);
+ nodeFigure.getParent().setConstraint(nodeFigure, bounds);
+ scrollPane.setLocation(new Point(expandGraphLabel.getLocation().x,
+ expandGraphLabel.getLocation().y
+ + containerDimension.labelHeight - SUBLAYER_OFFSET));
+ scrollPane.setSize(computeChildArea());
+ scalledLayer.setScale(computeWidthScale(), computeHeightScale());
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void addSubgraphFigure(IFigure figure) {
+ zestLayer.addSubgraph(figure);
+ graph.subgraphFigures.add(figure);
+ }
+
+ void addConnectionFigure(IFigure figure) {
+ nodeFigure.add(figure);
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void addNode(GraphNode node) {
+ zestLayer.addNode(node.getNodeFigure());
+ this.childNodes.add(node);
+ node.setVisible(isExpanded);
+ }
+
+ public List getNodes() {
+ return this.childNodes;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public List getConnections() {
+ return filterConnections(getGraph().getConnections());
+
+ }
+
+ private List filterConnections(List connections) {
+ List result = new ArrayList();
+ for (Iterator iterator = connections.iterator(); iterator.hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (connection.getSource().getParent() == this
+ && connection.getDestination().getParent() == this) {
+ result.add(connection);
+ }
+ }
+ return result;
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphItem.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphItem.java
new file mode 100644
index 0000000..2f89c52
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphItem.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * Provides support for property changes. All model elements extend this class.
+ * Also extends the Item (Widget) class to be used inside a StructuredViewer.
+ *
+ * @author Chris Callendar
+ */
+public abstract class GraphItem extends Item {
+
+ public static final int GRAPH = 0;
+ public static final int NODE = 1;
+ public static final int CONNECTION = 2;
+ public static final int CONTAINER = 3;
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public GraphItem(Widget parent, int style) {
+ this(parent, style | SWT.NO_BACKGROUND, null);
+ }
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public GraphItem(Widget parent, int style, Object data) {
+ super(parent, style | SWT.NO_BACKGROUND);
+ if (data != null) {
+ this.setData(data);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Widget#dispose()
+ */
+ public void dispose() {
+ // @tag zest.bug.167132-ListenerDispose : remove all listeners.
+ // pcsDelegate = new PropertyChangeSupport(this);
+ super.dispose();
+ }
+
+ /**
+ * Gets the graph item type. The item type is one of: GRAPH, NODE or
+ * CONNECTION
+ *
+ * @return
+ */
+ public abstract int getItemType();
+
+ /**
+ * Set the visibility of this item.
+ *
+ * @param visible
+ * whether or not this item is visible.
+ */
+ public abstract void setVisible(boolean visible);
+
+ /**
+ * Get the visibility of this item.
+ *
+ * @return the visibility of this item.
+ */
+ public abstract boolean isVisible();
+
+ /**
+ * Gets the graph that this item is rooted on. If this item is itself a
+ * graph, then this is returned.
+ *
+ * @return the parent graph.
+ */
+ public abstract Graph getGraphModel();
+
+ /**
+ * Highlights the current GraphItem. A graph item is either a graph node or
+ * graph connection, and highlighting them will set the appropriate
+ * highlight color.
+ */
+ public abstract void highlight();
+
+ /**
+ * Unhighlight sets the graphItem (either a graphNode or graphConnection)
+ * back to the unhighlight figure or color.
+ */
+ public abstract void unhighlight();
+
+ abstract IFigure getFigure();
+
+ /**
+ * Checks a style to see if it is set on the given graph item
+ *
+ * @param styleToCheck
+ * The style to check
+ * @return
+ */
+ protected boolean checkStyle(int styleToCheck) {
+ return ((getStyle() & styleToCheck) > 0);
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphNode.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphNode.java
new file mode 100644
index 0000000..ba3c473
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/GraphNode.java
@@ -0,0 +1,769 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.widgets.internal.GraphLabel;
+import org.eclipse.zest.core.widgets.internal.ZestRootLayer;
+
+/**
+ * Simple node class which has the following properties: color, size, location,
+ * and a label. It also has a list of connections and anchors.
+ *
+ * @author Chris Callendar
+ *
+ * @author Del Myers
+ *
+ * @author Ian Bull
+ */
+public class GraphNode extends GraphItem {
+ public static final int HIGHLIGHT_NONE = 0;
+ public static final int HIGHLIGHT_ON = 1;
+
+ private int nodeStyle;
+
+ private List /* IGraphModelConnection */sourceConnections;
+ private List /* IGraphModelConnection */targetConnections;
+
+ private Color foreColor;
+ private Color backColor;
+ private Color highlightColor;
+ private Color borderColor;
+ private Color borderHighlightColor;
+ private int borderWidth;
+ private PrecisionPoint currentLocation;
+ protected Dimension size;
+ private Font font;
+ private boolean cacheLabel;
+ private boolean visible = true;
+
+ protected Graph graph;
+ protected IContainer parent;
+
+ /** The internal node. */
+ protected Object internalNode;
+ private boolean selected;
+ protected int highlighted = HIGHLIGHT_NONE;
+ private IFigure tooltip;
+ protected IFigure nodeFigure;
+
+ private boolean isDisposed = false;
+ private boolean hasCustomTooltip;
+
+ public GraphNode(IContainer graphModel, int style) {
+ this(graphModel, style, null);
+ }
+
+ public GraphNode(IContainer graphModel, int style, String text) {
+ this(graphModel, style, text, null, null);
+ }
+
+ public GraphNode(IContainer graphModel, int style, Object data) {
+ this(graphModel, style, "" /* text */, null /* image */, data);
+ }
+
+ private GraphNode(IContainer graphModel, int style, String text, Image image, Object data) {
+ super(graphModel.getGraph(), style, data);
+ initModel(graphModel, text, image);
+ if (nodeFigure == null) {
+ initFigure();
+ }
+
+ this.parent.addNode(this);
+ this.parent.getGraph().registerItem(this);
+ }
+
+ protected void initFigure() {
+ nodeFigure = createFigureForModel();
+ }
+
+ static int count = 0;
+
+ protected void initModel(IContainer graphModel, String text, Image image) {
+ this.nodeStyle |= graphModel.getGraph().getNodeStyle();
+ this.parent = graphModel;
+ this.sourceConnections = new ArrayList();
+ this.targetConnections = new ArrayList();
+ this.foreColor = graphModel.getGraph().DARK_BLUE;
+ this.backColor = graphModel.getGraph().LIGHT_BLUE;
+ this.highlightColor = graphModel.getGraph().HIGHLIGHT_COLOR;
+ this.borderColor = ColorConstants.lightGray;
+ this.borderHighlightColor = ColorConstants.blue;
+ this.borderWidth = 1;
+ this.currentLocation = new PrecisionPoint(0, 0);
+ this.size = new Dimension(-1, -1);
+ this.font = Display.getDefault().getSystemFont();
+ this.graph = graphModel.getGraph();
+ this.cacheLabel = false;
+ this.setText(text);
+ if (image != null) {
+ this.setImage(image);
+ }
+
+ if (font == null) {
+ font = Display.getDefault().getSystemFont();
+ }
+
+ }
+
+ /**
+ * A simple toString that we can use for debugging
+ */
+ public String toString() {
+ return "GraphModelNode: " + getText();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.mylar.zest.core.widgets.GraphItem#dispose()
+ */
+ public void dispose() {
+ if (isFisheyeEnabled) {
+ this.fishEye(false, false);
+ }
+ super.dispose();
+ this.isDisposed = true;
+ while (getSourceConnections().size() > 0) {
+ GraphConnection connection = (GraphConnection) getSourceConnections().get(0);
+ if (!connection.isDisposed()) {
+ connection.dispose();
+ } else {
+ removeSourceConnection(connection);
+ }
+ }
+ while (getTargetConnections().size() > 0) {
+ GraphConnection connection = (GraphConnection) getTargetConnections().get(0);
+ if (!connection.isDisposed()) {
+ connection.dispose();
+ } else {
+ removeTargetConnection(connection);
+ }
+ }
+ graph.removeNode(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Widget#isDisposed()
+ */
+ public boolean isDisposed() {
+ return isDisposed;
+ }
+
+ /**
+ * Determines if this node has a fixed size or if it is packed to the size
+ * of its contents. To set a node to pack, set its size (-1, -1)
+ *
+ * @return
+ */
+ public boolean isSizeFixed() {
+ return !(this.size.width < 0 && this.size.height < 0);
+ }
+
+ /**
+ * Returns a new list of the source connections (GraphModelConnection
+ * objects).
+ *
+ * @return List a new list of GraphModelConnect objects
+ */
+ public List getSourceConnections() {
+ return new ArrayList(sourceConnections);
+ }
+
+ /**
+ * Returns a new list of the target connections (GraphModelConnection
+ * objects).
+ *
+ * @return List a new list of GraphModelConnect objects
+ */
+ public List getTargetConnections() {
+ return new ArrayList(targetConnections);
+ }
+
+ /**
+ * Returns the bounds of this node. It is just the combination of the
+ * location and the size.
+ *
+ * @return Rectangle
+ */
+ Rectangle getBounds() {
+ return new Rectangle(getLocation(), getSize());
+ }
+
+ /**
+ * Returns a copy of the node's location.
+ *
+ * @return Point
+ */
+ public Point getLocation() {
+ return currentLocation;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.mylar.zest.core.internal.graphmodel.IGraphModelNode#isSelected
+ * ()
+ */
+ public boolean isSelected() {
+ return selected;
+ }
+
+ /**
+ * Sets the current location for this node.
+ */
+ public void setLocation(double x, double y) {
+ if (currentLocation.preciseX() != x || currentLocation.preciseY() != y) {
+ currentLocation.setPreciseX(x);
+ currentLocation.setPreciseY(y);
+ refreshBounds();
+ parent.getLayoutContext().fireNodeMovedEvent(this.getLayout());
+ }
+ }
+
+ /**
+ * Returns a copy of the node's size.
+ *
+ * @return Dimension
+ */
+ public Dimension getSize() {
+ if (size.height < 0 && size.width < 0 && nodeFigure != null) {
+ return nodeFigure.getSize().getCopy();
+ }
+ return size.getCopy();
+ }
+
+ /**
+ * Get the foreground colour for this node
+ */
+ public Color getForegroundColor() {
+ return foreColor;
+ }
+
+ /**
+ * Set the foreground colour for this node
+ */
+ public void setForegroundColor(Color c) {
+ this.foreColor = c;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Get the background colour for this node. This is the color the node will
+ * be if it is not currently highlighted. This color is meaningless if a
+ * custom figure has been set.
+ */
+ public Color getBackgroundColor() {
+ return backColor;
+ }
+
+ /**
+ * Permanently sets the background color (unhighlighted). This color has no
+ * effect if a custom figure has been set.
+ *
+ * @param c
+ */
+ public void setBackgroundColor(Color c) {
+ backColor = c;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Sets the tooltip on this node. This tooltip will display if the mouse
+ * hovers over the node. Setting the tooltip has no effect if a custom
+ * figure has been set.
+ */
+ public void setTooltip(IFigure tooltip) {
+ hasCustomTooltip = true;
+ this.tooltip = tooltip;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Gets the current tooltip for this node. The tooltip returned is
+ * meaningless if a custom figure has been set.
+ */
+ public IFigure getTooltip() {
+ return this.tooltip;
+ }
+
+ /**
+ * Sets the border color.
+ *
+ * @param c
+ * the border color.
+ */
+ public void setBorderColor(Color c) {
+ borderColor = c;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Sets the highlighted border color.
+ *
+ * @param c
+ * the highlighted border color.
+ */
+ public void setBorderHighlightColor(Color c) {
+ this.borderHighlightColor = c;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Get the highlight colour for this node
+ */
+ public Color getHighlightColor() {
+ return highlightColor;
+ }
+
+ /**
+ * Set the highlight colour for this node
+ */
+ public void setHighlightColor(Color c) {
+ this.highlightColor = c;
+ }
+
+ /**
+ * Highlights the node changing the background color and border color. The
+ * source and destination connections are also highlighted, and the adjacent
+ * nodes are highlighted too in a different color.
+ */
+ public void highlight() {
+ if (highlighted == HIGHLIGHT_ON) {
+ return;
+ }
+ IFigure parentFigure = nodeFigure.getParent();
+ if (parentFigure instanceof ZestRootLayer) {
+ ((ZestRootLayer) parentFigure).highlightNode(nodeFigure);
+ }
+ highlighted = HIGHLIGHT_ON;
+ updateFigureForModel(getNodeFigure());
+ }
+
+ /**
+ * Restores the nodes original background color and border width.
+ */
+ public void unhighlight() {
+
+ if (highlighted == HIGHLIGHT_NONE) {
+ return;
+ }
+
+ IFigure parentFigure = nodeFigure.getParent();
+ if (parentFigure instanceof ZestRootLayer) {
+ ((ZestRootLayer) parentFigure).unHighlightNode(nodeFigure);
+ }
+
+ highlighted = HIGHLIGHT_NONE;
+ updateFigureForModel(nodeFigure);
+
+ }
+
+ void refreshBounds() {
+ Point loc = this.getLocation();
+ Dimension size = this.getSize();
+ Rectangle bounds = new Rectangle(loc, size);
+
+ if (nodeFigure == null || nodeFigure.getParent() == null) {
+ return; // node figure has not been created yet
+ }
+ nodeFigure.getParent().setConstraint(nodeFigure, bounds);
+
+ if (isFisheyeEnabled) {
+ Rectangle fishEyeBounds = calculateFishEyeBounds();
+ if (fishEyeBounds != null) {
+ fishEyeFigure.getParent().translateToRelative(fishEyeBounds);
+ fishEyeFigure.getParent().translateFromParent(fishEyeBounds);
+ fishEyeFigure.getParent().setConstraint(fishEyeFigure, fishEyeBounds);
+ }
+ }
+ }
+
+ public Color getBorderColor() {
+ return borderColor;
+ }
+
+ public int getBorderWidth() {
+ return borderWidth;
+ }
+
+ public void setBorderWidth(int width) {
+ this.borderWidth = width;
+ updateFigureForModel(nodeFigure);
+ }
+
+ public Font getFont() {
+ return font;
+ }
+
+ public void setFont(Font font) {
+ this.font = font;
+ updateFigureForModel(nodeFigure);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Item#setText(java.lang.String)
+ */
+ public void setText(String string) {
+ if (string == null) {
+ string = "";
+ }
+ super.setText(string);
+
+ updateFigureForModel(this.nodeFigure);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.widgets.Item#setImage(org.eclipse.swt.graphics.Image)
+ */
+ public void setImage(Image image) {
+ super.setImage(image);
+ updateFigureForModel(nodeFigure);
+ }
+
+ /**
+ * Gets the graphModel that this node is contained in
+ *
+ * @return The graph model that this node is contained in
+ */
+ public Graph getGraphModel() {
+ return this.graph;
+ }
+
+ /**
+ * @return the nodeStyle
+ */
+ public int getNodeStyle() {
+ return nodeStyle;
+ }
+
+ /**
+ * @param nodeStyle
+ * the nodeStyle to set
+ */
+ public void setNodeStyle(int nodeStyle) {
+ this.nodeStyle = nodeStyle;
+ this.cacheLabel = ((this.nodeStyle & ZestStyles.NODES_CACHE_LABEL) > 0) ? true : false;
+ }
+
+ public void setSize(double width, double height) {
+ if ((width != size.width) || (height != size.height)) {
+ size.width = (int) width;
+ size.height = (int) height;
+ refreshBounds();
+ }
+ }
+
+ public Color getBorderHighlightColor() {
+ return borderHighlightColor;
+ }
+
+ public boolean cacheLabel() {
+ return this.cacheLabel;
+ }
+
+ public void setCacheLabel(boolean cacheLabel) {
+ this.cacheLabel = cacheLabel;
+ }
+
+ IFigure getNodeFigure() {
+ return this.nodeFigure;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ this.getFigure().setVisible(visible);
+ for (Iterator iterator2 = sourceConnections.iterator(); iterator2.hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator2.next();
+ connection.setVisible(visible);
+ }
+
+ for (Iterator iterator2 = targetConnections.iterator(); iterator2.hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator2.next();
+ connection.setVisible(visible);
+ }
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public int getStyle() {
+ return super.getStyle() | this.getNodeStyle();
+ }
+
+ /***************************************************************************
+ * PRIVATE MEMBERS
+ **************************************************************************/
+
+ private IFigure fishEyeFigure = null;
+ private boolean isFisheyeEnabled;
+
+ protected IFigure fishEye(boolean enable, boolean animate) {
+ if (isDisposed) {
+ // If a fisheyed figure is still left on the canvas, we could get
+ // called once more after the dispose is called. Since we cleaned
+ // up everything on dispose, we can just return null here.
+ return null;
+ }
+ if (!checkStyle(ZestStyles.NODES_FISHEYE)) {
+ return null;
+ }
+ if (enable) {
+ // Create the fish eye label
+ fishEyeFigure = createFishEyeFigure();
+
+ Rectangle rectangle = calculateFishEyeBounds();
+
+ if (rectangle == null) {
+ return null;
+ }
+
+ // Add the fisheye
+ this.getGraphModel().fishEye(nodeFigure, fishEyeFigure, rectangle, true);
+ if (fishEyeFigure != null) {
+ isFisheyeEnabled = true;
+ }
+ return fishEyeFigure;
+
+ } else {
+ isFisheyeEnabled = false;
+ this.getGraphModel().removeFishEye(fishEyeFigure, nodeFigure, animate);
+ return null;
+ }
+ }
+
+ IContainer getParent() {
+ return parent;
+ }
+
+ boolean isHighlighted() {
+ return highlighted > 0;
+ }
+
+ protected void updateFigureForModel(IFigure currentFigure) {
+ if (currentFigure == null) {
+ return;
+ }
+
+ if (!(currentFigure instanceof GraphLabel)) {
+ return;
+ }
+ GraphLabel figure = (GraphLabel) currentFigure;
+ IFigure toolTip;
+
+ if (!checkStyle(ZestStyles.NODES_HIDE_TEXT) && !figure.getText().equals(this.getText())) {
+ figure.setText(this.getText());
+ }
+ if (figure.getIcon() != getImage()) {
+ figure.setIcon(getImage());
+ }
+
+ if (highlighted == HIGHLIGHT_ON) {
+ figure.setForegroundColor(getForegroundColor());
+ figure.setBackgroundColor(getHighlightColor());
+ figure.setBorderColor(getBorderHighlightColor());
+ } else {
+ figure.setForegroundColor(getForegroundColor());
+ figure.setBackgroundColor(getBackgroundColor());
+ figure.setBorderColor(getBorderColor());
+ }
+
+ figure.setBorderWidth(getBorderWidth());
+
+ if (figure.getFont() != getFont()) {
+ figure.setFont(getFont());
+ }
+
+ if (this.getTooltip() == null && hasCustomTooltip == false) {
+ // if we have a custom tooltip, don't try and create our own.
+ toolTip = new Label();
+ ((Label) toolTip).setText(getText());
+ } else {
+ toolTip = this.getTooltip();
+ }
+ figure.setToolTip(toolTip);
+
+ if (isFisheyeEnabled) {
+ IFigure newFisheyeFigure = createFishEyeFigure();
+ if (graph.replaceFishFigure(this.fishEyeFigure, newFisheyeFigure)) {
+ this.fishEyeFigure = newFisheyeFigure;
+ }
+ }
+ refreshBounds();
+ }
+
+ protected IFigure createFigureForModel() {
+ GraphNode node = this;
+ boolean cacheLabel = (this).cacheLabel();
+ final GraphLabel label = new GraphLabel(node.getText(), node.getImage(), cacheLabel);
+ label.setFont(this.font);
+ if (checkStyle(ZestStyles.NODES_HIDE_TEXT)) {
+ label.setText("");
+ }
+ updateFigureForModel(label);
+ label.addFigureListener(new FigureListener() {
+ private Dimension previousSize = label.getBounds().getSize();
+
+ public void figureMoved(IFigure source) {
+ if (Animation.isAnimating() || getLayout().isMinimized()) {
+ return;
+ }
+ Rectangle newBounds = nodeFigure.getBounds();
+ if (!newBounds.getSize().equals(previousSize)) {
+ previousSize = newBounds.getSize();
+ if (size.width >= 0 && size.height >= 0) {
+ size = newBounds.getSize();
+ }
+ currentLocation = new PrecisionPoint(nodeFigure.getBounds().getTopLeft());
+ parent.getLayoutContext().fireNodeResizedEvent(getLayout());
+ } else if (currentLocation.x != newBounds.x || currentLocation.y != newBounds.y) {
+ currentLocation = new PrecisionPoint(nodeFigure.getBounds().getTopLeft());
+ parent.getLayoutContext().fireNodeMovedEvent(getLayout());
+ }
+ }
+ });
+ return label;
+ }
+
+ private IFigure createFishEyeFigure() {
+ GraphNode node = this;
+ boolean cacheLabel = this.cacheLabel();
+ GraphLabel label = new GraphLabel(node.getText(), node.getImage(), cacheLabel);
+
+ if (highlighted == HIGHLIGHT_ON) {
+ label.setForegroundColor(getForegroundColor());
+ label.setBackgroundColor(getHighlightColor());
+ label.setBorderColor(getBorderHighlightColor());
+ } else {
+ label.setForegroundColor(getForegroundColor());
+ label.setBackgroundColor(getBackgroundColor());
+ label.setBorderColor(getBorderColor());
+ }
+
+ label.setBorderWidth(getBorderWidth());
+ label.setFont(getFont());
+
+ return label;
+ }
+
+ private Rectangle calculateFishEyeBounds() {
+ // Get the current Bounds
+ Rectangle rectangle = nodeFigure.getBounds().getCopy();
+
+ // Calculate how much we have to expand the current bounds to get to the
+ // new bounds
+ Dimension newSize = fishEyeFigure.getPreferredSize();
+ Rectangle currentSize = rectangle.getCopy();
+ nodeFigure.translateToAbsolute(currentSize);
+ int expandedH = Math.max((newSize.height - currentSize.height) / 2 + 1, 0);
+ int expandedW = Math.max((newSize.width - currentSize.width) / 2 + 1, 0);
+ Dimension expandAmount = new Dimension(expandedW, expandedH);
+ nodeFigure.translateToAbsolute(rectangle);
+ rectangle.expand(new Insets(expandAmount.height, expandAmount.width, expandAmount.height, expandAmount.width));
+ if (expandedH <= 0 && expandedW <= 0) {
+ return null;
+ }
+ return rectangle;
+ }
+
+ void addSourceConnection(GraphConnection connection) {
+ this.sourceConnections.add(connection);
+ }
+
+ void addTargetConnection(GraphConnection connection) {
+ this.targetConnections.add(connection);
+ }
+
+ void removeSourceConnection(GraphConnection connection) {
+ this.sourceConnections.remove(connection);
+ }
+
+ void removeTargetConnection(GraphConnection connection) {
+ this.targetConnections.remove(connection);
+ }
+
+ /**
+ * Sets the node as selected.
+ */
+ void setSelected(boolean selected) {
+ if (selected = isSelected()) {
+ return;
+ }
+ if (selected) {
+ highlight();
+ } else {
+ unhighlight();
+ }
+ this.selected = selected;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.mylar.zest.core.widgets.IGraphItem#getItemType()
+ */
+ public int getItemType() {
+ return NODE;
+ }
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public IFigure getFigure() {
+ if (this.nodeFigure == null) {
+ initFigure();
+ }
+ return this.getNodeFigure();
+ }
+
+ private InternalNodeLayout layout;
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public InternalNodeLayout getLayout() {
+ if (layout == null) {
+ layout = new InternalNodeLayout(this);
+ }
+ return layout;
+ }
+
+ void applyLayoutChanges() {
+ if (layout != null) {
+ layout.applyLayout();
+ }
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/IContainer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/IContainer.java
new file mode 100644
index 0000000..ca00e5c
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/IContainer.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle;
+
+/**
+ * @noimplement This interface is not intended to be implemented by clients.
+ *
+ */
+public interface IContainer {
+
+ public abstract Graph getGraph();
+
+ /**
+ * @since 2.0
+ */
+ public Widget getItem();
+
+ public abstract List getNodes();
+
+ /**
+ * Returns list of connections laying inside this container. Only
+ * connections which both source and target nodes lay directly in this
+ * container are returned.
+ *
+ * @return
+ * @since 2.0
+ */
+ public abstract List getConnections();
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @param graphNode
+ */
+ public abstract void addNode(GraphNode graphNode);
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @param figure
+ */
+ public abstract void addSubgraphFigure(IFigure figure);
+
+ public abstract int getItemType();
+
+ /**
+ * @return
+ * @since 2.0
+ */
+ public abstract DisplayIndependentRectangle getLayoutBounds();
+
+ /**
+ * @noreference This method is not intended to be referenced by clients.
+ * @return
+ */
+ public abstract InternalLayoutContext getLayoutContext();
+
+ public void applyLayout();
+
+ public void setLayoutAlgorithm(LayoutAlgorithm algorithm, boolean apply);
+
+ /**
+ * Takes a list of connections and returns only those which source and
+ * target nodes lay directly in this container.
+ *
+ * @param connections
+ * list of GraphConnection to filter
+ * @return filtered list
+ */
+ // protected List filterConnections(List connections) {
+ // List result = new ArrayList();
+ // for (Iterator iterator = connections.iterator(); iterator.hasNext();) {
+ // GraphConnection connection = (GraphConnection) iterator.next();
+ // if (connection.getSource().getParent() == this &&
+ // connection.getDestination().getParent() == this)
+ // result.add(connection);
+ // }
+ // return result;
+ // }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalLayoutContext.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalLayoutContext.java
new file mode 100644
index 0000000..c915d11
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalLayoutContext.java
@@ -0,0 +1,540 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle;
+import org.eclipse.zest.layouts.interfaces.ConnectionLayout;
+import org.eclipse.zest.layouts.interfaces.ContextListener;
+import org.eclipse.zest.layouts.interfaces.EntityLayout;
+import org.eclipse.zest.layouts.interfaces.ExpandCollapseManager;
+import org.eclipse.zest.layouts.interfaces.GraphStructureListener;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.LayoutListener;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+import org.eclipse.zest.layouts.interfaces.PruningListener;
+import org.eclipse.zest.layouts.interfaces.SubgraphLayout;
+
+class InternalLayoutContext implements LayoutContext {
+
+ final IContainer container;
+ private final List filters = new ArrayList();
+ private final List contextListeners = new ArrayList();
+ private final List graphStructureListeners = new ArrayList();
+ private final List layoutListeners = new ArrayList();
+ private final List pruningListeners = new ArrayList();
+ private LayoutAlgorithm mainAlgorithm;
+ private LayoutAlgorithm layoutAlgorithm;
+ private ExpandCollapseManager expandCollapseManager;
+ private SubgraphFactory subgraphFactory = new DefaultSubgraph.DefaultSubgraphFactory();
+ private final HashSet subgraphs = new HashSet();
+ private boolean eventsOn = true;
+ private boolean backgorundLayoutEnabled = true;
+ private boolean externalLayoutInvocation = false;
+
+ /**
+ * @param graph
+ * the graph owning this context
+ */
+ InternalLayoutContext(Graph graph) {
+ this.container = graph;
+ }
+
+ InternalLayoutContext(GraphContainer container) {
+ this.container = container;
+ }
+
+ public void addContextListener(ContextListener listener) {
+ contextListeners.add(listener);
+ }
+
+ public void addGraphStructureListener(GraphStructureListener listener) {
+ graphStructureListeners.add(listener);
+ }
+
+ public void addLayoutListener(LayoutListener listener) {
+ layoutListeners.add(listener);
+ }
+
+ public void addPruningListener(PruningListener listener) {
+ pruningListeners.add(listener);
+ }
+
+ public SubgraphLayout createSubgraph(NodeLayout[] nodes) {
+ checkChangesAllowed();
+ InternalNodeLayout[] internalNodes = new InternalNodeLayout[nodes.length];
+ for (int i = 0; i < nodes.length; i++) {
+ internalNodes[i] = (InternalNodeLayout) nodes[i];
+ }
+ SubgraphLayout subgraph = subgraphFactory.createSubgraph(internalNodes,
+ this);
+ subgraphs.add(subgraph);
+ return subgraph;
+ }
+
+ void removeSubgrah(DefaultSubgraph subgraph) {
+ subgraphs.remove(subgraph);
+ }
+
+ public void flushChanges(boolean animationHint) {
+ // TODO support for asynchronous call
+ if (!container.getGraph().isVisible() && animationHint) {
+ return;
+ }
+ eventsOn = false;
+ if (animationHint) {
+ Animation.markBegin();
+ }
+ for (Iterator iterator = container.getNodes().iterator(); iterator
+ .hasNext();) {
+ GraphNode node = (GraphNode) iterator.next();
+ node.applyLayoutChanges();
+ }
+ for (Iterator iterator = container.getConnections().iterator(); iterator
+ .hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ connection.applyLayoutChanges();
+ }
+ for (Iterator iterator = subgraphs.iterator(); iterator.hasNext();) {
+ DefaultSubgraph subgraph = (DefaultSubgraph) iterator.next();
+ subgraph.applyLayoutChanges();
+ }
+ if (animationHint) {
+ Animation.run(Graph.ANIMATION_TIME);
+ }
+ eventsOn = true;
+ }
+
+ public DisplayIndependentRectangle getBounds() {
+ DisplayIndependentRectangle result = new DisplayIndependentRectangle(
+ container.getLayoutBounds());
+ result.width -= 20;
+ result.height -= 20;
+ return result;
+ }
+
+ public LayoutAlgorithm getMainLayoutAlgorithm() {
+ return mainAlgorithm;
+ }
+
+ public ExpandCollapseManager getExpandCollapseManager() {
+ return expandCollapseManager;
+ }
+
+ public NodeLayout[] getNodes() {
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = this.container.getNodes().iterator(); iterator
+ .hasNext();) {
+ GraphNode node = (GraphNode) iterator.next();
+ if (!isLayoutItemFiltered(node)) {
+ result.add(node.getLayout());
+ }
+ }
+ return (NodeLayout[]) result.toArray(new NodeLayout[result.size()]);
+ }
+
+ public EntityLayout[] getEntities() {
+ HashSet addedSubgraphs = new HashSet();
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = this.container.getNodes().iterator(); iterator
+ .hasNext();) {
+ GraphNode node = (GraphNode) iterator.next();
+ if (!isLayoutItemFiltered(node)) {
+ InternalNodeLayout nodeLayout = node.getLayout();
+ if (!nodeLayout.isPruned()) {
+ result.add(nodeLayout);
+ } else {
+ SubgraphLayout subgraph = nodeLayout.getSubgraph();
+ if (subgraph.isGraphEntity()
+ && !addedSubgraphs.contains(subgraph)) {
+ result.add(subgraph);
+ addedSubgraphs.add(subgraph);
+ }
+ }
+ }
+ }
+ return (EntityLayout[]) result.toArray(new EntityLayout[result.size()]);
+ }
+
+ public SubgraphLayout[] getSubgraphs() {
+ SubgraphLayout[] result = new SubgraphLayout[subgraphs.size()];
+ int subgraphCount = 0;
+ for (Iterator iterator = subgraphs.iterator(); iterator.hasNext();) {
+ SubgraphLayout subgraph = (SubgraphLayout) iterator.next();
+ NodeLayout[] nodes = subgraph.getNodes();
+ for (int i = 0; i < nodes.length; i++) {
+ if (!isLayoutItemFiltered(((InternalNodeLayout) nodes[i])
+ .getNode())) {
+ result[subgraphCount++] = subgraph;
+ break;
+ }
+ }
+ }
+ if (subgraphCount == subgraphs.size()) {
+ return result;
+ } else {
+ SubgraphLayout[] result2 = new SubgraphLayout[subgraphCount];
+ System.arraycopy(result, 0, result2, 0, subgraphCount);
+ return result2;
+ }
+ }
+
+ public boolean isBoundsExpandable() {
+ return false;
+ }
+
+ public boolean isBackgroundLayoutEnabled() {
+ return backgorundLayoutEnabled;
+ }
+
+ void setBackgroundLayoutEnabled(boolean enabled) {
+ if (this.backgorundLayoutEnabled != enabled) {
+ this.backgorundLayoutEnabled = enabled;
+ fireBackgroundEnableChangedEvent();
+ }
+ }
+
+ public boolean isPruningEnabled() {
+ return expandCollapseManager != null;
+ }
+
+ public void removeContextListener(ContextListener listener) {
+ contextListeners.remove(listener);
+ }
+
+ public void removeGraphStructureListener(GraphStructureListener listener) {
+ graphStructureListeners.remove(listener);
+ }
+
+ public void removeLayoutListener(LayoutListener listener) {
+ layoutListeners.remove(listener);
+ }
+
+ public void removePruningListener(PruningListener listener) {
+ pruningListeners.remove(listener);
+ }
+
+ public void setMainLayoutAlgorithm(LayoutAlgorithm algorithm) {
+ mainAlgorithm = algorithm;
+ }
+
+ public void setExpandCollapseManager(
+ ExpandCollapseManager expandCollapseManager) {
+ this.expandCollapseManager = expandCollapseManager;
+ expandCollapseManager.initExpansion(this);
+ }
+
+ public ConnectionLayout[] getConnections() {
+ List connections = container.getConnections();
+ ConnectionLayout[] result = new ConnectionLayout[connections.size()];
+ int i = 0;
+ for (Iterator iterator = connections.iterator(); iterator.hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!isLayoutItemFiltered(connection)) {
+ result[i++] = connection.getLayout();
+ }
+ }
+ if (i == result.length) {
+ return result;
+ }
+ ConnectionLayout[] result2 = new ConnectionLayout[i];
+ System.arraycopy(result, 0, result2, 0, i);
+ return result2;
+ }
+
+ public ConnectionLayout[] getConnections(EntityLayout source,
+ EntityLayout target) {
+ ArrayList result = new ArrayList();
+
+ ArrayList sourcesList = new ArrayList();
+ if (source instanceof NodeLayout) {
+ sourcesList.add(source);
+ }
+ if (source instanceof SubgraphLayout) {
+ sourcesList.addAll(Arrays.asList(((SubgraphLayout) source)
+ .getNodes()));
+ }
+
+ HashSet targets = new HashSet();
+ if (target instanceof NodeLayout) {
+ targets.add(target);
+ }
+ if (target instanceof SubgraphLayout) {
+ targets.addAll(Arrays.asList(((SubgraphLayout) target).getNodes()));
+ }
+
+ for (Iterator iterator = sourcesList.iterator(); iterator.hasNext();) {
+ NodeLayout source2 = (NodeLayout) iterator.next();
+ ConnectionLayout[] outgoingConnections = source2
+ .getOutgoingConnections();
+ for (int i = 0; i < outgoingConnections.length; i++) {
+ ConnectionLayout connection = outgoingConnections[i];
+ if ((connection.getSource() == source2 && targets
+ .contains(connection.getTarget()))
+ || (connection.getTarget() == source2 && targets
+ .contains(connection.getSource()))) {
+ result.add(connection);
+ }
+ }
+
+ }
+ return (ConnectionLayout[]) result.toArray(new ConnectionLayout[result
+ .size()]);
+ }
+
+ void addFilter(LayoutFilter filter) {
+ filters.add(filter);
+ }
+
+ void removeFilter(LayoutFilter filter) {
+ filters.remove(filter);
+ }
+
+ boolean isLayoutItemFiltered(GraphItem item) {
+ for (Iterator it = filters.iterator(); it.hasNext();) {
+ LayoutFilter filter = (LayoutFilter) it.next();
+ if (filter.isObjectFiltered(item)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void setExpanded(NodeLayout node, boolean expanded) {
+ externalLayoutInvocation = true;
+ if (expandCollapseManager != null) {
+ expandCollapseManager.setExpanded(this, node, expanded);
+ }
+ externalLayoutInvocation = false;
+ }
+
+ boolean canExpand(NodeLayout node) {
+ return expandCollapseManager != null
+ && expandCollapseManager.canExpand(this, node);
+ }
+
+ boolean canCollapse(NodeLayout node) {
+ return expandCollapseManager != null
+ && expandCollapseManager.canCollapse(this, node);
+ }
+
+ void setSubgraphFactory(SubgraphFactory factory) {
+ subgraphFactory = factory;
+ }
+
+ SubgraphFactory getSubgraphFactory() {
+ return subgraphFactory;
+ }
+
+ void applyMainAlgorithm() {
+ if (backgorundLayoutEnabled && mainAlgorithm != null) {
+ mainAlgorithm.applyLayout(true);
+ flushChanges(false);
+ }
+ }
+
+ /**
+ * Sets layout algorithm for this context. It differs from
+ * {@link #setMainLayoutAlgorithm(LayoutAlgorithm) main algorithm} in that
+ * it's always used when {@link #applyLayoutAlgorithm(boolean)} and not
+ * after firing of events.
+ */
+ void setLayoutAlgorithm(LayoutAlgorithm algorithm) {
+ if (this.layoutAlgorithm != null) {
+ this.layoutAlgorithm.setLayoutContext(null);
+ }
+ this.layoutAlgorithm = algorithm;
+ this.layoutAlgorithm.setLayoutContext(this);
+ }
+
+ LayoutAlgorithm getLayoutAlgorithm() {
+ return layoutAlgorithm;
+ }
+
+ void applyLayout(boolean clean) {
+ if (layoutAlgorithm != null) {
+ externalLayoutInvocation = true;
+ layoutAlgorithm.applyLayout(clean);
+ externalLayoutInvocation = false;
+ }
+ }
+
+ void checkChangesAllowed() {
+ if (!backgorundLayoutEnabled && !externalLayoutInvocation) {
+ throw new RuntimeException(
+ "Layout not allowed to perform changes in layout context!");
+ }
+ }
+
+ void fireNodeAddedEvent(NodeLayout node) {
+ boolean intercepted = !eventsOn;
+ GraphStructureListener[] listeners = (GraphStructureListener[]) graphStructureListeners
+ .toArray(new GraphStructureListener[graphStructureListeners
+ .size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].nodeAdded(this, node);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireNodeRemovedEvent(NodeLayout node) {
+ boolean intercepted = !eventsOn;
+ GraphStructureListener[] listeners = (GraphStructureListener[]) graphStructureListeners
+ .toArray(new GraphStructureListener[graphStructureListeners
+ .size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].nodeRemoved(this, node);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireConnectionAddedEvent(ConnectionLayout connection) {
+ InternalLayoutContext sourceContext = ((InternalNodeLayout) connection
+ .getSource()).getOwnerLayoutContext();
+ InternalLayoutContext targetContext = ((InternalNodeLayout) connection
+ .getTarget()).getOwnerLayoutContext();
+ if (sourceContext != targetContext) {
+ return;
+ }
+ if (sourceContext == this) {
+ boolean intercepted = !eventsOn;
+ GraphStructureListener[] listeners = (GraphStructureListener[]) graphStructureListeners
+ .toArray(new GraphStructureListener[graphStructureListeners
+ .size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].connectionAdded(this, connection);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ } else {
+ sourceContext.fireConnectionAddedEvent(connection);
+ }
+ }
+
+ void fireConnectionRemovedEvent(ConnectionLayout connection) {
+ InternalLayoutContext sourceContext = ((InternalNodeLayout) connection
+ .getSource()).getOwnerLayoutContext();
+ InternalLayoutContext targetContext = ((InternalNodeLayout) connection
+ .getTarget()).getOwnerLayoutContext();
+ if (sourceContext != targetContext) {
+ return;
+ }
+ if (sourceContext == this) {
+ boolean intercepted = !eventsOn;
+ GraphStructureListener[] listeners = (GraphStructureListener[]) graphStructureListeners
+ .toArray(new GraphStructureListener[graphStructureListeners
+ .size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].connectionRemoved(this, connection);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ } else {
+ sourceContext.fireConnectionAddedEvent(connection);
+ }
+ }
+
+ void fireBoundsChangedEvent() {
+ boolean intercepted = !eventsOn;
+ ContextListener[] listeners = (ContextListener[]) contextListeners
+ .toArray(new ContextListener[contextListeners.size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].boundsChanged(this);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireBackgroundEnableChangedEvent() {
+ ContextListener[] listeners = (ContextListener[]) contextListeners
+ .toArray(new ContextListener[contextListeners.size()]);
+ for (int i = 0; i < listeners.length; i++) {
+ listeners[i].backgroundEnableChanged(this);
+ }
+ }
+
+ void fireNodeMovedEvent(InternalNodeLayout node) {
+ if (eventsOn) {
+ node.refreshLocation();
+ }
+ boolean intercepted = !eventsOn;
+ LayoutListener[] listeners = (LayoutListener[]) layoutListeners
+ .toArray(new LayoutListener[layoutListeners.size()]);
+ node.setLocation(node.getNode().getLocation().x, node.getNode()
+ .getLocation().y);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].nodeMoved(this, node);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireNodeResizedEvent(InternalNodeLayout node) {
+ if (eventsOn) {
+ node.refreshSize();
+ node.refreshLocation();
+ }
+ boolean intercepted = !eventsOn;
+ LayoutListener[] listeners = (LayoutListener[]) layoutListeners
+ .toArray(new LayoutListener[layoutListeners.size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].nodeResized(this, node);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireSubgraphMovedEvent(DefaultSubgraph subgraph) {
+ if (eventsOn) {
+ subgraph.refreshLocation();
+ }
+ boolean intercepted = !eventsOn;
+ LayoutListener[] listeners = (LayoutListener[]) layoutListeners
+ .toArray(new LayoutListener[layoutListeners.size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].subgraphMoved(this, subgraph);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+
+ void fireSubgraphResizedEvent(DefaultSubgraph subgraph) {
+ if (eventsOn) {
+ subgraph.refreshSize();
+ subgraph.refreshLocation();
+ }
+ boolean intercepted = !eventsOn;
+ LayoutListener[] listeners = (LayoutListener[]) layoutListeners
+ .toArray(new LayoutListener[layoutListeners.size()]);
+ for (int i = 0; i < listeners.length && !intercepted; i++) {
+ intercepted = listeners[i].subgraphResized(this, subgraph);
+ }
+ if (!intercepted) {
+ applyMainAlgorithm();
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalNodeLayout.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalNodeLayout.java
new file mode 100644
index 0000000..0a61ed4
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/InternalNodeLayout.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentDimension;
+import org.eclipse.zest.layouts.dataStructures.DisplayIndependentPoint;
+import org.eclipse.zest.layouts.interfaces.ConnectionLayout;
+import org.eclipse.zest.layouts.interfaces.EntityLayout;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+import org.eclipse.zest.layouts.interfaces.SubgraphLayout;
+
+class InternalNodeLayout implements NodeLayout {
+
+ /**
+ * This listener is added to nodes' figures as a workaround for the problem
+ * of minimized nodes leaving single on the graph pixels when zoomed out
+ */
+ private final static FigureListener figureListener = new FigureListener() {
+ public void figureMoved(IFigure source) {
+ // hide figures of minimized nodes
+ GraphNode node = (GraphNode) figureToNode.get(source);
+ if (node.getLayout().isMinimized() && source.getSize().equals(0, 0)) {
+ source.setVisible(false);
+ } else {
+ source.setVisible(node.isVisible());
+ }
+ }
+ };
+ private final static HashMap figureToNode = new HashMap();
+
+ private DisplayIndependentPoint location;
+ private DisplayIndependentDimension size;
+ private boolean minimized = false;
+ private final GraphNode node;
+ private final InternalLayoutContext ownerLayoutContext;
+ private DefaultSubgraph subgraph;
+ private boolean isDisposed = false;
+
+ public InternalNodeLayout(GraphNode graphNode) {
+ this.node = graphNode;
+ this.ownerLayoutContext = node.parent.getLayoutContext();
+ graphNode.nodeFigure.addFigureListener(figureListener);
+ figureToNode.put(graphNode.nodeFigure, graphNode);
+ }
+
+ public DisplayIndependentPoint getLocation() {
+ if (location == null) {
+ refreshLocation();
+ }
+ return new DisplayIndependentPoint(location);
+ }
+
+ public DisplayIndependentDimension getSize() {
+ if (size == null) {
+ refreshSize();
+ }
+ return new DisplayIndependentDimension(size);
+ }
+
+ public SubgraphLayout getSubgraph() {
+ return subgraph;
+ }
+
+ public boolean isMovable() {
+ return true;
+ }
+
+ public boolean isPrunable() {
+ return ownerLayoutContext.isPruningEnabled();
+ }
+
+ public boolean isPruned() {
+ return subgraph != null;
+ }
+
+ public boolean isResizable() {
+ return (node.parent.getItem().getStyle() & ZestStyles.NODES_NO_LAYOUT_RESIZE) == 0;
+ }
+
+ public void prune(SubgraphLayout subgraph) {
+ if (subgraph != null && !(subgraph instanceof DefaultSubgraph)) {
+ throw new RuntimeException(
+ "InternalNodeLayout can be pruned only to instance of DefaultSubgraph.");
+ }
+ ownerLayoutContext.checkChangesAllowed();
+ if (subgraph == this.subgraph) {
+ return;
+ }
+ if (this.subgraph != null) {
+ SubgraphLayout subgraph2 = this.subgraph;
+ this.subgraph = null;
+ subgraph2.removeNodes(new NodeLayout[] { this });
+ }
+ if (subgraph != null) {
+ this.subgraph = (DefaultSubgraph) subgraph;
+ subgraph.addNodes(new NodeLayout[] { this });
+ }
+ }
+
+ public void setLocation(double x, double y) {
+ if (!ownerLayoutContext.isLayoutItemFiltered(this.getNode())) {
+ ownerLayoutContext.checkChangesAllowed();
+ internalSetLocation(x, y);
+ }
+ }
+
+ private void internalSetLocation(double x, double y) {
+ if (location != null) {
+ location.x = x;
+ location.y = y;
+ } else {
+ location = new DisplayIndependentPoint(x, y);
+ }
+ }
+
+ public void setSize(double width, double height) {
+ ownerLayoutContext.checkChangesAllowed();
+ internalSetSize(width, height);
+ }
+
+ private void internalSetSize(double width, double height) {
+ if (size != null) {
+ size.width = width;
+ size.height = height;
+ } else {
+ size = new DisplayIndependentDimension(width, height);
+ }
+ }
+
+ public void setMinimized(boolean minimized) {
+ ownerLayoutContext.checkChangesAllowed();
+ getSize();
+ this.minimized = minimized;
+ }
+
+ public boolean isMinimized() {
+ return minimized;
+ }
+
+ public NodeLayout[] getPredecessingNodes() {
+ ConnectionLayout[] connections = getIncomingConnections();
+ NodeLayout[] result = new NodeLayout[connections.length];
+ for (int i = 0; i < connections.length; i++) {
+ result[i] = connections[i].getSource();
+ if (result[i] == this) {
+ result[i] = connections[i].getTarget();
+ }
+ }
+ return result;
+ }
+
+ public NodeLayout[] getSuccessingNodes() {
+ ConnectionLayout[] connections = getOutgoingConnections();
+ NodeLayout[] result = new NodeLayout[connections.length];
+ for (int i = 0; i < connections.length; i++) {
+ result[i] = connections[i].getTarget();
+ if (result[i] == this) {
+ result[i] = connections[i].getSource();
+ }
+ }
+ return result;
+ }
+
+ public EntityLayout[] getSuccessingEntities() {
+ if (isPruned()) {
+ return new NodeLayout[0];
+ }
+ ArrayList result = new ArrayList();
+ HashSet addedSubgraphs = new HashSet();
+ NodeLayout[] successingNodes = getSuccessingNodes();
+ for (int i = 0; i < successingNodes.length; i++) {
+ if (!successingNodes[i].isPruned()) {
+ result.add(successingNodes[i]);
+ } else {
+ SubgraphLayout successingSubgraph = successingNodes[i]
+ .getSubgraph();
+ if (successingSubgraph.isGraphEntity()
+ && !addedSubgraphs.contains(successingSubgraph)) {
+ result.add(successingSubgraph);
+ addedSubgraphs.add(successingSubgraph);
+ }
+ }
+ }
+ return (EntityLayout[]) result.toArray(new EntityLayout[result.size()]);
+ }
+
+ public EntityLayout[] getPredecessingEntities() {
+ if (isPruned()) {
+ return new NodeLayout[0];
+ }
+ ArrayList result = new ArrayList();
+ HashSet addedSubgraphs = new HashSet();
+ NodeLayout[] predecessingNodes = getPredecessingNodes();
+ for (int i = 0; i < predecessingNodes.length; i++) {
+ if (!predecessingNodes[i].isPruned()) {
+ result.add(predecessingNodes[i]);
+ } else {
+ SubgraphLayout predecessingSubgraph = predecessingNodes[i]
+ .getSubgraph();
+ if (predecessingSubgraph.isGraphEntity()
+ && !addedSubgraphs.contains(predecessingSubgraph)) {
+ result.add(predecessingSubgraph);
+ addedSubgraphs.add(predecessingSubgraph);
+ }
+ }
+ }
+ return (EntityLayout[]) result.toArray(new EntityLayout[result.size()]);
+ }
+
+ public ConnectionLayout[] getIncomingConnections() {
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = node.getTargetConnections().iterator(); iterator
+ .hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!ownerLayoutContext.isLayoutItemFiltered(connection)) {
+ result.add(connection.getLayout());
+ }
+ }
+ for (Iterator iterator = node.getSourceConnections().iterator(); iterator
+ .hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!connection.isDirected()
+ && !ownerLayoutContext.isLayoutItemFiltered(connection)) {
+ result.add(connection.getLayout());
+ }
+ }
+ return (ConnectionLayout[]) result.toArray(new ConnectionLayout[result
+ .size()]);
+ }
+
+ public ConnectionLayout[] getOutgoingConnections() {
+ ArrayList result = new ArrayList();
+ for (Iterator iterator = node.getSourceConnections().iterator(); iterator
+ .hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!ownerLayoutContext.isLayoutItemFiltered(connection)) {
+ result.add(connection.getLayout());
+ }
+ }
+ for (Iterator iterator = node.getTargetConnections().iterator(); iterator
+ .hasNext();) {
+ GraphConnection connection = (GraphConnection) iterator.next();
+ if (!connection.isDirected()
+ && !ownerLayoutContext.isLayoutItemFiltered(connection)) {
+ result.add(connection.getLayout());
+ }
+ }
+ return (ConnectionLayout[]) result.toArray(new ConnectionLayout[result
+ .size()]);
+ }
+
+ public double getPreferredAspectRatio() {
+ return 0;
+ }
+
+ GraphNode getNode() {
+ return node;
+ }
+
+ void applyLayout() {
+ if (minimized) {
+ node.setSize(0, 0);
+ if (location != null) {
+ node.setLocation(location.x, location.y);
+ }
+ } else {
+ node.setSize(-1, -1);
+ if (location != null) {
+ node.setLocation(location.x - getSize().width / 2, location.y
+ - size.height / 2);
+ }
+ if (size != null) {
+ Dimension currentSize = node.getSize();
+ if (size.width != currentSize.width
+ || size.height != currentSize.height) {
+ node.setSize(size.width, size.height);
+ }
+ }
+ }
+ }
+
+ InternalLayoutContext getOwnerLayoutContext() {
+ return ownerLayoutContext;
+ }
+
+ void refreshSize() {
+ Dimension size2 = node.getSize();
+ internalSetSize(size2.width, size2.height);
+ }
+
+ void refreshLocation() {
+ Point location2 = node.getLocation();
+ internalSetLocation(location2.x + getSize().width / 2, location2.y
+ + size.height / 2);
+ }
+
+ public String toString() {
+ return node.toString() + "(layout)";
+ }
+
+ void dispose() {
+ isDisposed = true;
+ if (subgraph != null) {
+ subgraph.removeDisposedNodes();
+ }
+ ownerLayoutContext.fireNodeRemovedEvent(node.getLayout());
+ figureToNode.remove(node.nodeFigure);
+ }
+
+ boolean isDisposed() {
+ return isDisposed;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/LayoutFilter.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/LayoutFilter.java
new file mode 100644
index 0000000..d575d5c
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/LayoutFilter.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+/**
+ * @since 2.0
+ */
+public interface LayoutFilter {
+
+ public boolean isObjectFiltered(GraphItem item);
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/PrunedSuccessorsSubgraph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/PrunedSuccessorsSubgraph.java
new file mode 100644
index 0000000..c033ead
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/PrunedSuccessorsSubgraph.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import org.eclipse.draw2d.AncestorListener;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.FigureListener;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.widgets.internal.GraphLabel;
+import org.eclipse.zest.core.widgets.internal.ZestRootLayer;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+
+/**
+ * A subgraph that for each unexpanded node in a graph adds a label showing
+ * number of pruned successors (as unexpanded node is considered a node for
+ * which {@link Graph#canExpand(GraphNode)} returns true AND
+ * {@link Graph#canCollapse(GraphNode)} returns false). It doesn't matter which
+ * subgraph a node is pruned to, so the factory for this subgraph uses one
+ * instance for whole layout context.
+ */
+class PrunedSuccessorsSubgraph extends DefaultSubgraph {
+
+ private class LabelAncestorListener extends AncestorListener.Stub {
+ private final IFigure originalFigure;
+ private IFigure fisheyeFigure;
+
+ public LabelAncestorListener(IFigure originalFigure,
+ IFigure fisheyeFigure) {
+ this.originalFigure = originalFigure;
+ this.fisheyeFigure = fisheyeFigure;
+ }
+
+ public void ancestorRemoved(IFigure ancestor) {
+ if (fisheyeFigure != null) {
+ final GraphLabel label = (GraphLabel) nodeFigureToLabel
+ .get(fisheyeFigure);
+ if (label == null) {
+ return;
+ }
+ nodeFigureToLabel.remove(fisheyeFigure);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ label.removeAncestorListener(LabelAncestorListener.this);
+ }
+ });
+ fisheyeFigure.removeFigureListener(nodeFigureListener);
+ originalFigure.addFigureListener(nodeFigureListener);
+ labelToAncestorListener.remove(label);
+ fisheyeFigure = null;
+ addLabelForFigure(originalFigure, label);
+ refreshLabelBounds(originalFigure, label);
+ }
+ }
+ }
+
+ private final FigureListener nodeFigureListener = new FigureListener() {
+ public void figureMoved(IFigure source) {
+ GraphLabel label = (GraphLabel) nodeFigureToLabel.get(source);
+ if (label != null) {
+ refreshLabelBounds(source, label);
+ }
+ }
+ };
+
+ private final FisheyeListener fisheyeListener = new FisheyeListener() {
+
+ public void fisheyeReplaced(Graph graph, IFigure oldFisheyeFigure,
+ IFigure newFisheyeFigure) {
+ oldFisheyeFigure.removeFigureListener(nodeFigureListener);
+ newFisheyeFigure.addFigureListener(nodeFigureListener);
+ GraphLabel label = (GraphLabel) nodeFigureToLabel
+ .remove(oldFisheyeFigure);
+ nodeFigureToLabel.put(newFisheyeFigure, label);
+
+ LabelAncestorListener ancestorListener = (LabelAncestorListener) labelToAncestorListener
+ .get(label);
+ ancestorListener.fisheyeFigure = null;
+ addLabelForFigure(newFisheyeFigure, label);
+ ancestorListener.fisheyeFigure = newFisheyeFigure;
+ refreshLabelBounds(newFisheyeFigure, label);
+ }
+
+ public void fisheyeRemoved(Graph graph, IFigure originalFigure,
+ IFigure fisheyeFigure) {
+ // do nothing - labelAncestorListener will take care of cleaning
+ // up
+ }
+
+ public void fisheyeAdded(Graph graph, IFigure originalFigure,
+ IFigure fisheyeFigure) {
+ originalFigure.removeFigureListener(nodeFigureListener);
+ fisheyeFigure.addFigureListener(nodeFigureListener);
+ GraphLabel label = (GraphLabel) nodeFigureToLabel
+ .get(originalFigure);
+ if (label == null) {
+ return;
+ }
+ nodeFigureToLabel.put(fisheyeFigure, label);
+ refreshLabelBounds(fisheyeFigure, label);
+ addLabelForFigure(fisheyeFigure, label);
+ LabelAncestorListener labelAncestorListener = new LabelAncestorListener(
+ originalFigure, fisheyeFigure);
+ label.addAncestorListener(labelAncestorListener);
+ labelToAncestorListener.put(label, labelAncestorListener);
+ }
+ };
+
+ /**
+ * Maps from figures of nodes to labels showing number of nodes hidden
+ * successors
+ */
+ private HashMap nodeFigureToLabel = new HashMap();
+
+ private HashMap labelToAncestorListener = new HashMap();
+
+ protected PrunedSuccessorsSubgraph(LayoutContext context2) {
+ super(context2);
+ context.container.getGraph().addFisheyeListener(fisheyeListener);
+ }
+
+ public void addNodes(NodeLayout[] nodes) {
+ super.addNodes(nodes);
+ HashSet nodesToUpdate = new HashSet();
+ for (int i = 0; i < nodes.length; i++) {
+ nodesToUpdate
+ .addAll(Arrays.asList(nodes[i].getPredecessingNodes()));
+ }
+ for (Iterator iterator = nodesToUpdate.iterator(); iterator.hasNext();) {
+ InternalNodeLayout nodeToUpdate = (InternalNodeLayout) iterator
+ .next();
+ updateNodeLabel(nodeToUpdate);
+ }
+
+ }
+
+ public void removeNodes(NodeLayout[] nodes) {
+ super.removeNodes(nodes);
+ HashSet nodesToUpdate = new HashSet();
+ for (int i = 0; i < nodes.length; i++) {
+ nodesToUpdate
+ .addAll(Arrays.asList(nodes[i].getPredecessingNodes()));
+ if (((InternalNodeLayout) nodes[i]).isDisposed()) {
+ removeFigureForNode((InternalNodeLayout) nodes[i]);
+ } else {
+ nodesToUpdate.add(nodes[i]);
+ }
+ }
+ for (Iterator iterator = nodesToUpdate.iterator(); iterator.hasNext();) {
+ InternalNodeLayout predecessor = (InternalNodeLayout) iterator
+ .next();
+ updateNodeLabel(predecessor);
+ }
+ }
+
+ private void addLabelForFigure(IFigure figure, GraphLabel label) {
+ IFigure parent = figure.getParent();
+ if (parent instanceof ZestRootLayer) {
+ ((ZestRootLayer) parent).addDecoration(figure, label);
+ } else {
+ if (parent.getChildren().contains(label)) {
+ parent.remove(label);
+ }
+ int index = parent.getChildren().indexOf(figure);
+ parent.add(label, index + 1);
+ }
+ }
+
+ private void refreshLabelBounds(IFigure figure, GraphLabel label) {
+ Rectangle figureBounds = figure.getBounds();
+ if (figureBounds.width * figureBounds.height > 0) {
+ label.setText(label.getText()); // hack: resets label's size
+ Dimension labelSize = label.getSize();
+ labelSize.expand(-6, -4);
+ Point anchorPoint = figure.getBounds().getBottomRight();
+ anchorPoint.x -= labelSize.width / 2;
+ anchorPoint.y -= labelSize.height / 2;
+ Rectangle bounds = new Rectangle(anchorPoint, labelSize);
+ label.setBounds(bounds);
+ label.getParent().setConstraint(label, bounds);
+ } else {
+ label.getParent().setConstraint(label,
+ new Rectangle(figureBounds.x, figureBounds.y, 0, 0));
+ label.setBounds(new Rectangle(figureBounds.x, figureBounds.y, 0, 0));
+ }
+ }
+
+ void updateNodeLabel(InternalNodeLayout internalNode) {
+ if (internalNode.isDisposed()) {
+ return;
+ }
+ IFigure figure = internalNode.getNode().getFigure();
+ GraphLabel label = (GraphLabel) nodeFigureToLabel.get(figure);
+ IFigure fisheye = getFisheyeFigure(figure);
+ if (fisheye != null) {
+ figure = fisheye;
+ }
+ if (label == null) {
+ label = new GraphLabel(false);
+ label.setForegroundColor(ColorConstants.white);
+ label.setBackgroundColor(ColorConstants.red);
+ FontData fontData = Display.getDefault().getSystemFont()
+ .getFontData()[0];
+ fontData.setHeight(6);
+ label.setFont(new Font(Display.getCurrent(), fontData));
+ figure.addFigureListener(nodeFigureListener);
+ addLabelForFigure(figure, label);
+ nodeFigureToLabel.put(figure, label);
+ }
+
+ GraphNode graphNode = internalNode.getNode();
+ if (!graphNode.getGraphModel().canExpand(graphNode)
+ || graphNode.getGraphModel().canCollapse(graphNode)
+ || internalNode.isPruned()) {
+ label.setVisible(false);
+ } else {
+ NodeLayout[] successors = internalNode.getSuccessingNodes();
+ int numberOfHiddenSuccessors = 0;
+ for (int i = 0; i < successors.length; i++) {
+ if (successors[i].isPruned()) {
+ numberOfHiddenSuccessors++;
+ }
+ }
+ String labelText = numberOfHiddenSuccessors > 0 ? ""
+ + numberOfHiddenSuccessors : "";
+ if (!labelText.equals(label.getText())) {
+ label.setText(labelText);
+ }
+ label.setVisible(true);
+ }
+
+ refreshLabelBounds(figure, label);
+ }
+
+ private IFigure getFisheyeFigure(IFigure originalFigure) {
+ // a node has a fisheye if and only if its label has an AncestorListener
+ GraphLabel label = (GraphLabel) nodeFigureToLabel.get(originalFigure);
+ LabelAncestorListener ancestorListener = (LabelAncestorListener) labelToAncestorListener
+ .get(label);
+ if (ancestorListener != null) {
+ return ancestorListener.fisheyeFigure;
+ }
+ return null;
+ }
+
+ private void removeFigureForNode(InternalNodeLayout internalNode) {
+ IFigure figure = internalNode.getNode().getFigure();
+ GraphLabel label = (GraphLabel) nodeFigureToLabel.get(figure);
+ if (label != null && label.getParent() != null) {
+ label.getParent().remove(label);
+ }
+ nodeFigureToLabel.remove(figure);
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/SubgraphFactory.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/SubgraphFactory.java
new file mode 100644
index 0000000..e5007fb
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/SubgraphFactory.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+import org.eclipse.zest.layouts.interfaces.SubgraphLayout;
+
+/**
+ * Factory used by {@link Graph} to create subgraphs. One instance of
+ * SubgraphFactory can be used with multiple graphs unless explicitly stated
+ * otherwise.
+ *
+ * @since 2.0
+ */
+public interface SubgraphFactory {
+ SubgraphLayout createSubgraph(NodeLayout[] nodes, LayoutContext context);
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/ZestStyles.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/ZestStyles.java
new file mode 100644
index 0000000..97ebb34
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/ZestStyles.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets;
+
+/**
+ * Style constants used in Zest.
+ *
+ * @author Chris Callendar
+ */
+public final class ZestStyles {
+
+ /**
+ * A constant known to be zero (0), used in operations which take bit flags
+ * to indicate that "no bits are set".
+ */
+ public static final int NONE = 0;
+
+ /**
+ * Style constant indicating that invisible nodes should be ignored for
+ * layouts.
+ */
+ public static final int IGNORE_INVISIBLE_LAYOUT = 1 << 1;
+
+ /**
+ * Style constant indicating if the selected node's neighbors should be
+ * highlighted. Note: this is a node-level style. It should not be applied
+ * to graph views during construction.
+ *
+ */
+ // public static final int NODES_HIGHLIGHT_ADJACENT = 1 << 1;
+ /**
+ * Style constant indicating that node labels should be cached. This is
+ * important under GTK+ because font drawing is slower than Windows.
+ */
+ public static final int NODES_CACHE_LABEL = 1 << 1;
+
+ /**
+ * Style to specify that the node should contain a fisheye label when the
+ * mouse moves over it. By default the fisheye node is just the label with
+ * larger text.
+ */
+ public static final int NODES_FISHEYE = 1 << 2;
+
+ /**
+ * Style to specify that the node should not show its text (only its image).
+ * This with the NODES_FISHEYE style should help with large graphs (since
+ * the fisheye style will show the text).
+ */
+ public static final int NODES_HIDE_TEXT = 1 << 3;
+
+ /**
+ * Style constant indiciating that nodes should not be resized on layout.
+ */
+ public static final int NODES_NO_LAYOUT_RESIZE = 1 << 4;
+ /**
+ * Style indicating that connections should show their direction by default.
+ */
+ public static final int CONNECTIONS_DIRECTED = 1 << 1;
+
+ /**
+ * Style constant to indicate that connections should be drawn with solid
+ * lines (this is the default).
+ */
+ public static final int CONNECTIONS_SOLID = 1 << 2;
+ /**
+ * Style constant to indicate that connections should be drawn with dashed
+ * lines.
+ */
+ public static final int CONNECTIONS_DASH = 1 << 3;
+ /**
+ * Style constant to indicate that connections should be drawn with dotted
+ * lines.
+ */
+ public static final int CONNECTIONS_DOT = 1 << 4;
+ /**
+ * Style constant to indicate that connections should be drawn with
+ * dash-dotted lines.
+ */
+ public static final int CONNECTIONS_DASH_DOT = 1 << 5;
+
+ /**
+ * Bitwise ANDs the styleToCheck integer with the given style.
+ *
+ * @param style
+ * @param styleToCheck
+ * @return boolean if styleToCheck is part of the style
+ */
+ public static boolean checkStyle(int style, int styleToCheck) {
+ return ((style & styleToCheck) == styleToCheck);
+ }
+
+ /**
+ * Validates the given style for connections to see if it is legal. Returns
+ * false if not.
+ *
+ * @param style
+ * the style to check.
+ * @return true iff the given style is legal.
+ */
+ public static boolean validateConnectionStyle(int styleToValidate) {
+ int style = styleToValidate;
+ // int illegal = CONNECTIONS_CURVED | CONNECTIONS_STRAIGHT |
+ // CONNECTIONS_BEZIER;
+ /*
+ * int illegal = CONNECTIONS_STRAIGHT; style &= illegal; int rightBit =
+ * style & (-style); boolean okay = (style == rightBit); if (!okay) {
+ * return okay; }
+ */
+
+ int illegal = CONNECTIONS_DASH_DOT | CONNECTIONS_DASH | CONNECTIONS_DOT
+ | CONNECTIONS_SOLID;
+ style = styleToValidate;
+ style &= illegal;
+ int rightBit = style & (-style);
+ boolean okay = (style == rightBit);
+ if (!okay) {
+ return okay;
+ }
+
+ return true;
+
+ // @tag zest.bug.160368-ConnectionAlign.fix : must check the connections
+ // to make sure that there isnt' an illegal combination of alignments.
+ /*
+ * illegal = CONNECTIONS_VALIGN_BOTTOM | CONNECTIONS_VALIGN_MIDDLE |
+ * CONNECTIONS_VALIGN_TOP; style = styleToValidate; style &= illegal;
+ * rightBit = style & (-style); return (style == rightBit);
+ */
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/CGraphNode.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/CGraphNode.java
new file mode 100644
index 0000000..a4142bd
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/CGraphNode.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ * Mateusz Matela
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.custom;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphContainer;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * A Custom Graph Node
+ *
+ * @since 2.0
+ */
+public class CGraphNode extends GraphNode {
+
+ IFigure figure = null;
+
+ /**
+ * @since 2.0
+ */
+ public CGraphNode(Graph graphModel, int style, IFigure figure) {
+ super(graphModel, style, figure);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public CGraphNode(GraphContainer graphModel, int style, IFigure figure) {
+ super(graphModel, style, figure);
+ }
+
+ public IFigure getFigure() {
+ return super.getFigure();
+ }
+
+ protected IFigure createFigureForModel() {
+ this.figure = (IFigure) this.getData();
+ return this.figure;
+ }
+
+ public void setBackgroundColor(Color c) {
+ getFigure().setBackgroundColor(c);
+ }
+
+ public void setFont(Font font) {
+ getFigure().setFont(font);
+ }
+
+ public Color getBackgroundColor() {
+ return getFigure().getBackgroundColor();
+ }
+
+ public Font getFont() {
+ return getFigure().getFont();
+ }
+
+ public Color getForegroundColor() {
+ return getFigure().getForegroundColor();
+ }
+
+ protected void updateFigureForModel(IFigure currentFigure) {
+ // Undefined
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/LabelSubgraph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/LabelSubgraph.java
new file mode 100644
index 0000000..7b0b532
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/LabelSubgraph.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation
+ * Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.custom;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.zest.core.widgets.FigureSubgraph;
+import org.eclipse.zest.core.widgets.internal.GraphLabel;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+
+/**
+ * A subgraph layout that displays a label showing number of items pruned within
+ * it.
+ *
+ * @since 2.0
+ */
+public class LabelSubgraph extends FigureSubgraph {
+
+ private Color backgroundColor;
+ private Color foregroundColor;
+
+ /**
+ * Sets the foreground color of this subgraph (that is color of the text on
+ * the label).
+ *
+ * @param color
+ * color to set
+ */
+ public void setForegroundColor(Color color) {
+ figure.setForegroundColor(color);
+ }
+
+ /**
+ * Sets the background color of this subgraph's label.
+ *
+ * @param color
+ * color to set
+ */
+ public void setBackgroundColor(Color color) {
+ figure.setBackgroundColor(color);
+ }
+
+ protected void createFigure() {
+ figure = new GraphLabel(false);
+ figure.setForegroundColor(foregroundColor);
+ figure.setBackgroundColor(backgroundColor);
+ updateFigure();
+ }
+
+ protected void updateFigure() {
+ ((Label) figure).setText("" + nodes.size());
+ }
+
+ public LabelSubgraph(NodeLayout[] nodes, LayoutContext context,
+ Color foregroundColor, Color backgroundColor) {
+ super(nodes, context);
+ this.foregroundColor = foregroundColor;
+ this.backgroundColor = backgroundColor;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/TriangleSubgraph.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/TriangleSubgraph.java
new file mode 100644
index 0000000..3e2bb04
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/custom/TriangleSubgraph.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 Mateusz Matela and others. 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: Mateusz Matela - initial API and implementation Ian Bull
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.custom;
+
+import java.util.HashMap;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Shape;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.zest.core.widgets.FigureSubgraph;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutObserver;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutObserver.TreeListener;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutObserver.TreeNode;
+import org.eclipse.zest.layouts.interfaces.LayoutContext;
+import org.eclipse.zest.layouts.interfaces.NodeLayout;
+import org.eclipse.zest.layouts.interfaces.SubgraphLayout;
+
+/**
+ * A subgraph that is visualized in a graph as a triangle. It assumes that nodes
+ * in context that uses them are arranged in a tree structure and the nodes
+ * added to the subgraph are a subtree (except for the subtree's root, which
+ * should not be added).
+ *
+ * The triangle has three features that show the properties of a subtree
+ * contained within it:
+ * <ul>
+ * <li><b>Height of the triangle</b> is proportional to the height of the
+ * subtree. If the subtree contains the whole tree, the triangle's height will
+ * be equal to value provided with
+ * {@link TriangleSubgraph#setReferenceHeight(double)} (default is 50).</li>
+ * <li><b>Length of the triangle's base</b> depends on the number of leaves in
+ * the subtree. More precisely, it is proportional to the logarithm of the
+ * percent that the subtree's leaves make of the whole context's leaves. The
+ * proportion factor is adjusted so that for a subtree containing all the leaves
+ * the base has length provided with {@link TriangleSubgraph}
+ * {@link #setReferenceBase(double)} (default is 50) and for a subtree
+ * containing only one leaf the base has length 1.</li>
+ * <li><b>Background color of the triangle</b> depends on average number of
+ * children for nodes in the subtree. The less is this value, the more bright is
+ * the color (up to white for a subtree with average number of children equal to
+ * 1). The average value is calculated only for nodes that have at least one
+ * child. The root of the subtree (which is not directly added to this subgraph)
+ * is also accounted.</li>
+ * </ul>
+ *
+ * When the first subgraph of this class is created for a layout context, a
+ * {@link TreeLayoutObserver} is created for the context. It must keep track of
+ * changes in the graph structure, so events related to it should not be
+ * intercepted by other listeners before they reach the subgraph's observer.
+ *
+ * @since 2.0
+ */
+public class TriangleSubgraph extends FigureSubgraph {
+
+ public static class TriangleParameters implements Cloneable {
+ public Color color = ColorConstants.black;
+
+ public int direction = TOP_DOWN;
+
+ public double referenceHeight = 50;
+
+ public double referenceBase = 50;
+
+ public Object clone() {
+ TriangleParameters result = new TriangleParameters();
+ result.color = color;
+ result.direction = direction;
+ result.referenceHeight = referenceHeight;
+ result.referenceBase = referenceBase;
+ return result;
+ }
+ }
+
+ private class IsoscelesTriangle extends Shape {
+
+ private PointList points = new PointList(3);
+
+ protected void fillShape(Graphics graphics) {
+ graphics.fillPolygon(points);
+ }
+
+ protected void outlineShape(Graphics graphics) {
+ graphics.drawPolygon(points);
+ }
+
+ protected void primTranslate(int dx, int dy) {
+ super.primTranslate(dx, dy);
+ points.translate(dx, dy);
+ }
+
+ public void validate() {
+ super.validate();
+ Rectangle r = new Rectangle();
+ r.setBounds(getBounds());
+ r.shrink(getInsets());
+ points.removeAllPoints();
+ switch (parameters.direction) {
+ case TOP_DOWN:
+ points.addPoint(r.x + r.width / 2, r.y);
+ points.addPoint(r.x, r.y + r.height);
+ points.addPoint(r.x + r.width, r.y + r.height);
+ break;
+ case BOTTOM_UP:
+ points.addPoint(r.x + r.width / 2, r.y + r.height);
+ points.addPoint(r.x, r.y);
+ points.addPoint(r.x + r.width, r.y);
+ break;
+ case LEFT_RIGHT:
+ points.addPoint(r.x, r.y + r.height / 2);
+ points.addPoint(r.x + r.width, r.y);
+ points.addPoint(r.x + r.width, r.y + r.height);
+ break;
+ case RIGHT_LEFT:
+ points.addPoint(r.x + r.width, r.y + r.height / 2);
+ points.addPoint(r.x, r.y);
+ points.addPoint(r.x, r.y + r.height);
+ break;
+ }
+ }
+ }
+
+ private static HashMap contextToTree = new HashMap();
+
+ private TriangleParameters parameters;
+
+ public TriangleSubgraph(NodeLayout[] nodes, LayoutContext context, TriangleParameters triangleParameters) {
+ super(nodes, context);
+ this.parameters = triangleParameters;
+ if (contextToTree.get(context) == null) {
+ TreeLayoutObserver treeLayoutObserver = new TreeLayoutObserver(context, null);
+ treeLayoutObserver.addTreeListener(new TreeListener() {
+ protected void defaultHandle(TreeNode changedNode) {
+ SubgraphLayout subgraph = changedNode.getNode().getSubgraph();
+ if (subgraph instanceof TriangleSubgraph) {
+ ((TriangleSubgraph) subgraph).updateFigure();
+ }
+ }
+ });
+ contextToTree.put(context, treeLayoutObserver);
+ }
+ }
+
+ protected void createFigure() {
+ figure = new IsoscelesTriangle();
+ figure.setBackgroundColor(parameters.color);
+ figure.setForegroundColor(parameters.color);
+ }
+
+ private double log(double value, double base) {
+ return Math.log(value) / Math.log(base);
+ }
+
+ protected void updateFigure() {
+ TreeLayoutObserver tree = (TreeLayoutObserver) contextToTree.get(context);
+ TreeNode subgraphRoot = tree.getTreeNode((NodeLayout) nodes.iterator().next());
+ if (subgraphRoot == null) {
+ return;
+ }
+ while (nodes.contains(subgraphRoot.getNode())) {
+ subgraphRoot = subgraphRoot.getParent();
+ }
+
+ TreeNode superRoot = tree.getSuperRoot();
+ double triangleHeight = parameters.referenceHeight * subgraphRoot.getHeight() / superRoot.getHeight();
+
+ int numOfNodes = superRoot.getNumOfDescendants();
+ int numOfNodesWithChildren = numOfNodes - superRoot.getNumOfLeaves() + 1;
+ double logBase = (numOfNodesWithChildren > 0) ? (double) numOfNodes / numOfNodesWithChildren : 1;
+ // logarithm base is the average number of children for whole context
+ double triangleBaseModifier = (parameters.referenceBase - 1) / log(superRoot.getNumOfLeaves(), logBase);
+ double triangleBase = parameters.referenceBase + triangleBaseModifier * log((double) subgraphRoot.getNumOfLeaves() / superRoot.getNumOfLeaves(), logBase);
+
+ if (parameters.direction == 0) {
+ parameters.direction = parameters.direction;
+ }
+ if (parameters.direction == TOP_DOWN || parameters.direction == BOTTOM_UP) {
+ figure.setSize((int) (triangleBase + 0.5), (int) (triangleHeight + 0.5));
+ } else {
+ figure.setSize((int) (triangleHeight + 0.5), (int) (triangleBase + 0.5));
+ }
+
+ int numOfNodesWithChildrenInSubgraph = nodes.size() - subgraphRoot.getNumOfLeaves() + 1;
+ double avgNumOfChildrenInSugbraph = (numOfNodesWithChildrenInSubgraph > 0) ? (double) nodes.size() / numOfNodesWithChildrenInSubgraph : 1;
+ int r = (int) (parameters.color.getRed() + ((double) 255 - parameters.color.getRed()) / avgNumOfChildrenInSugbraph);
+ int g = (int) (parameters.color.getGreen() + ((double) 255 - parameters.color.getGreen()) / avgNumOfChildrenInSugbraph);
+ int b = (int) (parameters.color.getBlue() + ((double) 255 - parameters.color.getBlue()) / avgNumOfChildrenInSugbraph);
+ figure.setBackgroundColor(new Color(parameters.color.getDevice(), r, g, b));
+ figure.setForegroundColor(parameters.color);
+ }
+
+ public boolean isDirectionDependant() {
+ return true;
+ }
+
+ public void setDirection(int direction) {
+ super.setDirection(direction);
+ if (parameters.direction == direction) {
+ return;
+ }
+ if (direction == TOP_DOWN || direction == BOTTOM_UP || direction == LEFT_RIGHT || direction == RIGHT_LEFT) {
+ parameters.direction = direction;
+ updateFigure();
+ } else {
+ throw new IllegalArgumentException("invalid direction");
+ }
+ }
+
+ /**
+ * Changes the color of the triangle visualizing this subgraph.
+ *
+ * @param color
+ * color to use
+ */
+ public void setColor(Color color) {
+ parameters.color = color;
+ updateFigure();
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AligningBendpointLocator.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AligningBendpointLocator.java
new file mode 100644
index 0000000..e3d0bc2
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AligningBendpointLocator.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC, Canada.
+ * 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:
+ * The Chisel Group, University of Victoria
+ *******************************************************************************/
+package org.eclipse.zest.core.widgets.internal;
+
+import org.eclipse.draw2d.AbstractLocator;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+
+/**
+ * A locator that finds the middle of a connection based on the bendpoints.
+ *
+ * @author Del Myers
+ *
+ */
+// @tag zest(bug(154391-ArcEnds(fix))) : use this locator to ensure that labels
+// will be in the middle of connections.
+// @tag zest.bug.160368-ConnectionAlign : replaces MidBenpointLocator in order
+// to have finer control over alignment.
+public class AligningBendpointLocator extends AbstractLocator {
+ /**
+ * "Vertical" alignment contstant. Figures should be placed in the middle of
+ * the line.
+ */
+ public static final int MIDDLE = 0;
+ /**
+ * "Vertical" alignment constant. Figures should be placed above the line.
+ */
+ public static final int ABOVE = 1;
+ /**
+ * "Vertical" alignment constant. Figures should be placed below the line.
+ */
+ public static final int BELOW = 2;
+
+ /**
+ * "Horizontal" alignment constant. Figures should be placed in the center
+ * of the points on the line.
+ */
+ public static final int CENTER = 0;
+
+ /**
+ * "Horizontal" alignment constant. Figures should be placed at the
+ * beginning of the line. Figures will be anchored so that they have one end
+ * at the beginning of the connection, not so that they are centered at the
+ * start point. Which end of the figure is placed at that point will depend
+ * on the direction of the first two points.
+ */
+ public static final int BEGINNING = 1;
+
+ /**
+ * "Horizontal" alignment constant. Figures should be placed at the end of
+ * the line. Figures will be anchored so that they have one end at the
+ * beginning of the connection, not so that they are centered at the end
+ * point. Which end of the figure is placed at that point will depend on the
+ * direction of the last two points.
+ */
+ public static final int END = 2;
+
+ /**
+ * "Horizontal" alignment constant. Figures should be centered between the
+ * first two points on the connection. For connections with only two points,
+ * this will behave the same as CENTER.
+ */
+ public static final int CENTER_BEGINNING = 3;
+
+ /**
+ * "Horizontal" alignment constant. Figures should be centered between the
+ * last two points on the connection. For connections with only two points,
+ * this will behave the same as CENTER.
+ */
+ public static final int CENTER_END = 4;
+ private int horizontal;
+ private int vertical;
+ private Connection connection;
+
+ /**
+ * @param connection
+ */
+ public AligningBendpointLocator(Connection connection) {
+ this(connection, CENTER, MIDDLE);
+ }
+
+ public AligningBendpointLocator(Connection connection, int horizontal,
+ int vertical) {
+ this.connection = connection;
+ this.horizontal = horizontal;
+ this.vertical = vertical;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.ConnectionLocator#getReferencePoint()
+ */
+ protected Point getReferencePoint() {
+ PointList points = getConnection().getPoints();
+ Point p = points.getMidpoint().getCopy();
+ PointList tempPoints = new PointList();
+ switch (horizontal) {
+ case BEGINNING:
+ p = points.getFirstPoint().getCopy();
+ break;
+ case END:
+ p = points.getLastPoint().getCopy();
+ break;
+ case CENTER_BEGINNING:
+ tempPoints.addPoint(points.getFirstPoint().getCopy());
+ tempPoints.addPoint(points.getPoint(1).getCopy());
+ p = tempPoints.getMidpoint().getCopy();
+ break;
+ case CENTER_END:
+ tempPoints = new PointList();
+ int s = points.size();
+ tempPoints.addPoint(points.getLastPoint().getCopy());
+ tempPoints.addPoint(points.getPoint(s - 2).getCopy());
+ p = tempPoints.getMidpoint().getCopy();
+ case CENTER:
+ default:
+ p = points.getMidpoint().getCopy();
+ }
+ return p;
+ }
+
+ /**
+ * Recalculates the position of the figure and returns the updated bounds.
+ *
+ * @param target
+ * The figure to relocate
+ */
+ public void relocate(IFigure target) {
+ Dimension prefSize = target.getPreferredSize();
+ Point center = getReferencePoint();
+ calculatePosition();
+ // @tag zest(bug(GEFProblem)) : there seems to be a bug in GEF that if
+ // the following is done, then labels get printed in the wrong location
+ // target.translateToRelative(center);
+ target.setBounds(getNewBounds(prefSize, center));
+ }
+
+ /**
+ * Translates the center point depending on the horizontal and veritical
+ * alignments based on the given bounds.
+ *
+ * @param center
+ */
+ private void calculatePosition() {
+ PointList points = getConnection().getPoints();
+ int position = 0;
+ switch (horizontal) {
+ case BEGINNING:
+ Point first = points.getFirstPoint();
+ Point next = points.getPoint(1);
+ if (first.x <= next.x) {
+ position |= PositionConstants.EAST;
+ } else {
+ position |= PositionConstants.WEST;
+ }
+ break;
+ case END:
+ Point last = points.getLastPoint();
+ int s = points.size();
+ Point before = points.getPoint(s - 1);
+ if (last.x <= before.x) {
+ position |= PositionConstants.EAST;
+ } else {
+ position |= PositionConstants.WEST;
+ }
+ break;
+ }
+ if (position == 0) {
+ position = PositionConstants.CENTER;
+ }
+ switch (vertical) {
+ case ABOVE:
+ position |= PositionConstants.NORTH;
+ break;
+ case BELOW:
+ position |= PositionConstants.SOUTH;
+ break;
+ case MIDDLE:
+ position |= PositionConstants.MIDDLE;
+ }
+ setRelativePosition(position);
+
+ }
+
+ /**
+ * @return the horizontal alignment.
+ */
+ public int getHorizontalAlignment() {
+ return horizontal;
+ }
+
+ /**
+ * @param horizontal
+ * the horizontal alignment to set. One of CENTER, BEGINNING,
+ * END, CENTER_BEGINNING, or CENTER_END.
+ */
+ public void setHorizontalAlignment(int horizontal) {
+ this.horizontal = horizontal;
+ }
+
+ /**
+ * @param vertical
+ * the vertical alignment to set. One of ABOVE, MIDDLE, or BELOW.
+ */
+ public void setVerticalAlginment(int vertical) {
+ this.vertical = vertical;
+ }
+
+ /**
+ * @return the vertical alginment.
+ */
+ public int getVerticalAlignment() {
+ return vertical;
+ }
+
+ /**
+ * @return the connection
+ */
+ public Connection getConnection() {
+ return connection;
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AspectRatioFreeformLayer.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AspectRatioFreeformLayer.java
new file mode 100644
index 0000000..c335c65
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/AspectRatioFreeformLayer.java
@@ -0,0 +1,224 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.internal;
+
+import org.eclipse.draw2d.FreeformFigure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.PrecisionDimension;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.draw2d.geometry.Translatable;
+import org.eclipse.draw2d.text.CaretInfo;
+
+// @tag zest.bug.156286-Scaling.fix : make this implement scalable figure so
+// that a zoom manager can be used on GraphEditParts.
+public class AspectRatioFreeformLayer extends FreeformLayer implements ScalableFigure, FreeformFigure {
+
+ private double widthScale = 1.0;
+ private double heigthScale = 1.0;
+
+ public AspectRatioFreeformLayer(String debugLabel) {
+ widthScale = 1D;
+ heigthScale = 1D;
+ setLayoutManager(new FreeformLayout());
+ setBorder(new MarginBorder(5));
+
+ // setOpaque(false);
+ }
+
+ protected boolean isValidationRoot() {
+ return true;
+ }
+
+ public void setScale(double wScale, double hScale) {
+ this.widthScale = wScale;
+ this.heigthScale = hScale;
+ }
+
+ public double getWidthScale() {
+ return this.widthScale;
+ }
+
+ public double getHeightScale() {
+ return this.heigthScale;
+ }
+
+ /*
+ * public boolean isCoordinateSystem() { // TODO Auto-generated method stub
+ * return true; }
+ */
+
+ public double getScale() {
+ // TODO Auto-generated method stub
+ throw new RuntimeException("Operation not supported");
+ // return this.widthScale;
+
+ // throw new RuntimeException("Operation Not supported");
+ }
+
+ public void setScale(double scale) {
+ // super.setScale( scale );
+ this.widthScale = scale;
+ this.heigthScale = scale;
+ revalidate();
+ repaint();
+ // System.out.println("Operation not supported");
+ // throw new RuntimeException("Operation not supported");
+ }
+
+ /**
+ * @see org.eclipse.draw2d.Figure#getClientArea()
+ */
+
+ public Rectangle getClientArea(Rectangle rect) {
+ // return super.getClientArea(rect);
+
+ rect.width /= widthScale;
+ rect.height /= heigthScale;
+ rect.x /= widthScale;
+ rect.y /= heigthScale;
+ return rect;
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension d = super.getPreferredSize(wHint, hHint);
+ int w = getInsets().getWidth();
+ int h = getInsets().getHeight();
+ return d.getExpanded(-w, -h).scale(widthScale, heigthScale).expand(w, h);
+ }
+
+ public void translateFromParent(Translatable t) {
+ super.translateFromParent(t);
+ // t.performScale(1/widthScale);
+
+ if (t instanceof PrecisionRectangle) {
+ PrecisionRectangle r = (PrecisionRectangle) t;
+ r.setPreciseX(r.preciseX() * (1 / widthScale));
+ r.setPreciseY(r.preciseY() * (1 / heigthScale));
+ r.setPreciseWidth(r.preciseWidth() * (1 / widthScale));
+ r.setPreciseHeight(r.preciseHeight() * (1 / heigthScale));
+ } else if (t instanceof Rectangle) {
+ Rectangle r = (Rectangle) t;
+ r.scale(1 / widthScale, 1 / heigthScale);
+ } else if (t instanceof CaretInfo) {
+ CaretInfo c = (CaretInfo) t;
+ c.performScale(1 / heigthScale);
+ } else if (t instanceof PrecisionDimension) {
+ PrecisionDimension d = (PrecisionDimension) t;
+ d.setPreciseWidth(d.preciseWidth() * (1 / widthScale));
+ d.setPreciseHeight(d.preciseHeight() * (1 / heigthScale));
+ } else if (t instanceof Dimension) {
+ Dimension d = (Dimension) t;
+ d.scale(1 / widthScale, 1 / heigthScale);
+ } else if (t instanceof PrecisionPoint) {
+ PrecisionPoint p = (PrecisionPoint) t;
+ p.setPreciseX(p.preciseX() * (1 / widthScale));
+ p.setPreciseY(p.preciseY() * (1 / heigthScale));
+ } else if (t instanceof Point) {
+ Point p = (Point) t;
+ p.scale(1 / widthScale, 1 / heigthScale);
+ } else if (t instanceof PointList) {
+ throw new RuntimeException("PointList not supported in AspectRatioScale");
+ } else {
+ throw new RuntimeException(t.toString() + " not supported in AspectRatioScale");
+ }
+
+ // t.performScale(1/widthScale);
+ }
+
+ public void translateToParent(Translatable t) {
+ // t.performScale(widthScale);
+
+ if (t instanceof PrecisionRectangle) {
+ PrecisionRectangle r = (PrecisionRectangle) t;
+ r.setPreciseX(r.preciseX() * widthScale);
+ r.setPreciseY(r.preciseY() * heigthScale);
+ r.setPreciseWidth(r.preciseWidth() * widthScale);
+ r.setPreciseHeight(r.preciseHeight() * heigthScale);
+ } else if (t instanceof Rectangle) {
+ Rectangle r = (Rectangle) t;
+ // r.performScale(widthScale);
+ r.scale(widthScale, heigthScale);
+ } else if (t instanceof CaretInfo) {
+ CaretInfo c = (CaretInfo) t;
+ c.performScale(heigthScale);
+ } else if (t instanceof PrecisionDimension) {
+ PrecisionDimension d = (PrecisionDimension) t;
+ d.setPreciseWidth(d.preciseWidth() * widthScale);
+ d.setPreciseHeight(d.preciseHeight() * heigthScale);
+ } else if (t instanceof Dimension) {
+ Dimension d = (Dimension) t;
+ d.scale(widthScale, heigthScale);
+ } else if (t instanceof PrecisionPoint) {
+ PrecisionPoint p = (PrecisionPoint) t;
+ p.setPreciseX(p.preciseX() * widthScale);
+ p.setPreciseY(p.preciseY() * heigthScale);
+ } else if (t instanceof Point) {
+ Point p = (Point) t;
+ p.scale(widthScale, heigthScale);
+ } else if (t instanceof PointList) {
+ throw new RuntimeException("PointList not supported in AspectRatioScale");
+ } else {
+ throw new RuntimeException(t.toString() + " not supported in AspectRatioScale");
+ }
+
+ super.translateToParent(t);
+ }
+
+ // protected boolean useLocalCoordinates() {
+ // return true;
+ // }
+
+ protected void paintClientArea(Graphics graphics) {
+
+ if (getChildren().isEmpty()) {
+ return;
+ }
+
+ XYScaledGraphics g = null;
+ boolean disposeGraphics = false;
+ if (graphics instanceof XYScaledGraphics) {
+ g = (XYScaledGraphics) graphics;
+ } else {
+ g = new XYScaledGraphics(graphics);
+ disposeGraphics = true;
+ }
+
+ boolean optimizeClip = getBorder() == null || getBorder().isOpaque();
+ if (!optimizeClip) {
+ g.clipRect(getBounds().getShrinked(getInsets()));
+ }
+
+ // g.translate((int)(getBounds().x + getInsets().left) ,
+ // (int)(getBounds().y + getInsets().top) );
+
+ g.scale(widthScale, heigthScale);
+ // g.scale(widthScale);
+
+ // g.scale(widthScale);
+ g.pushState();
+ paintChildren(g);
+ g.popState();
+ if (disposeGraphics) {
+ g.dispose();
+ graphics.restoreState();
+ }
+
+ }
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java
new file mode 100644
index 0000000..70f6c3d
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.internal;
+
+import org.eclipse.draw2d.Animation;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.SWTGraphics;
+import org.eclipse.draw2d.ScaledGraphics;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * A cached label to improve performance of text drawing under linux
+ *
+ * @author Ian Bull
+ *
+ */
+public abstract class CachedLabel extends Label {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Label#paintFigure(org.eclipse.draw2d.Graphics)
+ */
+ Image cachedImage = null;
+ boolean cacheLabel = false;
+ boolean invalidationRequired = false;
+
+ /**
+ * CachedLabel constructor.
+ *
+ * @param cacheLabel
+ * Should the label be cached, or should the text be re-layedout
+ * each time
+ */
+ public CachedLabel(boolean cacheLabel) {
+ this.cacheLabel = cacheLabel;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Label#setIcon(org.eclipse.swt.graphics.Image)
+ */
+ public void setIcon(Image image) {
+ updateInvalidation();
+ super.setIcon(image);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Figure#setForegroundColor(org.eclipse.swt.graphics
+ * .Color)
+ */
+ public void setForegroundColor(Color fg) {
+ updateInvalidation();
+ super.setForegroundColor(fg);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Figure#setBackgroundColor(org.eclipse.swt.graphics
+ * .Color)
+ */
+ public void setBackgroundColor(Color bg) {
+ updateInvalidation();
+ super.setBackgroundColor(bg);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Figure#setFont(org.eclipse.swt.graphics.Font)
+ */
+ public void setFont(Font f) {
+ updateInvalidation();
+ super.setFont(f);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Label#setText(java.lang.String)
+ */
+ public void setText(String s) {
+ updateInvalidation();
+ super.setText(s);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Figure#setSize(int, int)
+ */
+ public void setSize(int w, int h) {
+ updateInvalidation();
+
+ if (cachedImage != null && shouldInvalidateCache()) {
+ cleanImage();
+ }
+ super.setSize(w, h);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Figure#setBounds(org.eclipse.draw2d.geometry.Rectangle
+ * )
+ */
+ public void setBounds(Rectangle rect) {
+ boolean resize = (rect.width != bounds.width)
+ || (rect.height != bounds.height);
+
+ if (resize && Animation.isAnimating()) {
+ updateInvalidation();
+ }
+ if (resize && shouldInvalidateCache() && cachedImage != null) {
+ cleanImage();
+ }
+
+ super.setBounds(rect);
+ }
+
+ /**
+ * Override this method to return the background colour for the text Note:
+ * Text must have a background color since it is being stored in an image
+ * (You can set it to white if you want)
+ *
+ * @return
+ */
+ protected abstract Color getBackgroundTextColor();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.draw2d.Label#paintFigure(org.eclipse.draw2d.Graphics)
+ */
+ static Rectangle tempRect = new Rectangle();
+
+ protected void paintFigure(Graphics graphics) {
+ if (graphics.getClass() == ScaledGraphics.class) {
+ if (((ScaledGraphics) graphics).getAbsoluteScale() < 0.30) {
+ return;
+ }
+ }
+ if (!cacheLabel) {
+ if (isOpaque()) {
+ super.paintFigure(graphics);
+ }
+ Rectangle bounds = getBounds();
+ graphics.translate(bounds.x, bounds.y);
+ if (getIcon() != null) {
+ graphics.drawImage(getIcon(), getIconLocation());
+ }
+ if (!isEnabled()) {
+ graphics.translate(1, 1);
+ graphics.setForegroundColor(ColorConstants.buttonLightest);
+ graphics.drawText(getSubStringText(), getTextLocation());
+ graphics.translate(-1, -1);
+ graphics.setForegroundColor(ColorConstants.buttonDarker);
+ }
+ graphics.drawText(getText(), getTextLocation());
+ graphics.translate(-bounds.x, -bounds.y);
+ return;
+ }
+
+ if (isOpaque()) {
+ graphics.fillRectangle(getBounds());
+ }
+ Rectangle bounds = getBounds();
+ graphics.translate(bounds.x, bounds.y);
+
+ Image icon = getIcon();
+
+ if (icon != null) {
+ graphics.drawImage(icon, getIconLocation());
+ }
+
+ int width = getSubStringTextSize().width;
+ int height = getSubStringTextSize().height;
+
+ if (cachedImage == null || shouldInvalidateCache()) {
+ invalidationRequired = false;
+ cleanImage();
+ cachedImage = new Image(Display.getCurrent(), width, height);
+
+ // @tag TODO : Dispose of the image properly
+ // ZestPlugin.getDefault().addImage(cachedImage.toString(),
+ // cachedImage);
+
+ GC gc = new GC(cachedImage);
+
+ Graphics graphics2 = new SWTGraphics(gc);
+ graphics2.setBackgroundColor(getBackgroundTextColor());
+ graphics2.fillRectangle(0, 0, width, height);
+ graphics2.setForegroundColor(getForegroundColor());
+ // graphics2.drawText(getSubStringText(), new Point(0, 0));
+ graphics2.drawText(getText(), new Point(0, 0));
+ gc.dispose();
+
+ }
+ graphics.drawImage(cachedImage, getTextLocation());
+ graphics.translate(-bounds.x, -bounds.y);
+ this.paintBorder(graphics);
+
+ }
+
+ /**
+ * Determine if the image should be remade or not
+ *
+ * @return
+ */
+ private boolean shouldInvalidateCache() {
+ if (invalidationRequired && !Animation.isAnimating()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Notifies the cache that the image will need updating.
+ */
+ private void updateInvalidation() {
+ invalidationRequired = true;
+ }
+
+ protected void cleanImage() {
+ if (cachedImage != null) {
+
+ // ZestPlugin.getDefault().removeImage(cachedImage.toString());
+ cachedImage.dispose();
+ cachedImage = null;
+ }
+ }
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ContainerFigure.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ContainerFigure.java
new file mode 100644
index 0000000..b5ee653
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ContainerFigure.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2009-2010 EclipseSource and others. 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: EclipseSource - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.internal;
+
+import org.eclipse.draw2d.Figure;
+
+/**
+ * A figure used as the root of a container.
+ */
+public class ContainerFigure extends Figure {
+
+}
diff --git a/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ExpandGraphLabel.java b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ExpandGraphLabel.java
new file mode 100644
index 0000000..0e9800e
--- /dev/null
+++ b/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/ExpandGraphLabel.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright 2005-2010, CHISEL Group, University of Victoria, Victoria, BC,
+ * Canada. 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: The Chisel Group, University of Victoria
+ ******************************************************************************/
+package org.eclipse.zest.core.widgets.internal;
+
+import org.eclipse.draw2d.ActionEvent;
+import org.eclipse.draw2d.ActionListener;
+import org.eclipse.draw2d.Clickable;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.Triangle;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.zest.core.widgets.GraphContainer;
+
+public class ExpandGraphLabel extends Figure implements ActionListener {
+
+ public static final int OPEN = 1;
+ public static final int CLOSED = 2;
+ private int state = CLOSED;
+ private Expander expander = null;
+
+ class Expander extends Clickable {
+ private Triangle triangle;
+
+ public Expander() {
+ setStyle(Clickable.STYLE_TOGGLE);
+ triangle = new Triangle();
+ triangle.setSize(10, 10);
+ triangle.setBackgroundColor(ColorConstants.black);
+ triangle.setForegroundColor(ColorConstants.black);
+ triangle.setFill(true);
+ triangle.setDirection(Triangle.EAST);
+ triangle.setLocation(new Point(5, 3));
+ this.setLayoutManager(new FreeformLayout());
+ this.add(triangle);
+ this.setPreferredSize(15, 15);
+ this.addActionListener(ExpandGraphLabel.this);
+ }
+
+ public void open() {
+ triangle.setDirection(Triangle.SOUTH);
+ }
+
+ public void close() {
+ triangle.setDirection(Triangle.EAST);
+ }
+
+ }
+
+ /**
+ * Sets the expander state (the little triangle) to ExpanderGraphLabel.OPEN
+ * or ExpanderGraphLabel.CLOSED
+ *
+ * @param state
+ */
+ public void setExpandedState(int state) {
+ if (state == OPEN) {
+ expander.open();
+ } else {
+ expander.close();
+ }
+ this.state = state;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.ActionListener#actionPerformed(org.eclipse.draw2d.
+ * ActionEvent)
+ */
+ public void actionPerformed(ActionEvent event) {
+ if (state == OPEN) {
+ container.close(true);
+
+ } else {
+ container.open(true);
+ }
+ }
+
+ private int arcWidth;
+ private Label label = null;
+ private final GraphContainer container;
+ private ToolbarLayout layout;
+
+ public ExpandGraphLabel(GraphContainer container, boolean cacheLabel) {
+ this(container, "", null, cacheLabel);
+ }
+
+ public ExpandGraphLabel(GraphContainer container, Image i,
+ boolean cacheLabel) {
+ this(container, "", i, cacheLabel);
+ }
+
+ public ExpandGraphLabel(GraphContainer container, String text,
+ boolean cacheLabel) {
+ this(container, text, null, cacheLabel);
+ }
+
+ public ExpandGraphLabel(GraphContainer container, String text, Image image,
+ boolean cacheLabel) {
+ this.label = new Label(text) {
+
+ /*
+ * This method is overwritten so that the text is not truncated.
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Label#paintFigure(org.eclipse.draw2d.Graphics)
+ */
+ protected void paintFigure(Graphics graphics) {
+ if (isOpaque()) {
+ super.paintFigure(graphics);
+ }
+ Rectangle bounds = getBounds();
+ graphics.translate(bounds.x, bounds.y);
+ if (getIcon() != null) {
+ graphics.drawImage(getIcon(), getIconLocation());
+ }
+ if (!isEnabled()) {
+ graphics.translate(1, 1);
+ graphics.setForegroundColor(ColorConstants.buttonLightest);
+ graphics.drawText(getSubStringText(), getTextLocation());
+ graphics.translate(-1, -1);
+ graphics.setForegroundColor(ColorConstants.buttonDarker);
+ }
+ graphics.drawText(getText(), getTextLocation());
+ graphics.translate(-bounds.x, -bounds.y);
+ }
+ };
+ this.setText(text);
+ this.setImage(image);
+ this.container = container;
+ this.expander = new Expander();
+ this.arcWidth = 8;
+ this.setFont(Display.getDefault().getSystemFont());
+ layout = new ToolbarLayout(true);
+ layout.setSpacing(5);
+ layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ this.setLayoutManager(layout);
+ this.add(this.expander);
+ this.add(this.label);
+ // this.remove(this.label);
+ }
+
+ /**
+ * Adjust the bounds to make the text fit without truncation.
+ */
+ protected void adjustBoundsToFit() {
+ String text = getText();
+ if ((text != null) && (text.length() > 0)) {
+ Font font = getFont();
+ if (font != null) {
+ Dimension minSize = FigureUtilities.getTextExtents(text, font);
+ if (getIcon() != null) {
+ org.eclipse.swt.graphics.Rectangle imageRect = getIcon()
+ .getBounds();
+ int expandHeight = Math.max(imageRect.height
+ - minSize.height, 0);
+ minSize.expand(imageRect.width + 4, expandHeight);
+ }
+ minSize.expand(10 + (2 * 1) + 100, 4 + (2 * 1));
+ label.setBounds(new Rectangle(getLocation(), minSize));
+ }
+ }
+ }
+
+ private Image getIcon() {
+ return this.label.getIcon();
+ }
+
+ private String getText() {
+ return this.label.getText();
+ }
<