0

Im trying to contribute tray icon to my e4 based application. In e3 application I use WorkbenchWindowAdvisor class and override

WorkbenchWindowAdvisor.postWindowOpen()  

and

WorkbenchWindowAdvisor.dispose()  

methods to contribute and dispose tray icon. In e4 app I use MyLifeCycleManager (lifeCycleURI application property) and in @ProcessAdditions annotated method according to topic Add System Tray and Active Workbech Shell reference in E4 application I create tray icon in the following way:

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);  

To dispose tray icon I use IWindowCloseHandler instance injected to the context.

What is the correct way to create and dispose tray icon (and other application specific objects) in e4 manner?

Community
  • 1
  • 1
Bartosz Popiela
  • 951
  • 10
  • 14
  • What you are doing seems reasonable. Do you have a problem with it? – greg-449 Oct 07 '14 at 16:17
  • I thought there is some more proper way to do that. It would be nice to have some annotations or handlers responsible for initializing and disposing custom windows additions. In know there are PostCreate and PreDestroy annotations but they are not applicable in this case. – Bartosz Popiela Oct 08 '14 at 14:27

0 Answers0