Bug 381823

Summary: Unable to select the cell(column) in TreeViewer
Product: [Eclipse Project] Platform Reporter: zhou jian <zhoujianboy>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: lshanmug
Version: 3.7.1Keywords: ui
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug
Attachments:
Description Flags
the screen of the bug. none

Description zhou jian CLA 2012-06-06 04:11:23 EDT
Build Identifier: M20110909-1335

Let me write some code to describe the bug.

String[] column = new String[] { "name", "condition" };
Tree tree = new Tree(composite, SWT.BORDER | SWT.MULTI);
TreeViewer treeViewer = new TreeViewer(tree);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
treeViewer.setColumnProperties(column);
CellEditor[] cellEditors = new CellEditor[2];
cellEditors[0] = new TextCellEditor(treeViewer
        .getTree());
cellEditors[1] = new TextCellEditor(treeViewer
        .getTree());
treeViewer.setCellEditors(cellEditors);
treeViewer.setInput(....);

1. the tree is not SWT.FULL_SELECTION; 
2. set two column to the treeViewer;
3. put some data into the tree.
I can not select/modify the data of the second column(condition), unless I select the first column first.

I think the method "getItemAt" in TreeViewer was wrong. "tree.getSelection();" should be "tree.getItems()". 

	protected Item getItemAt(Point p) {
		TreeItem[] selection = tree.getSelection();

		if( selection.length == 1 ) {
			int columnCount = tree.getColumnCount();

			for( int i = 0; i < columnCount; i++ ) {
				if( selection[0].getBounds(i).contains(p) ) {
					return selection[0];
				}
			}
		}

		return getTree().getItem(p);
	}

Would like to receive your reply!

Reproducible: Always
Comment 1 zhou jian CLA 2012-06-06 04:16:43 EDT
Created attachment 216908 [details]
the screen of the bug.

the screen of the bug.
Comment 2 Lars Vogel CLA 2019-11-27 07:15:26 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.

If you have further information on the current state of the bug, please add it.
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.

If the bug is still relevant, please remove the stalebug whiteboard tag.