Java Code Examples for org.eclipse.swt.widgets.Tree.addDisposeListener()

The following are Jave code examples for showing how to use addDisposeListener() of the org.eclipse.swt.widgets.Tree class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: JFaceUtils   File: EnhancedPreferenceDialog.java   Source Code and License Vote up 6 votes
@Override
protected void constrainShellSize() {
	super.constrainShellSize();
	if (Util.isCocoa()) {
		final Tree tree = getTreeViewer().getTree();
		final FontDescriptor treeFontDescriptor = FontDescriptor.createFrom(JFaceResources.getBannerFont()).setStyle(SWT.NORMAL);
		final Font treeFont = treeFontDescriptor.createFont(tree.getDisplay());
		updateTreeFont(treeFont);
		tree.addDisposeListener(new DisposeListener() {
			@Override
			public void widgetDisposed(DisposeEvent e) {
				treeFontDescriptor.destroyFont(treeFont);
			}
		});
	}
}