strange getAdapter() error for Properties View [message #273034] |
Thu, 30 September 2004 07:29 |
Eclipse User |
|
|
|
Originally posted by: ola.dhcp059.lcb.uu.se
Following the article
http://www.eclipse.org/articles/Article-Properties-View/prop erties-view.html
I have run into a serious problem.
Using Eclipse 3,0 I tried to create a perspective and placed two
views, my custom view and the properties view
(layout.addView(IPageLayout.ID_PROP_SHEET) in this.
I have a treeViewer in my custom view registered with
getSite().setSelectionProvider(viewer). All is well so far.
The problem is that the properties view is blank when selecting a node.
My nodes implement IAdaptable and IPropertySource (which I believe they
have to?) and getAdapter looks like this:
Public Object getAdapter(Class adapter) {
if (adapter == IPropertySource.class) {
return this;
}
return null;
}
On debugging I notice that the getAdapter method gets called with the
IPropertySource.class parameter, but the line adapter ==
IPropertySource.class returns false!
The following line in PropertySheetEntry calling the getAdapter says:
else if (object instanceof IAdaptable)
result =
(IPropertySource)((IAdaptable)object).getAdapter(IPropertySo urce.class);
which implies that it calls my getAdapter with IPropertySource.class
parameter. I don't understand why adapter ==
IPropertySource.class returns false!!! I even get a classCastException if
I just do 'return this' in my getAdapter, confirming the unequality.
What could be wrong?
I even tested to put the entire SampleView from the Properties Tutorial in
the project, with no success. Same thing happens, the getAdapter method
gets called with something that looks just like an IPropertySource.class,
but isn't (and cannot be casted).
If anyone could assist in this I would be very thankful, using properties
view is essential and I really have to get this thing to work.
Best regards,
Ola Spjuth
The Linnaeus Centre for Bioinformatics
www.lcb.uu.se
|
|
|
Powered by
FUDForum. Page generated in 0.03271 seconds