Change TrayIcon Tooltip from ProgressMonitorDialog
I am using the Eclipse RCP trayitem, which is described in Vogellas tutorials.
The requirement now is not only to show the name of the app in the tooltip but also a percentage while doing lengthy operations.
I understand that the t开发者_运维知识库rayitem attribute is a private from ApplicationWorkbenchWindowAdvisor
, so I added a getter and setter method.
The only thing missing is a possibility to access the trayitem instance from my ProgressMonitorDialog
instance.
Can you tell me, how you would solve this puzzle?
ThanksSince you can build a TrayItem
around the SystemTray
from any windows:
final Tray tray = window.getShell().getDisplay().getSystemTray();
TrayItem trayItem = new TrayItem(tray, SWT.NONE);
, do you have to access that TrayItem
instance from ApplicationWorkbenchWindowAdvisor
?
You could put it in a more accessible class or even build one where and when you need it.
Speaking of showing percentage while doing lengthy operations, I just wanted to mentioned the latest tasks icons improvements in Eclipse3.6M6 (not system tray, but related at they now can provide a good status indicator). See Snippet 336 for an example.
- TaskItem overlay image
The new API
TaskItem#setOverlayImage(Image)
allows clients to set an image to be displayed on top of the application button in the taskbar.
alt text http://download.eclipse.org/eclipse/downloads/drops/S-3.6M6-201003121448/images/overlayimage.png
- TaskItem overlay text
The new API
TaskItem#setOverlayText(String)
allows clients to set a short text to be displayed on top of the application button in the taskbar.
alt text http://download.eclipse.org/eclipse/downloads/drops/S-3.6M6-201003121448/images/overlaytext.png
- TaskItem progress
The new APIs
TaskItem#setProgress(int)
andTaskItem#setProgressState(int)
allows clients to show progress indication in the application button in the taskbar.
alt text http://download.eclipse.org/eclipse/downloads/drops/S-3.6M6-201003121448/images/progress.png
精彩评论