Eclipse e4应用程序中的贡献和处理托盘图标

Eclipse e4应用程序中的贡献和处理托盘图标,eclipse,e4,trayicon,Eclipse,E4,Trayicon,我正在尝试将托盘图标添加到基于e4的应用程序中。在e3应用程序中,我使用WorkbenchWindowVisor类和重写 WorkbenchWindowAdvisor.postWindowOpen() 及 方法来贡献和处理托盘图标。在e4应用程序中,我使用MyLifeCycleManager(lifeCycleURI应用程序属性)和@ProcessAdditions注释方法,根据主题,我以以下方式创建托盘图标: Tray tray = pDisplay.getSystemTray();

我正在尝试将托盘图标添加到基于e4的应用程序中。在e3应用程序中,我使用WorkbenchWindowVisor类和重写

WorkbenchWindowAdvisor.postWindowOpen()  

方法来贡献和处理托盘图标。在e4应用程序中,我使用MyLifeCycleManager(lifeCycleURI应用程序属性)和@ProcessAdditions注释方法,根据主题,我以以下方式创建托盘图标:

Tray tray = pDisplay.getSystemTray();  
trayItem = new TrayItem(tray, SWT.NONE);  
Image trayImage = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/alt_window_16.gif").createImage();  
trayItem.setImage(trayImage);  
trayItem.setToolTipText(TRAY_TOOLTIP);  
要处理托盘图标,我使用注入上下文的IWindowCloseHandler实例


以e4方式创建和处理托盘图标(以及其他特定于应用程序的对象)的正确方法是什么?

您所做的似乎是合理的。你有什么问题吗?我想有更合适的方法。最好有一些注释或处理程序来负责初始化和处理自定义的windows添加。在我们知道的情况下,有postreate和PreDestroy注释,但它们不适用于这种情况。
Tray tray = pDisplay.getSystemTray();  
trayItem = new TrayItem(tray, SWT.NONE);  
Image trayImage = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/alt_window_16.gif").createImage();  
trayItem.setImage(trayImage);  
trayItem.setToolTipText(TRAY_TOOLTIP);