Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [CNF] Enablement with resources
[CNF] Enablement with resources [message #335771] Tue, 28 April 2009 20:59 Go to next message
Jon Barrilleaux is currently offline Jon BarrilleauxFriend
Messages: 25
Registered: July 2009
Junior Member
I am trying to use CNF to allow navigation amongst resources (project,
folder, file) and within files (i.e. expand a file to see the contents
of the model in the file).

I created a navgigatorContent extension (NCE), which references my
content and label provider. It seems that the only way to get it to
work is specify activateByDefault as true, and then add an empty enable
or triggerPoint child element to the NCE.

If I specify activateByDefault as false, it will not work, even if I
specify what I think are correct conditions in enablement or
triggerPoint (e.g. instanceof element with type IResource).
Re: [CNF] Enablement with resources [message #335772 is a reply to message #335771] Tue, 28 April 2009 23:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ali.akar.geensys.com

Hi Jon,

Did you contribute your own viewer via the extension
point="org.eclipse.ui.navigator.viewer" ???
if yes, you can insclude as navigatorcontentbinding the
"org.eclipse.ui.navigator.resourceContent", then you don't have to care
about the navigation amongst resources (IProject, IFolder & IFile). your
navigatorcontent must be enabled on your files only to navigate within,
so for the trigger point you can use property testes (like file
extension or content type) and for the possible children you can use an
instanceof your root model object. see below :

<extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="false"
contentProvider="com.lgt.myContentProvider"
id="com.lgt.mynavigator"
labelProvider="com.lgt.myLabelProvider"
name="LGT Content"
priority="normal">
<triggerPoints>
<and>
<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>
<test
property="org.eclipse.core.resources.extension"
value="lgt">
</test>
</and>
</triggerPoints>
<possibleChildren>
<instanceof
value="org.lgt.emf.MyRootModelObject">
</instanceof>
</possibleChildren>

And don't forget to incluse your own content to the viewer.


Jon Barrilleaux a écrit :
> I am trying to use CNF to allow navigation amongst resources (project,
> folder, file) and within files (i.e. expand a file to see the contents
> of the model in the file).
>
> I created a navgigatorContent extension (NCE), which references my
> content and label provider. It seems that the only way to get it to
> work is specify activateByDefault as true, and then add an empty enable
> or triggerPoint child element to the NCE.
>
> If I specify activateByDefault as false, it will not work, even if I
> specify what I think are correct conditions in enablement or
> triggerPoint (e.g. instanceof element with type IResource).
Re: [CNF] Enablement with resources [message #335785 is a reply to message #335772] Wed, 29 April 2009 18:53 Go to previous messageGo to next message
Jon Barrilleaux is currently offline Jon BarrilleauxFriend
Messages: 25
Registered: July 2009
Junior Member
thanks for your help. I had tried what you recommended a while back but
gave up since I couldn't get it to work. I added it back again to
give it another try. Below are what I believe to be the critical
portions of my plugin.xml file. I must be missing some

Ali Akar wrote:
> Hi Jon,
>
> Did you contribute your own viewer via the extension
> point="org.eclipse.ui.navigator.viewer" ???

Here is the pertinent part of my org.eclipse.ui.navigator.viewer
extension...

<extension
point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding
viewerId="com.msli.mapp3d.client.WORKSPACE_VIEW">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resourceContent">
</contentExtension>
<contentExtension
pattern="com.msli.jme.GRAPHIC_MODEL">
</contentExtension>

> if yes, you can insclude as navigatorcontentbinding the
> "org.eclipse.ui.navigator.resourceContent", then you don't have to care
> about the navigation amongst resources (IProject, IFolder & IFile). your
> navigatorcontent must be enabled on your files only to navigate within,
> so for the trigger point you can use property testes (like file
> extension or content type) and for the possible children you can use an
> instanceof your root model object. see below :
>
> ...
>
> And don't forget to incluse your own content to the viewer.
>
Here is the pertinent part of my
org.eclipse.ui.navigator.navigatorContent extension. I kept it simple
by simply testing for an instance of IFile instead of also including an
extension test (I'll add that later once I get the basic stuff to work)...

<extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
activeByDefault="false"

contentProvider="com.msli.jme.rcp.provider.JmeModelContentProvider "
id="com.msli.jme.GRAPHIC_MODEL"
labelProvider="com.msli.jme.rcp.provider.JmeModelLabelProvider "
name="Graphic Model"
priority="normal">
<triggerPoints>
<instanceof
value="org.eclipse.core.resources.IFile">
</instanceof>
</triggerPoints>
<possibleChildren>
<or>
<instanceof
value="com.msli.jme.model.JmeModelNode">
</instanceof>
<instanceof
value="com.jme.scene.Node">
</instanceof>
</or>
</possibleChildren>
</navigatorContent>
Re: [CNF] Enablement with resources [message #335788 is a reply to message #335785] Wed, 29 April 2009 20:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ali.akar.geensys.com

Hello,
You didn't declare the viewer :)
I suggest u to take a look at the plugin.xml of the plugin
"org.eclipse.ui.navigator.resources" which declares the ProjectExplorer
view.

Did you contribute your own view part ???

see correction below.

Jon Barrilleaux a écrit :
> thanks for your help. I had tried what you recommended a while back but
> gave up since I couldn't get it to work. I added it back again to give
> it another try. Below are what I believe to be the critical portions of
> my plugin.xml file. I must be missing some
>
> Ali Akar wrote:
>> Hi Jon,
>>
>> Did you contribute your own viewer via the extension
>> point="org.eclipse.ui.navigator.viewer" ???
>
> Here is the pertinent part of my org.eclipse.ui.navigator.viewer
> extension...
>
> <extension
> point="org.eclipse.ui.navigator.viewer">
<viewer
viewerId="org.eclipse.ui.navigator.ProjectExplorer">
</viewer>
> <viewerContentBinding
> viewerId="com.msli.mapp3d.client.WORKSPACE_VIEW">
> <includes>
> <contentExtension
> pattern="org.eclipse.ui.navigator.resourceContent">
> </contentExtension>
> <contentExtension
> pattern="com.msli.jme.GRAPHIC_MODEL">
> </contentExtension>
>
>> if yes, you can insclude as navigatorcontentbinding the
>> "org.eclipse.ui.navigator.resourceContent", then you don't have to
>> care about the navigation amongst resources (IProject, IFolder &
>> IFile). your navigatorcontent must be enabled on your files only to
>> navigate within, so for the trigger point you can use property testes
>> (like file extension or content type) and for the possible children
>> you can use an instanceof your root model object. see below :
>>
>> ...
>>
>> And don't forget to incluse your own content to the viewer.
>>
> Here is the pertinent part of my
> org.eclipse.ui.navigator.navigatorContent extension. I kept it simple
> by simply testing for an instance of IFile instead of also including an
> extension test (I'll add that later once I get the basic stuff to work)...
>
> <extension
> point="org.eclipse.ui.navigator.navigatorContent">
> <navigatorContent
> activeByDefault="false"
>
> contentProvider="com.msli.jme.rcp.provider.JmeModelContentProvider "
> id="com.msli.jme.GRAPHIC_MODEL"
> labelProvider="com.msli.jme.rcp.provider.JmeModelLabelProvider "
> name="Graphic Model"
> priority="normal">
> <triggerPoints>
> <instanceof
> value="org.eclipse.core.resources.IFile">
> </instanceof>
> </triggerPoints>
> <possibleChildren>
> <or>
> <instanceof
> value="com.msli.jme.model.JmeModelNode">
> </instanceof>
> <instanceof
> value="com.jme.scene.Node">
> </instanceof>
> </or>
> </possibleChildren>
> </navigatorContent>
>
Re: [CNF] Enablement with resources [message #335812 is a reply to message #335788] Thu, 30 April 2009 19:51 Go to previous message
Jon Barrilleaux is currently offline Jon BarrilleauxFriend
Messages: 25
Registered: July 2009
Junior Member
Mystery solved (I think)....

It seems that if activateByDefault is false, the content extension is
essentially disabled, regardless of the enablement/triggerpoint
conditions. As such, activateByDefault must be set to true (or the user
must check it in the viewer's content selection dialog) otherwise the
content extension is ignored.

Is this consistent with other developer's experience?

--jon
Previous Topic:Key binding sequence in label
Next Topic:Can't get menu item with handler working properly
Goto Forum:
  


Current Time: Thu Dec 26 14:40:25 GMT 2024

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

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

Back to the top