Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333748 - Tree with TreeEditors flickers badly on Expand/collapse
Summary: Tree with TreeEditors flickers badly on Expand/collapse
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-07 09:27 EST by Lakshmi P Shanmugam CLA
Modified: 2020-01-30 16:49 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lakshmi P Shanmugam CLA 2011-01-07 09:27:44 EST
In a Tree with TreeEditors expanding or collapsing a TreeItem causes all the editors in the tree to be redrawn. This causes lot of flickering. 
We should (atleast) prevent the editors above the expanding/collapsing item from being affected.

Snippet to show the problem:-
public class TreeEditorFlicker {
public static void main(String[] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	shell.setLayout (new FillLayout ());
	Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI|SWT.V_SCROLL|SWT.FULL_SELECTION);
	tree.setLinesVisible (true);
	for (int i=0; i<3; i++) {
		TreeColumn column = new TreeColumn(tree, SWT.NONE);
		column.setWidth (100);
	}
	for (int i=0; i<10; i++) {
		TreeItem item = new TreeItem (tree, SWT.NONE);
		for (int j = 0; j < 5; j++) {
			new TreeItem (item, SWT.NONE);
		}
	}
	TreeItem [] items = tree.getItems ();
	for (int i=0; i<items.length; i++) {
		createEditors(tree, items[i], i);
		TreeItem [] children = items[i].getItems();
		for (int j = 0; j < children.length; j++) {
			createEditors(tree, children[j], i+j);
		}
		
	}
	tree.pack();
	shell.pack ();
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}

static void createEditors(Tree tree, TreeItem child, int i) {
	TreeEditor editor = new TreeEditor (tree);
	Text text = new Text (tree, SWT.NONE);
	text.setText("Text" + i);
	editor.grabHorizontal = true;
	editor.setEditor(text, child, 0);
	editor = new TreeEditor (tree);
	Combo combo = new Combo (tree, SWT.NONE);
	combo.setText("Combo" + i);
	combo.add("item 1");
	combo.add("item 2");
	editor.grabHorizontal = true;
	editor.setEditor(combo, child, 1);
	editor = new TreeEditor (tree);
	Button button = new Button(tree, SWT.CHECK);
	editor.grabHorizontal = true;
	editor.setEditor(button, child, 2);
	editor = new TreeEditor (tree);
}
}
Comment 1 Fabian Zeindl CLA 2012-06-16 09:35:52 EDT
I have the exact same problem, is there a workaround?
Comment 2 Eclipse Genie CLA 2020-01-30 16:49:43 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.