Decorator problem [message #93519] |
Mon, 14 July 2003 18:34  |
Eclipse User |
|
|
|
Originally posted by: lfu.site.uottawa.ca
Hi,
I am new to eclipse and have been struglling with a decorator problem.
I have a tree displaying some simple TreeObject(name,full name,etc), but
When I use objectClass in enablement to decorate with tree node(TreeObject),
like <enablement>
<objectClass="org.kbre.treeviewer.views.TreeObject"/><enablement >. No
decoration effected, while if I can to
<objectClass="org.eclipse.core.resources.IFile">, decoration in other views
work fine.
Does decoration only work to IResource type, not user defined ones?
Thanks
Eric Fu
|
|
|
Re: Decorator problem [message #94949 is a reply to message #93519] |
Wed, 16 July 2003 10:45   |
Eclipse User |
|
|
|
I believe that is correct, and that you need to have your daa-object implement
IAdaptable, like this:
public Object getAdapter (final Class adapter) {
return (adapter == IResource.class)
? getTheFileFor(this.getDataObject()) // it may be hat
getDataObject() returns "this"
: null;
}
HTH,
Paul K
Eric Fu wrote:
> Hi,
>
> I am new to eclipse and have been struglling with a decorator problem.
>
> I have a tree displaying some simple TreeObject(name,full name,etc), but
> When I use objectClass in enablement to decorate with tree node(TreeObject),
> like <enablement>
> <objectClass="org.kbre.treeviewer.views.TreeObject"/><enablement >. No
> decoration effected, while if I can to
> <objectClass="org.eclipse.core.resources.IFile">, decoration in other views
> work fine.
>
> Does decoration only work to IResource type, not user defined ones?
>
> Thanks
>
> Eric Fu
|
|
|
Re: Decorator problem [message #144845 is a reply to message #94949] |
Thu, 16 October 2003 07:57  |
Eclipse User |
|
|
|
Originally posted by: rich.boakes.com
Hi,
In his original post Eric described the exact problem that's stumping me
today.
I too have a TreeViewer which contains instances of a INode class (which
extends IAdaptable).
My (lightweight) decorator class works perfectly in other views when I
enable it for IResource objects, yet it does nothing for these INodes in
my tree view.
Paul's solution below looked promising, so I put trace in the
INode.getAdapter method to see if I could work out what I needed to do
to use it. This showed that it's only getting called when I popup a
context menu on the INodes, so I'm wondering what exactly I'm supposed
to be listening for / returning.
It seems to me that there must be some fundamental step that I'm
missing, perhaps some connection to a listener, or an initialization step?
I think I've been through every article, relevant newsgroup posting and
the javadoc and come up blank.
Has *anyone* managed to get an ILightweightLabelDecorator to work with
anything other than an IResource?
cheers,
Rich
Paul T. Keyser wrote:
> I believe that is correct, and that you need to have your daa-object implement
> IAdaptable, like this:
>
> public Object getAdapter (final Class adapter) {
> return (adapter == IResource.class)
> ? getTheFileFor(this.getDataObject()) // it may be hat
> getDataObject() returns "this"
> : null;
> }
>
> HTH,
> Paul K
>
> Eric Fu wrote:
>
>
>>Hi,
>>
>>I am new to eclipse and have been struglling with a decorator problem.
>>
>>I have a tree displaying some simple TreeObject(name,full name,etc), but
>>When I use objectClass in enablement to decorate with tree node(TreeObject),
>>like <enablement>
>><objectClass="org.kbre.treeviewer.views.TreeObject"/><enablement >. No
>>decoration effected, while if I can to
>><objectClass="org.eclipse.core.resources.IFile">, decoration in other views
>>work fine.
>>
>>Does decoration only work to IResource type, not user defined ones?
>>
>>Thanks
>>
>>Eric Fu
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03515 seconds