Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Getting menu on right click of mouse
Getting menu on right click of mouse [message #173483] Thu, 24 March 2005 16:53 Go to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

hi!
i'm facing a situation wherein i have a view called SolutionExplorer in
my application and this view has categories which has my model objects.
somthing like this..
In SolutionExplorer view.
category1
|-A
|-B
|-C
category2
category3

here A,B,C are my model objects.
when i right click on any of these model objects ,i should get a drop down
menu which will have options.
My question is - How will i get a menu on right click of mouse?

im in desperate need for suggestion.
regards
ved
Re: Getting menu on right click of mouse [message #173499 is a reply to message #173483] Thu, 24 March 2005 15:54 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
I take it that this SolutionExplorer use GEF's TreeViewer. In that case,
you do this the same way that you did it for the viewer in your editor. See
LogicEditor.OutlinePage#configureOutlineViewer().

"Ved Gunjan" <gunjan_sir@yahoo.com> wrote in message
news:4adc98f63d54482424e6e46296667a52$1@www.eclipse.org...
> hi!
> i'm facing a situation wherein i have a view called SolutionExplorer in
> my application and this view has categories which has my model objects.
> somthing like this..
> In SolutionExplorer view.
> category1
> |-A
> |-B
> |-C
> category2
> category3
>
> here A,B,C are my model objects.
> when i right click on any of these model objects ,i should get a drop down
> menu which will have options.
> My question is - How will i get a menu on right click of mouse?
>
> im in desperate need for suggestion.
> regards
> ved
>
Re: Getting menu on right click of mouse [message #173595 is a reply to message #173499] Fri, 25 March 2005 09:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

Thanks for the reply..... but i'm kind of stuck.
This is my situation.
My SolutionExplorer 'IS-A' ViewPart and 'HAS-A' TreeViewer.
but i will have to make the SolutionExloprer 'IS-A' EditPartViewer also
so as to have the getViewer() getActionRegistry()setContextMenu(provider)
to use in the configureView() method.

below is the code from Logic example

protected void configureOutlineViewer(){
System.out.println("I am into the configureOutlineViewer method of the
inner OutlinePage class of LogicEdidtor class");
getViewer().setEditDomain(getEditDomain());
getViewer().setEditPartFactory(new TreePartFactory());
ContextMenuProvider provider = new LogicContextMenuProvider(getViewer(),
getActionRegistry());
getViewer().setContextMenu(provider);
getSite().registerContextMenu("org.eclipse.gef.examples.logic.outline.contextmenu ",
//$NON-NLS-1$
provider, getSite().getSelectionProvider());
getViewer().setKeyHandler(getCommonKeyHandler());
getViewer().addDropTargetListener(new
LogicTemplateTransferDropTargetListener(getViewer()));
IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
showOutlineAction = new Action() {
public void run() {
showPage(ID_OUTLINE);
System.out.println("I am into the run111 method of the OutlinePage of
Logic Editor");
}
};
showOutlineAction.setImageDescriptor(ImageDescriptor.createF romFile(
LogicPlugin.class,"icons/outline.gif")); //$NON-NLS-1$
tbm.add(showOutlineAction);
showOverviewAction = new Action() {
public void run() {
showPage(ID_OVERVIEW);
System.out.println("I am into the run222 method of the OutlinePage of
Logic Editor");
}
};
showOverviewAction.setImageDescriptor(ImageDescriptor.create FromFile(
LogicPlugin.class,"icons/overview.gif")); //$NON-NLS-1$
tbm.add(showOverviewAction);
showPage(ID_OUTLINE);
}

Now my doubt is how will i configure my SolutionExplorer so that it can
register actions.

Please clarify the doubt as i'm in a big fix.
Thanks
regards
Ved
Re: Getting menu on right click of mouse [message #173614 is a reply to message #173595] Fri, 25 March 2005 15:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

hi!
im using JFace TreeViewer to show up my SolutionExplorer view.
i want my SolutionExplorer to register action.
For which i need to viewer.setContextMenu(provider);
but the viewer is not a EditPartViewer, so i cant set the context.
please tell me how will i do viewer.setContextMenu(provider)
in case of TreeViewer.

thanking in advance for the suggestions.
regards
ved
Re: Getting menu on right click of mouse [message #173649 is a reply to message #173614] Fri, 25 March 2005 16:30 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Is there any particular reason you're using the JFace TreeViewer and not the
GEF TreeViewer?

With the JFace viewer, I think you can just invoke setMenu() on the control.
Since you're using the JFace TreeViewer, this is not GEF-related. For
further queries about this topic, try the platform newsgroup.

"Ved Gunjan" <gunjan_sir@yahoo.com> wrote in message
news:c8da6596f5365b9c64e407b3c258b9f2$1@www.eclipse.org...
>
> hi!
> im using JFace TreeViewer to show up my SolutionExplorer view.
> i want my SolutionExplorer to register action.
> For which i need to viewer.setContextMenu(provider);
> but the viewer is not a EditPartViewer, so i cant set the context.
> please tell me how will i do viewer.setContextMenu(provider)
> in case of TreeViewer.
>
> thanking in advance for the suggestions.
> regards
> ved
>
>
>
Re: Getting menu on right click of mouse [message #173738 is a reply to message #173649] Sat, 26 March 2005 12:56 Go to previous message
Eclipse UserFriend
Originally posted by: gunjan_sir.yahoo.com

hi!
No, there is no particulat reason for using JFace TreeViewer.
What are the steps needed to implement GEF TreeViewer.

regards
ved
Previous Topic:gef and draw2d docs
Next Topic:Stepd For Implementing GEF TreeViewer
Goto Forum:
  


Current Time: Wed Apr 24 14:41:45 GMT 2024

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

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

Back to the top