RCP工程系统托盘功能
来源:互联网 发布:ipadair2必备软件 编辑:程序博客网 时间:2024/05/22 09:45
在开发RCP工程过程中,有时候在最小化窗口的时候希望将窗口托管在系统栏。添加代码如下:
在ApplicationWorkbenchWindowAdvisor类中添加下面的代码:
private Image statusImage;
private TrayItem trayItem;
private Image trayImage;
private ApplicationActionBarAdvisor actionBarAdvisor;public void postWindowOpen() { initStatusLine(); final IWorkbenchWindow window = getWindowConfigurer().getWindow(); trayItem = initTaskItem(window); if (trayItem != null) { hookPopupMenu(window); hookMinimize(window); }}private void hookMinimize(final IWorkbenchWindow window) { window.getShell().addShellListener(new ShellAdapter() { public void shellIconified(ShellEvent e) { window.getShell().setVisible(false); } }); trayItem.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event event) { Shell shell = window.getShell(); if (!shell.isVisible()) { shell.setVisible(true); window.getShell().setMinimized(false); } } });}private void hookPopupMenu(final IWorkbenchWindow window) { trayItem.addListener(SWT.MenuDetect, new Listener() { public void handleEvent(Event event) { MenuManager trayMenu = new MenuManager(); Menu menu = trayMenu.createContextMenu(window.getShell()); actionBarAdvisor.fillTrayItem(trayMenu); menu.setVisible(true); } });}private TrayItem initTaskItem(IWorkbenchWindow window) { final Tray tray = window.getShell().getDisplay().getSystemTray(); if (tray == null) return null; TrayItem trayItem = new TrayItem(tray, SWT.NONE); trayImage = AbstractUIPlugin.imageDescriptorFromPlugin( "org.eclipsercp.hyperbola", IImageKeys.ONLINE).createImage(); trayItem.setImage(trayImage); trayItem.setToolTipText("Hyperbola"); return trayItem;}public void dispose() { if (trayImage != null) { trayImage.dispose(); trayItem.dispose(); }}
在ApplicationActionBarAdvisor中添加下面函数protected void fillTrayItem(IMenuManager trayItem) { trayItem.add(aboutAction); trayItem.add(exitAction);}
- RCP工程系统托盘功能
- 在RCP中实现系统托盘功能
- 在RCP中实现系统托盘功能
- 在RCP中实现系统托盘功能
- 在RCP中实现系统托盘功能
- 在RCP中实现系统托盘功能
- RCP系统托盘实现方法
- 系统托盘功能
- 把rcp最小化到系统托盘
- RCP应用中创建系统托盘和状态栏
- 实现系统托盘的功能
- Air实现系统托盘功能
- Swing实现系统托盘功能
- Net系统托盘功能
- RCP提示功能
- 为RCP程序增加关闭提示和关闭到系统托盘
- rcp工程中,出现NoClassDefFoundError。
- 针对RCP改工程名
- System Requirements
- People Get Connected
- spring事务管理几种配置
- IndentityNotMappedException解决方案
- Spring 编程式事务和申明式事务选择和使用小结
- RCP工程系统托盘功能
- Eclipse+ProGuard配置混淆器
- A Configuring SAP for Inbound and Outbound Processing
- HttpApplication事件触发顺序
- java.applet.Applet类
- ASF学习笔记
- unix下常用解压和压缩命令
- SQL exists 和in
- 解决在火狐浏览器中文本框和按钮在同行显示不对齐问题