i have a very simple eclipse 3.6-based rcp application. i have an existing "Windows" menu to which i am trying to add "Reset Perspective..." sub-menu by creating a command entry with commandId value of org.eclipse.ui.window.resetPerspective. the sub-menu appears just fine, but it is disabled. could someone please help me with enabling it? thank you for your time!!!
Try using the programmatic solution in your ApplicationActionBarAdvisor class as following :
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction resetPerspectiveAction;
@Override
protected void makeActions(IWorkbenchWindow window) {
// ...
// create and register the actions
resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);
register(resetPerspectiveAction);
// ...
}
@Override
protected void fillMenuBar(IMenuManager menuBar) {
// ...
// create and fill the window menu
MenuManager windowMenu = new MenuManager("&Window", WorkbenchActionConstants.M_WINDOW);
menuBar.add(windowMenu);
windowMenu.add(resetPerspectiveAction);
// ...
}
}