Bug 381823 - Unable to select the cell(column) in TreeViewer
Summary: Unable to select the cell(column) in TreeViewer
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: ui
Depends on:
Blocks:
 
Reported: 2012-06-06 04:11 EDT by zhou jian CLA
Modified: 2019-11-27 07:15 EST (History)
1 user (show)

See Also:


Attachments
the screen of the bug. (60.16 KB, image/jpeg)
2012-06-06 04:16 EDT, zhou jian CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.