Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » The examples issue.
The examples issue. [message #246364] Wed, 26 November 2008 09:39 Go to next message
Dazhen Gao is currently offline Dazhen GaoFriend
Messages: 21
Registered: July 2009
Junior Member
I run the example
public class GraphSnippet1 {
/**
* @param args
*/
public static void main(String[] args) {
// Create the shell
Display d = new Display();
Shell shell = new Shell(d);
shell.setText("GraphSnippet1");
shell.setLayout(new FillLayout());
shell.setSize(400, 400);

Graph g = new Graph(shell, SWT.NONE);
GraphNode n = new GraphNode(g, SWT.NONE, "Paper");
GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock");
GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors");
new GraphConnection(g, SWT.NONE, n, n2);
new GraphConnection(g, SWT.NONE, n2, n3);
new GraphConnection(g, SWT.NONE, n3, n);
g.setLayoutAlgorithm(new
SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);

shell.open();
while (!shell.isDisposed()) {
while (!d.readAndDispatch()) {
d.sleep();
}
}
}
}



I find the dispose method of the Graph class do't call anyway, It make the
handle leak.
Re: The examples issue. [message #246380 is a reply to message #246364] Thu, 27 November 2008 08:13 Go to previous message
Tully Yates is currently offline Tully YatesFriend
Messages: 7
Registered: July 2009
Junior Member
gao wrote:

> I find the dispose method of the Graph class do't call anyway, It make the
> handle leak.

You'll need to call the #dispose() method yourself.
Add this at the very end of the file.

> shell.open();
> while (!shell.isDisposed()) {
> while (!d.readAndDispatch()) {
> d.sleep();
> }
> }
> }
// Destroy any SWT resources that you create here
g.dispose();
> }
Previous Topic:Routing Style ..
Next Topic:Unable to instantiate class?
Goto Forum:
  


Current Time: Tue Apr 16 19:49:58 GMT 2024

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

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

Back to the top