Zest Graph Viewer reference points to null all of a sudden [message #665550] |
Fri, 15 April 2011 04:53 |
Florian Wieland Messages: 6 Registered: April 2011 |
Junior Member |
|
|
Hi,
I am programming an application within Eclipse RCP, there I have got an editor containing a tree viewer and a view containing a graph viewer (Zest). The graph viewer should mirror the currently activated tree viewer. I am able to set the initial model to the graph viewer but when another tree is activated or opened in the tree viewer I want to update the graph viewer by setting a new input [viewer.setInput(newModel)]. But now it comes when I do this, the graph viewer reference has become null and obviously I get a nullpointerexeption.
I do not set it to null, could it be something within Eclipse? Here is some of the viewer code witch I mainly took from the vogella-tutorium.
Are there any known solutions? Do I use the setInput in a wrong way? How could it be, that the reference gets null and even a second reference I initiated got null so someone might have stolen my viewer object even with references still pointing at it but on the other hand the graph is still shown in the GUI....
I hope there is some enlightening
Greetings Florian
public class GraphView extends ViewPart implements IZoomableWorkbenchPart,IStartup,IPartListener{
public static final String ID = "hazardtree.graphView.GraphView";
private GraphViewer viewer;
public GraphView() {
// TODO Auto-generated constructor stub
}
@Override
public void createPartControl(Composite parent) {
viewer = new GraphViewer(parent, SWT.BORDER);
viewer.setContentProvider(new GraphContentProvider());
viewer.setLabelProvider(new GraphLabelProvider());
viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
LayoutAlgorithm layout = setLayout();
viewer.setLayoutAlgorithm(layout, true);
viewer.applyLayout();
fillToolBar();
viewer.setInput(ChainFactory.buildChain(0));
}
[...]
@Override
public void partActivated(IWorkbenchPart part) {
if (part instanceof ChainEditor){
Chain chain = ((ChainEditor)part).getChain();
if (chain != null){
this.viewer.setInput(chain);
}
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02994 seconds