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

📄 applicationworkbenchwindowadvisor.java

📁 对于可视的桌面开发系统的一些详细的设计资料
💻 JAVA
字号:
package gr.osmosis.rcpsamples.pojoeditor;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TrayItem;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
	
	public ApplicationWorkbenchWindowAdvisor(
			IWorkbenchWindowConfigurer configurer) {
		super(configurer);
	}

	public ActionBarAdvisor createActionBarAdvisor(
			IActionBarConfigurer configurer) {
		return new ApplicationActionBarAdvisor(configurer);
	}

	public void preWindowOpen() {
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
		configurer.setInitialSize(new Point(600, 400));
		configurer.setShowCoolBar(false);
		configurer.setShowStatusLine(false);
	}

	public boolean preWindowShellClose() {
		// the image for the system tray
		// we choose just one from Platform's shared images
		final Image image = PlatformUI.getWorkbench().getSharedImages().getImage(
		ISharedImages.IMG_OBJS_INFO_TSK);
	
		
		Display display = this.getWindowConfigurer().getWindow().getShell()
				.getDisplay();

		final TrayItem trayItem = new TrayItem(display.getSystemTray(),
				SWT.NONE);
		
		trayItem.setImage(image);

		trayItem.setToolTipText("POJO Editor - RCP Application");

		trayItem.addSelectionListener(new SelectionAdapter() {

			public void widgetDefaultSelected(SelectionEvent e) {

				Shell workbenchWindowShell = getWindowConfigurer().getWindow()
						.getShell();

				workbenchWindowShell.setVisible(true);

				workbenchWindowShell.setActive();

				workbenchWindowShell.setFocus();

				workbenchWindowShell.setMinimized(false);

				trayItem.setVisible(false);

			}

		});

		getWindowConfigurer().getWindow().getShell().setVisible(false);

		return false;

		// return super.preWindowShellClose();

	}

}

⌨️ 快捷键说明

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