[Zest] Removing Node and Connections [message #247005] |
Thu, 22 January 2009 16:29 |
Eclipse User |
|
|
|
Originally posted by: simone.simonesaraceni.it
I try to remove items from the Graph on Zest, i use this tip:
Object[] objects = g.getConnections().toArray() ;
for ( int x = 0 ; x < objects.length ; x++ ) {
((GraphConnection) objects[x]).dispose() ;
}
// remove all the nodes
objects = g.getNodes().toArray() ;
for ( int x = 0 ; x < objects.length ; x++ ) {
((GraphNode) objects[x]).dispose();
}
g.applyLayout();
But when I click on the graph, I receive the Exception:
org.eclipse.swt.SWTException: Widget is disposed.
Where I wrong?
|
|
|
Re: [Zest] Removing Node and Connections [message #247274 is a reply to message #247005] |
Fri, 13 February 2009 16:44 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
What version did you try this with? With had a problem with improper
disposing of connections, but I fixed this recently. Can you try with M5?
cheers,
ian
Simone wrote:
> I try to remove items from the Graph on Zest, i use this tip:
>
> Object[] objects = g.getConnections().toArray() ;
> for ( int x = 0 ; x < objects.length ; x++ ) {
> ((GraphConnection) objects[x]).dispose() ;
> }
> // remove all the nodes
> objects = g.getNodes().toArray() ;
> for ( int x = 0 ; x < objects.length ; x++ ) {
> ((GraphNode) objects[x]).dispose();
> }
> g.applyLayout();
>
> But when I click on the graph, I receive the Exception:
> org.eclipse.swt.SWTException: Widget is disposed.
> Where I wrong?
|
|
|
Re: [Zest] Removing Node and Connections [message #247302 is a reply to message #247274] |
Fri, 13 February 2009 17:42 |
Eclipse User |
|
|
|
Originally posted by: simone.simonesaraceni.it
Thanks for reply, I'm using v. 3.4.1. But I've solved the problem with
the code:
/**
* This method removes all items (GraphNodes and GraphConnections) from
the graph
*/
public void clearGraph(){
List nodes= this.getNodes();
int s=nodes.size();
for (int i = s-1; i >= 0; i--) {
((GraphNode ) nodes.get(i)).dispose();
}
}
So, for the moment I think i continue tu use current version.
Regards,
Simone.
Ian Bull ha scritto:
> What version did you try this with? With had a problem with improper
> disposing of connections, but I fixed this recently. Can you try with M5?
>
> cheers,
> ian
> Simone wrote:
>> I try to remove items from the Graph on Zest, i use this tip:
>>
>> Object[] objects = g.getConnections().toArray() ; for (
>> int x = 0 ; x < objects.length ; x++ ) {
>> ((GraphConnection) objects[x]).dispose() ;
>> }
>> // remove all the nodes objects = g.getNodes().toArray() ;
>> for ( int x = 0 ; x < objects.length ; x++ ) {
>> ((GraphNode) objects[x]).dispose();
>> }
>> g.applyLayout();
>>
>> But when I click on the graph, I receive the Exception:
>> org.eclipse.swt.SWTException: Widget is disposed.
>> Where I wrong?
|
|
|
|
Powered by
FUDForum. Page generated in 0.03236 seconds