⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 applicationactionbaradvisor.java

📁 一个专家资料的管理系统
💻 JAVA
字号:
package mms;import org.eclipse.jface.action.Action;import org.eclipse.jface.action.IAction;import org.eclipse.jface.action.ICoolBarManager;import org.eclipse.jface.action.IMenuManager;import org.eclipse.jface.action.IToolBarManager;import org.eclipse.jface.action.MenuManager;import org.eclipse.jface.action.Separator;import org.eclipse.jface.action.ToolBarContributionItem;import org.eclipse.jface.action.ToolBarManager;import org.eclipse.swt.SWT;import org.eclipse.ui.IWorkbenchActionConstants;import org.eclipse.ui.IWorkbenchWindow;import org.eclipse.ui.actions.ActionFactory;import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;import org.eclipse.ui.application.ActionBarAdvisor;import org.eclipse.ui.application.IActionBarConfigurer;import cn.com.likai.mms.Activator;public class ApplicationActionBarAdvisor extends ActionBarAdvisor {	private IWorkbenchAction quitAction;// 退出	private IWorkbenchAction aboutAction;//关于	private IWorkbenchAction newWindowAction;//打开新窗口	private IAction memberPersAction;//会员管理透视图	private IWorkbenchAction preferencesAction;//首选项    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {        super(configurer);    }    protected void makeActions(IWorkbenchWindow window) {    	quitAction = ActionFactory.QUIT.create(window);//退出    	aboutAction = ActionFactory.ABOUT.create(window);//关于    	newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);//打开新窗口    	memberPersAction = new MemberPerspectiveAction();//自定义Action,打开"成绩管理"透视图    	preferencesAction = ActionFactory.PREFERENCES.create(window);//首选项    	register(preferencesAction);    	register(quitAction);    	register(aboutAction);    	register(newWindowAction);    	register(memberPersAction);    }    protected void fillMenuBar(IMenuManager menuBar) {    	//创建主菜单    	IMenuManager fileMenu = new MenuManager("文件(&F)",IWorkbenchActionConstants.M_FILE);    	IMenuManager persMenu = new MenuManager("透视图(&P)");    	IMenuManager helpMenu = new MenuManager("帮助(&H)",IWorkbenchActionConstants.M_HELP);    	menuBar.add(fileMenu);    	menuBar.add(persMenu);    	menuBar.add(helpMenu);    	//给各菜单加入菜单项    	fileMenu.add(newWindowAction);    	fileMenu.add(preferencesAction);    	fileMenu.add(new Separator());//分隔符    	fileMenu.add(quitAction);    	persMenu.add(memberPersAction);    	helpMenu.add(aboutAction);    }    protected void fillCoolBar(ICoolBarManager coolBar){    	IToolBarManager toolbar = new ToolBarManager(SWT.FLAT|SWT.RIGHT);    	coolBar.add(new ToolBarContributionItem(toolbar,"main"));    	toolbar.add(memberPersAction);//图标快捷键    	toolbar.add(quitAction);    }        private static class MemberPerspectiveAction extends Action{    	public MemberPerspectiveAction(){    		setId("ACTIONS_SCORE_PERSPECTIVE");//必须设置一个ID标识    		setText("会员资料管理");    		setImageDescriptor(Activator.getImageDescriptor("icons/alt_window_16.gif"));    		setActionDefinitionId(GUIConstants.MEMBER_PERSPECTIVE_ID);    	}    	public void run(){    		Activator.showPerspective(GUIConstants.MEMBER_PERSPECTIVE_ID);    		//用Actiovator类中自定义showPerspective的方法打开透视图    	}    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -