2012-07-18 103 views

回答

2

尝试使用在你的ApplicationActionBarAdvisor类的编程解决方案如下:

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

谢谢大家的响应,Kelibiano。因为我已经通过plugin.xml添加了菜单,所以您在makeActions()函数中提供的代码就足够了。谢谢! – user1056027 2012-07-20 03:20:51

相关问题