Eclipse RCP Question
"Raymond Hooker \(rhooker\)" <[email protected]>
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Message-ID | <848DB51F3E58E146B08D188F803DCB6F030C554A@xmb-rtp-20c.amer.cisco.com> |
Does anyone have experience with Eclipse RCP. I am working through the
eclipse RCP Platform book by McAffer and Lemieux. I am doing this in
parallel between the Eclipse 3.1 install provided by the book and my
normal Eclipse 3.2 environment. I am having trouble getting it to bring
up the view in my Eclipse 3.2 environment. Instead of a treeviewer I
just see a blank.
After carefully comparing the code, I decided just to try to trace the
execution. It turns out that class I defined for my view is never
instantiated in my Eclipse 3.2 environment but the constructor and the
createPartControl is executed prior to bringing up the application.
Note that plugin.xml has:
<extension
point="org.eclipse.ui.views">
<view
class="org.eclipsercp.hyperbola.ContactsView"
icon="icons/groups.gif"
id="org.eclipsercp.hyperbola.views.contacts"
name="Contacts"/>
</extension>
Also the class ContactsView does exist, but like I said breakpoints in
the contructor and on the first line of createPartControl are never hit.
public ContactsView() {
super();
}
/*
* The content provider class is responsible for
* providing objects to the view. It can wrap
* existing objects in adapters or simply return
* objects as-is. These objects may be sensitive
* to the current input of the view, or ignore
* it and always show the same content
* (like Task List, for example).
*/
class ViewContentProvider implements IStructuredContentProvider
{
public void inputChanged(Viewer v, Object oldInput,
Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object parent) {
return new String[] { "One", "Two", "Three" };
}
}
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
initializeSession(); // temporary tweak to build a fake
model
treeViewer = new TableViewer(parent, SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL);
getSite().setSelectionProvider(treeViewer);
treeViewer.setLabelProvider(new
WorkbenchLabelProvider());
treeViewer.setContentProvider(new
BaseWorkbenchContentProvider());
treeViewer.setInput(session.getRoot());
session.getRoot().addContactsListener(new
IContactsListener() {
public void contactsChanged(ContactsGroup
contacts, ContactsEntry entry){
treeViewer.refresh();
}
});
//treeViewer.setSorter(new NameSorter());
//makeActions();
//hookContextMenu();
//hookDoubleClickAction();
//contributeToActionBars();
}