| Command Framework in custom editor [message #334648] | 
Mon, 23 February 2009 04:26   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, 
 
I have build a custom editor (based on a TreeViewer) with a context menu  
that is currently generated programatically. After converting some other  
part of my code to use the command framework, I'd like to use the  
command framework in my editor as well. However I was unable to find any  
information, as to how I might declaratively specify the commands.  
Documentation on ECF appears to be a bit thin anyway (one wiki page that  
I know of). Where can I look for further reading about context menus in  
custom editors? 
 
As an added complication: there is one submenu that has to be created  
programmatically at runtime (using model data). Can this be achieved  
when using ECF? 
 
Regards 
Damian Philipp
 |  
 |  
  | 
 | 
| Re: Command Framework in custom editor [message #334672 is a reply to message #334660] | 
Tue, 24 February 2009 05:12   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, 
 
thank you for your reply. 
 
Paul Webster schrieb: 
> There are a couple of wiki's mentioned in my sig, 
 
I have seen those sites already. They were very helpful in integrating  
commands in other popup menus (namely that of the Project Explorer). 
 
But they don't say anything about how to get popup menus working on  
custom parts. 
 
> plus examples in the  
> org.eclipse.ui.examples.contributions plugin (available in cvs  
> :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse ) 
 
This on the other hand was very helpful. For future reference, the  
following code enabled PCF popup menus on the viewer in my editor: 
 
     MenuManager contextMenu = new MenuManager(); 
     contextMenu.setRemoveAllWhenShown(true); 
 
     getSite().registerContextMenu(contextMenu, viewer); 
     Control control = viewer.getControl(); 
     Menu menu = contextMenu.createContextMenu(control); 
     control.setMenu(menu); 
 
Perhaps this could be added to the wiki? 
 
Now there is just one other problem - other plugin contributions are  
showing up on my editor, where it just doesn't make any sense. Example:  
How do you create a "Run configuration" for a string that you are about  
to translate? 
 
Oh well, after all this digging I might just have to go back to  
programatically creating actions. 
 
But thanks to you anyway! 
Regards 
Damian Philipp
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04154 seconds