Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] Removing Node and Connections
[Zest] Removing Node and Connections [message #247005] Thu, 22 January 2009 16:29 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: [Zest] Removing Node and Connections [message #247656 is a reply to message #247274] Sun, 08 March 2009 00:08 Go to previous message
Piotr is currently offline PiotrFriend
Messages: 2
Registered: July 2009
Junior Member
Hi

The exception is thrown when removing selected nodes. Scenario is
following:
1. select node
2. remove all nodes
3. add new nodes
4. when selecting node exception is thrown.

Workaround is to unselect nodes before disposing.
I use M5 (org.eclipse.zest.core_1.0.100.v20090205-1237.jar).

Regards
Piotr


Ian Bull wrote:

> 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?
Previous Topic:Print diagram without editor
Next Topic:PrintGraphicalViewerOperation question
Goto Forum:
  


Current Time: Fri Apr 19 19:34:45 GMT 2024

Powered by FUDForum. Page generated in 0.03241 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top