[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] drop down menu in form editor

Hi,

By using below extension point I am able to get drop down menu in views.
But I need to get a drop down menu in form editor and toolbar.

<extension point="org.eclipse.ui.viewActions">
<viewContribution id="com.aa.bb.cc.dd.views.contribution" targetID="com.aa.bb.cc.dd.gui.views.AnnotationView">
<action class="com.aa.bb.cc.dd.gui.actions.HintButtonAction" icon="icons/help_view.gif" id="com.aa.bb.cc.dd.gui.actions.HintButtonAction"
label="AnnotationHints" state="true" style="pulldown"
toolbarPath="additions" tooltip="Hints for Compilation View" /> </viewContribution>
</extension>


HintButtonAction
================

public void selectionChanged(IAction action, ISelection selection) { // Do whatever else you need to do.

// Hook up a menu creator if (!menuCreatorSet) { action.setMenuCreator(new IMenuCreator() { // for view menu public Menu getMenu(Menu parent) { Menu menu = new Menu(parent); MenuItem menuItem = new MenuItem(menu, SWT.PUSH); menuItem.setText("Monkey"); return menu; }

public Menu getMenu(Control parent) { // for tool bar Menu menu = new Menu(parent); MenuItem menuItem = new MenuItem(menu, SWT.PUSH); menuItem.setText("Monkey"); return menu; }

public void dispose() { // Do nothing } }); menuCreatorSet = true; } }


Please let me know how to add drop down menu in form editor and tool bar.

Thanks,
Sarayu.