Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Common Navigator Framework linking with editor and adding popup menu
Common Navigator Framework linking with editor and adding popup menu [message #543761] Wed, 30 June 2010 13:12 Go to next message
Julien is currently offline JulienFriend
Messages: 15
Registered: July 2009
Junior Member
Hi all,

I have two issues about the Common Navigator Framework (CNF) of RCP.
I have to implement the CNF on my project without the Common Navigator
Explorer. In other words, I have to implement the CNF only with a
CommonViewer Object on my "ViewPart" explorer view.
In this situation, I try to implement the linkHelper without any success...
In the same way, I try to implement some popup menu without any success
too...

============================================================ ================================
ABOUT LINK HELPER
Here my code (id of my commonViewer:
"prototype.view.explorerView.navigator" ):
<extension point="org.eclipse.ui.navigator.viewer">
<viewerContentBinding viewerId="prototype.view.explorerView.navigator">
<includes>
<contentExtension
isRoot="true"
pattern="prototype.navigatorContent.MyContent">
</contentExtension>
<contentExtension
isRoot="true"
pattern="prototype.view.explorerView.LinkHelper">
</contentExtension>
</includes>
</viewerContentBinding>
</extension>

<extension point="org.eclipse.ui.navigator.linkHelper">
<linkHelper
class="prototype.helpers.MyLinkHelper"
id="prototype.view.explorerView.LinkHelper">
<editorInputEnablement>
<instanceof value="org.eclipse.ui.IFileEditorInput"></instanceof>
</editorInputEnablement>
<selectionEnablement>
<instanceof value="org.eclipse.core.resources.IFile"></instanceof>
</selectionEnablement>
</linkHelper>
</extension>

---

//Viewer creation:
viewer = new CommonViewer("prototype.view.explorerView.navigator",
composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
viewer.setInput(...)

---

//Opening of editor:
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
IFile fileToOpen = (IFile)
Platform.getAdapterManager().getAdapter(myObject, IFile.class);
try {
IDE.openEditor(page, fileToOpen);
} catch (PartInitException e) {
e.printStackTrace();
}

===

Nothing happens about the link between editors and explorer, program
never use the class prototype.helpers.MyLinkHelper.
I think I must force the enablement of linkHelper on my explorer (as the
function "setLinkingEnabled" on CommonNavigator) directly on the
CommonViewer but I don't know how I can do this and if it's possible...


============================================================ ================================
ABOUT POPUP MENUS
Here my code (id of my commonViewer:
"prototype.view.explorerView.navigator"; id of my explorer:
"prototype.view.explorerView" ):
<extension point="org.eclipse.ui.navigator.viewer">
<viewer viewerId="prototype.view.explorerView.navigator">
<popupMenu id="prototype.view.explorerView.navigator.popup">
<insertionPoint
name="group.new"
separator="false">
</insertionPoint>
<insertionPoint
name="group.open"
separator="false">
</insertionPoint>
<insertionPoint
name="group.edit"
separator="true">
</insertionPoint>
</popupMenu>
</viewer>
</extension>

<extension point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:prototype.view.explorerView?after=group.edit ">
<command
commandId="org.eclipse.ui.edit.delete"
id="cnf.popupmenu.delete"
label="Delete"
mnemonic="D"
style="push">
</command>
<command
commandId="org.eclipse.ui.edit.rename"
id="cnf.popupmenu.rename"
label="Rename"
mnemonic="R"
style="push">
</command>
</menuContribution>
</extension>

Have you some ideas ?

Thanks for the help.
Best regards,

Julien
Re: Common Navigator Framework linking with editor and adding popup menu [message #543813 is a reply to message #543761] Wed, 30 June 2010 16:15 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Have a look at the documentation in the Eclipse help under the platform plugin developer's guide.

One thing I see that's wrong is that you are creating a CommonViewer object. This will be created automatically by the CommonNavigator.

You need a couple of other things as well:

1) The org.eclipse.ui.views extension point for the view:


<extension
point="org.eclipse.ui.views">
<view
category="org.eclipse.ui"
class="org.eclipse.ui.navigator.resources.ProjectExplorer"
icon="$nl$/icons/full/eview16/resource_persp.gif"
id="org.eclipse.ui.navigator.ProjectExplorer"
name="%Common_Resource_Navigator"/>
</extension>


2) The navigator content extensions to define the content for the CN.

I would look at the org.eclipse.ui.navigator.resources plugin.xml to see an example of how the CN is used.

Francis


Re: Common Navigator Framework linking with editor and adding popup menu [message #543948 is a reply to message #543813] Thu, 01 July 2010 07:36 Go to previous messageGo to next message
Julien is currently offline JulienFriend
Messages: 15
Registered: July 2009
Junior Member
First, thanks for your answer.
Ok I see, so if I want to have my own view based on CNF, I need to
extend the CommonNavigator to meet with my requirements instead of
defining my own view with a CommonViewer Object.
So commonViewer just allow to display content but linking with editor
for example don't work.
I have not seen this restriction in the user guide or in tutorials
http://wiki.eclipse.org/Common_Navigator_Framework

Can you please confirm my understanding of this issue?
Thanks again,

Julien


Le 30/06/2010 18:15, Francis Upton a écrit :
> Have a look at the documentation in the Eclipse help under the platform
> plugin developer's guide.
>
> One thing I see that's wrong is that you are creating a CommonViewer
> object. This will be created automatically by the CommonNavigator.
>
> You need a couple of other things as well:
>
> 1) The org.eclipse.ui.views extension point for the view:
>
>
> <extension
> point="org.eclipse.ui.views">
> <view
> category="org.eclipse.ui"
> class="org.eclipse.ui.navigator.resources.ProjectExplorer"
> icon="$nl$/icons/full/eview16/resource_persp.gif"
> id="org.eclipse.ui.navigator.ProjectExplorer"
> name="%Common_Resource_Navigator"/>
> </extension>
>
> 2) The navigator content extensions to define the content for the CN.
>
> I would look at the org.eclipse.ui.navigator.resources plugin.xml to see
> an example of how the CN is used.
>
> Francis
Re: Common Navigator Framework linking with editor and adding popup menu [message #543991 is a reply to message #543948] Thu, 01 July 2010 09:50 Go to previous messageGo to next message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member
Hello,

To enable the "link with editor" feature you need to provide a "org.eclipse.ui.navigator.linkHelper" extension allowing you to define a ILinkHelper class which could translate a selection into a IEditorInput and the input back to a selection.

Don't forget to add the editor input enablement (expression checked when a editor is activated), and the selection enablement checked when selection changes).

Regards,
Christophe.
http://www.nextep-softwares.com
Re: Common Navigator Framework linking with editor and adding popup menu [message #544055 is a reply to message #543948] Thu, 01 July 2010 13:30 Go to previous message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Julien wrote on Thu, 01 July 2010 00:36


Can you please confirm my understanding of this issue?



Confirmed


Previous Topic:How to use eclipse rcp fragments to update a plugin
Next Topic:How can i Create?!
Goto Forum:
  


Current Time: Fri Dec 03 08:27:30 GMT 2021

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

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

Back to the top