title: Try to clear a Zest graph
body: <p>I am trying to clear a Zest Graph from all nodes and connections, so that I can redraw the Graph with new Nodes and Connections. To realize that I wrote the following method</p>
  
  <pre><code>     public void clearGraph( Graph graph ) {        
       Object[] objects = graph.getConnections().toArray() ;          
           for (int i = 0 ; i &lt; objects.length; i++){
               GraphConnection graCon = (GraphConnection) objects[i];              
               graCon.dispose();
               //graCon.setVisible(false);
           }           
       objects = graph.getNodes().toArray();      
       for ( int i = 0 ; i &lt; objects.length; i++){
               GraphNode graNode = (GraphNode) objects[i];
               graNode.dispose();
              //graNode.setVisible(false);
       }
  }
  </code></pre>
  
  <p>This crashes my prorgam with an error</p>
  
  <blockquote>
    <p>Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed</p>
  </blockquote>
  
  <p>As a workaround I tried to set the Nodes and Connections to invisible, that workes, but the invisible objects seem to mess up my Zest Layout so if there is a way to actually dispose the Nodes and Connections I would preffer that way.</p>
  
  <p>Here is the Error Massage</p>
  
  <pre><code>Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed
  at org.eclipse.swt.SWT.error(Unknown Source)
  at org.eclipse.swt.SWT.error(Unknown Source)
  at org.eclipse.swt.SWT.error(Unknown Source)
  at org.eclipse.swt.widgets.Widget.error(Unknown Source)
  at org.eclipse.swt.widgets.Widget.checkWidget(Unknown Source)
  at org.eclipse.swt.widgets.Item.getText(Unknown Source)
  at com.mycom.timelineview.views.IndicatorFactorVisualisationView$2.mouseDoubleClick(IndicatorFactorVisualisationView.java:221)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
  at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
  at com.mycom.timelineview.views.IndicatorFactorVisualisationView.indicatorFactorWindow(IndicatorFactorVisualisationView.java:249)
  at com.mycom.timelineview.views.IndicatorFactorVisualisationView.&lt;init&gt;(IndicatorFactorVisualisationView.java:71)
  at com.mycom.timelineview.views.SpiderWebMouseListener.chartMouseClicked(SpiderWebMouseListener.java:102)
  at org.jfree.experimental.chart.swt.ChartComposite.mouseDown(ChartComposite.java:1621)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
  at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
  at com.mycom.timelineview.views.SpiderWebView.createPartControl1(SpiderWebView.java:622)
  at com.mycom.timelineview.views.InformationPlatformAppView2$7.handleEvent(InformationPlatformAppView2.java:628)
  at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
  at com.mycom.timelineview.views.InformationPlatformAppView2.main(InformationPlatformAppView2.java:1330)
  </code></pre>
  
  <p>EDIT: Thanks to Baz I found my mistake. The Mouse listener had to search for text in a graph node I disposed before so of course the programm had to crash. I changed my code to avoid it and now the method Baz proposed runs perfectly. </p>