Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Need Help understanding TreeViewer
Need Help understanding TreeViewer [message #460644] Tue, 26 December 2006 05:39
Eclipse UserFriend
Originally posted by: jelgolfnut.gmail.com

I'm trying to implement a tree view modelled after the method described in
chapter 10 of the rcp book. Using a generic content and label provider
and declaring the adapters in the plugin.xml here is the xml snippett
<factory
adaptableType="com.work.journal.main.CourseList"
class="com.work.journal.views.AdapterFactory">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>
<factory
adaptableType="com.work.journal.main.Course"
class="com.work.journal.views.AdapterFactory">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>
<factory
adaptableType="com.work.journal.main.CourseGroup"
class="com.work.journal.views.AdapterFactory">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
</factory>

I can see the course grouping in the view with little plus sign
(indicating some children, but when I click on the (+) there is nothing.
Here is the code in the createViewPart method that sets up the tree view
viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
getSite().setSelectionProvider(viewer);
viewer.setLabelProvider(new GenericLabelProvider());
viewer.setContentProvider(new GenericContentProvider());
viewer.setSorter(new NameSorter());
CourseList cl = new CourseList();
viewer.setInput(cl);
The courslist object contains a list of courseGroup objects and each
courseGroup object contains a list of the courses for that group.

From numerous debug stmts I determined that the getChildren call for the
adapter on the course group was getting called and returning a non-null
list of courses. But the course enter adapter is never invoked.

Any suggestions on where to look for the problem? The CourseList,
CourseGroup and Course classes do know anything about IAdaptable and from
what I understand, they shouldn't need to know anything.

Are there any special naming conventions used? When the getChildren
returns the array, what gets called next? Does there need to be some
relationship within the implementation objects (ie does course need to
extend coursegroup or courselist? ) In fact, the getAdapter method in the
adapter factory never produces a course entry adapter.

Any suggestions are greatly appreciated.
Previous Topic:Error has occurred when activating this view
Next Topic:CommonNavigator and Eclipse 3.3M4
Goto Forum:
  


Current Time: Thu Apr 18 23:58:21 GMT 2024

Powered by FUDForum. Page generated in 0.01744 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top