Getting menu on right click of mouse [message #173483] |
Thu, 24 March 2005 16:53 |
Eclipse User |
|
|
|
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 #173595 is a reply to message #173499] |
Fri, 25 March 2005 09:33 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03362 seconds