3

I am currently developing an eclipse plugin which displays DOT-Graphs. For this purpose I make use of this plugin. However, I have no idea how to actually display the graph which I built. I want to display it in the middle of the eclipse window as an Editor.

To get this done I created a custom Editor class which needs some code in its createPartControl(Composite) code in order to make use of the DotGraphView which is provided by the plugin.

The question is, how can I display this DotGraphView? The code of my Editor looks like this:

@Override
public void createPartControl(Composite container) {
    DotImport importer = new DotImport(TEST_GRAPH);
    Graph graph = importer.newGraphInstance();
    DotGraphView dotGraphView = new DotGraphView();
    dotGraphView.setGraph(graph);

    // add dotGraphView as a child to container and display it
    // What todo here?
}
Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79
Basic Coder
  • 10,882
  • 6
  • 42
  • 75
  • I think you'll have problems as DotGraphView is designed to be located in an `IViewSite`. It makes some calls to `getViewSite()` which would be an issue if you're embedding it in an editor. You could possibly provide your own `IViewSite` implementation to pass to it's `init()` method and delegate most calls to your `IEditorSite`, but don't know if you'd run into any further problems. – Nick Wilson Feb 19 '15 at 09:03
  • How can I realise this using a normal View? Post an answer and I will accept it. – Basic Coder Feb 19 '15 at 14:49

1 Answers1

0

To use the graph in your own custom view, check out the implementation of ZestFxUiView, the superclass of DotGraphView. You could probably subclass ZestFxUiView and call setGraph with your graph object.

Fabian Steeg
  • 44,988
  • 7
  • 85
  • 112