0
我有一个非常简单的基于eclipse 3.6的rcp应用程序。我有一个现有的“Windows”菜单,我试图通过创建一个命令条目添加“重置透视...”子菜单commandId值org.eclipse.ui.window.resetPerspective。子菜单显示得很好,但它被禁用。有人可以帮我启用它吗?感谢您的时间!!!在我的eclipse rcp应用程序中禁用“Reset Perspective ...”菜单
我有一个非常简单的基于eclipse 3.6的rcp应用程序。我有一个现有的“Windows”菜单,我试图通过创建一个命令条目添加“重置透视...”子菜单commandId值org.eclipse.ui.window.resetPerspective。子菜单显示得很好,但它被禁用。有人可以帮我启用它吗?感谢您的时间!!!在我的eclipse rcp应用程序中禁用“Reset Perspective ...”菜单
尝试使用在你的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);
// ...
}
}
谢谢大家的响应,Kelibiano。因为我已经通过plugin.xml添加了菜单,所以您在makeActions()函数中提供的代码就足够了。谢谢! – user1056027 2012-07-20 03:20:51