user1056027
user1056027

Reputation: 145

"Reset Perspective..." menu is disabled in my eclipse rcp application

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!!!

Upvotes: 0

Views: 1661

Answers (1)

Kelibiano
Kelibiano

Reputation: 81

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);
        // ...
     }
}

Upvotes: 2

Related Questions