[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Getting menu on right click of mouse

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.createFromFile(
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.createFromFile(
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