Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Custom Label Provider not firing for org.eclipse.core.resources.IFile
Custom Label Provider not firing for org.eclipse.core.resources.IFile [message #534758] Thu, 20 May 2010 09:11 Go to next message
Geejay is currently offline GeejayFriend
Messages: 160
Registered: February 2010
Senior Member
Hi all

I am trying to setup a custom label provider for my RCP app.

I am trying to provide custom icons (and maybe later labels) for the
resources in my workspace.

Here is the relevant section of plugin.xml (that works for folders), that
doesn't seem to work for the files contained in the Folder/Project.

<navigatorContent
activeByDefault="true"
contentProvider="ui.main.customnavigator.CustomContentProvider "
id="ui.main.customcontent"
labelProvider="ui.main.customnavigator.CustomLabelProvider"
name="customlabel"
providesSaveables="true">
<triggerPoints>
<instanceof
value="org.eclipse.core.resources.IProject">
</instanceof>
</triggerPoints>


I have tried adding

<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>

in an <or> inside the trigger points, but still no joy in firing the custom
label provider for files.

Is org.eclipse.core.resources.IFile the correct type for the navigator?

Should I be using some other style of operator within the <triggerpoints>
element?

Any help much appreciated
Re: Custom Label Provider not firing for org.eclipse.core.resources.IFile [message #534863 is a reply to message #534758] Thu, 20 May 2010 13:57 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

What kind of project? normal project, or java project and you'd like to
work on .java files?

Depending on the content, sometimes you need to adapt to IFile or
IResource or IProject, not do an instanceof check.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Custom Label Provider not firing for org.eclipse.core.resources.IFile [message #534933 is a reply to message #534863] Thu, 20 May 2010 16:00 Go to previous messageGo to next message
Geejay is currently offline GeejayFriend
Messages: 160
Registered: February 2010
Senior Member
They are normal projects. The files are app specifc (I define them).

I'll give it a shot adapting them to IFile. Thanks again Paul.

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:ht3f04$3pa$3@build.eclipse.org...
> What kind of project? normal project, or java project and you'd like to
> work on .java files?
>
> Depending on the content, sometimes you need to adapt to IFile or
> IResource or IProject, not do an instanceof check.
>
> PW
>
>
> --
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://wiki.eclipse.org/Menus_Extension_Mapping
> http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Re: Custom Label Provider not firing for org.eclipse.core.resources.IFile [message #535038 is a reply to message #534863] Fri, 21 May 2010 07:13 Go to previous messageGo to next message
Geejay is currently offline GeejayFriend
Messages: 160
Registered: February 2010
Senior Member
I'm sort of lost on how to adapt the File(s).

I am pretty sure the children of the projects are returned as
java.io.File(s), how do I adapt these to IFile(s)?

I should not I haven't actually implemented a proper custom content
provider, all my methods return null. Do I need to implement this in order
to be able to work with these extensions?

Thanks

Greg

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:ht3f04$3pa$3@build.eclipse.org...
> What kind of project? normal project, or java project and you'd like to
> work on .java files?
>
> Depending on the content, sometimes you need to adapt to IFile or
> IResource or IProject, not do an instanceof check.
>
> PW
>
>
> --
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://wiki.eclipse.org/Menus_Extension_Mapping
> http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Re: Custom Label Provider not firing for org.eclipse.core.resources.IFile [message #535153 is a reply to message #535038] Fri, 21 May 2010 12:35 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

geejay wrote:
> I'm sort of lost on how to adapt the File(s).
>
> I am pretty sure the children of the projects are returned as
> java.io.File(s), how do I adapt these to IFile(s)?

If they're java.io.Files, then you are not in a workspace and what you
want won't work. Are they Files (don't guess, debug and check :-)

> I should not I haven't actually implemented a proper custom content
> provider, all my methods return null. Do I need to implement this in
> order to be able to work with these extensions?

I would guess yes, otherwise your custom content is null, isn't it?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Infinity job to refresh UI leads to memory leak
Next Topic:How to do internationalization for the strings in plugin.xml?
Goto Forum:
  


Current Time: Fri Dec 19 03:29:01 GMT 2014

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

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