EclipseRCPで常駐アプリを作る方法

「EclipseRCPで常駐アプリを作る方法」の編集履歴(バックアップ)一覧はこちら

EclipseRCPで常駐アプリを作る方法」(2009/07/01 (水) 21:04:52) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

コードサンプル public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { ・・・ public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(10, 10)); configurer.setShowCoolBar(false); configurer.setShowStatusLine(false); configurer.setShellStyle(SWT.NONE); } public void postWindowOpen() { super.postWindowOpen(); window = getWindowConfigurer().getWindow(); Shell shell = window.getShell(); shell.setMinimized(true); shell.setVisible(false); initTrayItem(); } private TrayItem initTaskItem() { Tray tray = window.getShell().getDisplay().getSystemTray(); TrayItem trayItem = new TrayItem(tray, SWT.NONE); trayItem.setImage(image); trayItem.setToolTipText(toolTip); MenuManager trayMenu = new MenuManager(); Menu menu = trayMenu.createContextMenu(shell); trayMenu.add(new Action() { { setText("設定"); } public void run() { } } trayMenu.add(ActionFactory.QUIT.create(window)); trayItem.addMenuDetectListener(new MenuDetectListener() { public void menuDetected(MenuDetectEvent e) { menu.setVisible(true); } }); ・・・ } }
コードサンプル public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { private IWorkbenchWindow window; private Image image; public ApplicationWorkbenchWindowAdvisor( IWorkbenchWindowConfigurer configurer) { super(configurer); image = AbstractUIPlugin.imageDescriptorFromPlugin( "sample.rcpstub", "/icons/sample.gif") .createImage(); } public ActionBarAdvisor createActionBarAdvisor( IActionBarConfigurer configurer) { return new ApplicationActionBarAdvisor(configurer); } public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(0, 0)); configurer.setShowCoolBar(false); configurer.setShowStatusLine(false); //configurer.setShellStyle(SWT.NONE); } @Override public boolean preWindowShellClose() { Shell shell = window.getShell(); if (shell.getVisible()) { shell.setMinimized(true); shell.setVisible(false); return false; } return super.preWindowShellClose(); } public void postWindowOpen() { super.postWindowOpen(); window = getWindowConfigurer().getWindow(); Shell shell = window.getShell(); shell.setMinimized(true); shell.setVisible(false); initTrayItem(); } private void initTrayItem() { Tray tray = window.getShell().getDisplay().getSystemTray(); TrayItem trayItem = new TrayItem(tray, SWT.NONE); trayItem.setImage(image); trayItem.setToolTipText("Sample"); MenuManager trayMenu = new MenuManager(); final Menu menu = trayMenu.createContextMenu(window.getShell()); trayMenu.add(new Action("設定") { public void run() { Shell shell = window.getShell(); shell.setSize(400,300); shell.setMinimized(false); shell.setVisible(true); } }); trayMenu.add(ActionFactory.QUIT.create(window)); trayItem.addMenuDetectListener(new MenuDetectListener() { public void menuDetected(MenuDetectEvent e) { menu.setVisible(true); } }); } }

表示オプション

横に並べて表示:
変化行の前後のみ表示:
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。