java - Programmatically call menu item with Eclipse JDT, Plug-In Development -
i've been trying figure out while how call eclipse menu item within plug-in i'm developing. say, sake of posting, want call eclipse "format" menu item in right click menu format source, how go doing calling item (i.e. not mimicking menu item's effect, calling it)?
i'm not looking how format code, idea of calling menu item.
i leaning towards apis info on iworkbench, shell, toolbar, toolitem, etc., don't know. haven't been able find on topic in apis or anywhere else online. there better approach doing rather programmatically?
eclipse jdt - http://help.eclipse.org/indigo/index.jsp?nav=%2f3
edit:
string commandid = "org.eclipse.jdt.ui.edit.text.java.format"; ihandlerservice handlerservice = (ihandlerservice)(ihandlerservice ) platformui.getworkbench().getservice(ihandlerservice.class); handlerservice.executecommand(commandid, null);
simple that. hardest part finding commandid, can searched for, rlegendi mentioned. wanted. accesses plugin via id, executes it. simple , effective. everyone!
i'm not sure want read command/delegate framework.
btw if install eclipse platform sdk plugin (available default), can take on source code of plugin part of current eclipse product (try ctrl+shift+t
, typing isourceviewer
instance, there find format
it, can search ctrl+shift+g
), , can import of plugin projects own workspace examine.
Comments
Post a Comment