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

📄 applicationworkbenchwindowadvisor.java

📁 Eclipse RCP应用系统开发方法与实战源代码
💻 JAVA
字号:
package cn.edu.jfcs.app;import org.eclipse.core.runtime.Platform;import org.eclipse.swt.SWT;import org.eclipse.swt.graphics.Point;import org.eclipse.swt.graphics.Rectangle;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Shell;import org.eclipse.ui.application.ActionBarAdvisor;import org.eclipse.ui.application.IActionBarConfigurer;import org.eclipse.ui.application.IWorkbenchWindowConfigurer;import org.eclipse.ui.application.WorkbenchWindowAdvisor;import cn.edu.jfcs.sys.CacheImage;import cn.edu.jfcs.sys.HookSysTray;import cn.edu.jfcs.sys.IAppConstants;public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {	private HookSysTray hookSysTray;	public ApplicationWorkbenchWindowAdvisor(			IWorkbenchWindowConfigurer configurer) {		super(configurer);	}	public ActionBarAdvisor createActionBarAdvisor(			IActionBarConfigurer configurer) {		return new ApplicationActionBarAdvisor(configurer);	}	private void createSystemTray() {		hookSysTray = new HookSysTray();		hookSysTray.createSysTray(getWindowConfigurer().getWindow());	}	public boolean preWindowShellClose() {		hookSysTray.windowMinimized(getWindowConfigurer().getWindow()				.getShell());		return false;	}	public void postWindowOpen() {		// 设置窗口自动居中		Shell shell = getWindowConfigurer().getWindow().getShell();		Rectangle screenSize = Display.getDefault().getClientArea();		Rectangle frameSize = shell.getBounds();		shell.setLocation((screenSize.width - frameSize.width) / 2,				(screenSize.height - frameSize.height) / 2);		createSystemTray();		String[] args=Platform.getApplicationArgs();		if(args.length==1&&args[0].equals("system")) 			getWindowConfigurer().getWindow().getShell().setMinimized(true);	}	public void preWindowOpen() {		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();		configurer.setInitialSize(new Point(800,600));		configurer.setShowCoolBar(true);		configurer.setShowStatusLine(true);		configurer.setShellStyle(SWT.MIN | SWT.CLOSE);		configurer.setTitle(IAppConstants.APPLICATION_TITLE);	}	public void dispose() {		hookSysTray.Dispose();		CacheImage.getINSTANCE().dispose();	}}

⌨️ 快捷键说明

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