Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop down menu in form editor

 
Chethan Sharma
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic