Bug 38027 - [Viewers] TableTreeViewer should use ITreeContentProvider.getChildren when accessing the raw children
Summary: [Viewers] TableTreeViewer should use ITreeContentProvider.getChildren when ac...
Status: RESOLVED DUPLICATE of bug 9262
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P4 minor (vote)
Target Milestone: ---   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-23 06:14 EDT by Chris Wege CLA
Modified: 2004-09-16 15:33 EDT (History)
1 user (show)

See Also:


Attachments
Demonstrate drill down problem when returning the root element in ITreeContentProvider>>getElements() (37.94 KB, application/octet-stream)
2003-05-27 06:19 EDT, Chris Wege CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Wege CLA 2003-05-23 06:14:09 EDT
Build 200303272130

The table tree viewer uses ITreeContentProvider.getElement() to access the raw
children. Tree Viewer uses ITreeContentProvider.getChildren(). Shouldn't use
table tree getChildren as well
Comment 1 Nick Edgar CLA 2003-05-26 14:17:16 EDT
For both TreeViewer and TableTreeViewer, it uses getElements for the top-level 
elements, and getChildren for child elements (and children of child elements, 
etc.).  See AbstractTreeViewer.getRawChildren.
Comment 2 Dirk Baeumer CLA 2003-05-26 14:39:54 EDT
Chris,

Nick is right. Do you still have the code we looked at at code camp. I am 
wondering what the problem is since I am pretty sure that we ended up in the 
getRawChildren() method of the structured viewer for the table tree viewer 
instance.
Comment 3 Chris Wege CLA 2003-05-27 06:19:38 EDT
Created attachment 4971 [details]
Demonstrate drill down problem when returning the root element in ITreeContentProvider>>getElements()

In the target workspace show view Metrics>>Metrics Table View and click on any
IJavaElement in the Package Explorer. This should show some values in the view.
I want the selected element to be presented in the view:
public Object[] getElements(Object inputElement) {
//	return getChildren(inputElement);
	return new Object[] {inputElement};
}
Now when you drill down in the hierarchy you always get the root element.
Comment 4 Chris Wege CLA 2003-05-27 06:20:37 EDT
In TableTreeViewer>>getRawChildren you find

if (equals(parent, getRoot()))
	return super.getRawChildren(parent);

It gets the children in StructuredViewer>>getRawChildren with 

	result = cp.getElements(parent);

I must admit that at a second glace it works exactly like in the TreeViewer. So
if it is not a bug I would say it is a design flaw that you don't allow the user
the have the root element presented.

To explain what I want I attached the code from the camp.
Comment 5 Nick Edgar CLA 2003-05-27 09:47:49 EDT
In general, viewers do not handle multiple equal elements well.  For example, 
the internal map from model element to SWT item is a simple map, from one model 
element to one item.  This is another case.  It would be better not to case on 
the root element.  

Reopening the PR so that this can be addressed in the future.  Reducing 
severity and priority though.
Comment 6 Michal Tkacz CLA 2004-09-01 08:03:49 EDT
Isn't that now a duplicate of bug 9262? (both are quite old :(
Comment 7 Nick Edgar CLA 2004-09-01 09:08:12 EDT
Yes, thanks.

*** This bug has been marked as a duplicate of 9262 ***