/** * Open the window. */ public void open() { try { Display display = Display.getDefault(); this.createContents(); this.shell.open(); this.shell.layout(); while (!this.shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } finally { Tray tray = Display.getDefault().getSystemTray(); if (tray != null) { for (TrayItem item : tray.getItems()) { item.dispose(); } } } }
private void addTrayItem() { Display display; Tray tray; Shell shell; display = Main.getDisplay(); tray = display.getSystemTray(); shell = Main.getShell(); if (tray != null) { trayItem = new TrayItem(tray, SWT.NONE); trayItem.setToolTipText("Dazzl"); //$NON-NLS-1$ trayItem.setImage(admIcon); //$NON-NLS-1$ trayItem.addListener(SWT.MenuDetect, new Listener() { public void handleEvent(Event event) { if (menu != null) { menu.setVisible(true); } } }); } else { CommonDialogs.showError(Messages .getString("SystemTray.error.no_system_tray"), null); } }
public TrayIcon(Display display, MainWindow window) { if(display == null) { throw new NullPointerException("Display cannot be null."); } if(window == null) { throw new NullPointerException("Main window cannot be null."); } m_mainDisplay = display; m_mainWindow = window; // Create tray item Tray tray = display.getSystemTray(); m_item = new TrayItem(tray, SWT.NONE); m_item.setText("Droid Navi"); // Set Image m_logo = AppLogo.getLogo(AppLogo.LogoType.TRAY_ICON, display); m_item.setImage(m_logo); init(m_item); }
public static void showTrayItemTooltipMessage(final TrayItem trayItem, final String title, final String message) { final Shell sShell = MailsterSWT.getInstance().getShell(); Display.getDefault().asyncExec(new Thread() { public void run() { final ToolTip tip = new ToolTip(sShell, SWT.BALLOON | SWT.ICON_INFORMATION); tip.setMessage(message); tip.setText(title); if (Display.getDefault().getSystemTray() != null) trayItem.setToolTip(tip); else tip.setLocation(sShell.getLocation()); tip.setVisible(true); tip.setAutoHide(ConfigurationManager.CONFIG_STORE.getBoolean(ConfigurationManager.AUTO_HIDE_NOTIFICATIONS_KEY)); } }); }
public void removeTray(){ if (this.tray != null) { setVisible(true); TrayItem items[] = this.tray.getItems(); for(int i = 0; i < items.length; i ++){ items[i].dispose(); } this.menu.dispose(); } }
/** * トレイアイコンを追加します * * @param display * @return */ private TrayItem addTrayItem(final Display display) { // トレイアイコンを追加します Tray tray = display.getSystemTray(); TrayItem item = new TrayItem(tray, SWT.NONE); Image image = display.getSystemImage(SWT.ICON_INFORMATION); item.setImage(image); item.setToolTipText(AppConstants.NAME + AppConstants.VERSION); item.addListener(SWT.Selection, new TraySelectionListener(this.shell)); item.addMenuDetectListener(new TrayItemMenuListener(this.getShell())); return item; }
/** * トレイアイコンを追加します * * @param display * @return */ private TrayItem addTrayItem(final Display display) { // トレイアイコンを追加します Tray tray = display.getSystemTray(); TrayItem item = new TrayItem(tray, SWT.NONE); Image image = display.getSystemImage(SWT.ICON_INFORMATION); item.setImage(image); item.setToolTipText(AppConstants.NAME + " " + AppConstants.VERSION); item.addListener(SWT.Selection, new TraySelectionListener(this.shell)); item.addMenuDetectListener(new TrayItemMenuListener(this.getShell())); return item; }
public void removeTray(){ if (this.tray != null) { setVisible(true); TrayItem items[] = this.tray.getItems(); for(int i = 0; i < items.length; i ++){ items[i].dispose(); } this.icon.dispose(); this.menu.dispose(); } }
@Override public void performInitializations() { controller = new GadgetController(this); imageContainer = new Label(getShell(), SWT.NO_TRIM); tray = new TrayItem(Display.getDefault().getSystemTray(), SWT.NONE); trayMenu = new Menu(this.getShell(), SWT.POP_UP); openJobs = new MenuItem(trayMenu, SWT.PUSH); openChat = new MenuItem(trayMenu, SWT.PUSH); openSettings = new MenuItem(trayMenu, SWT.PUSH); exitApp = new MenuItem(trayMenu, SWT.PUSH); }
public void show() { ImageRepository imageRepository = imageRepositoryProvider.get(); trayItem = new TrayItem(shell.getDisplay().getSystemTray(), SWT.NULL); imageList = new Image[2]; imageList[0] = imageRepository.getImage("fullsync48.png"); //$NON-NLS-1$ imageList[1] = imageRepository.getImage("fullsync48_r.png"); //$NON-NLS-1$ imageActive = 0; // initialize trayItem trayItem.setImage(imageList[0]); trayItem.setToolTipText("FullSync"); //$NON-NLS-1$ trayItem.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true)); trayItem.addListener(SWT.DefaultSelection, e -> mainWindowProvider.get().setVisible(true)); trayItem.addListener(SWT.MenuDetect, e -> menu.setVisible(true)); // initialize popup menu menu = new Menu(shell, SWT.POP_UP); MenuItem item; item = new MenuItem(menu, SWT.NULL); item.setImage(imageRepository.getImage("fullsync16.png")); item.setText(Messages.getString("SystemTrayItem.OpenFullSync")); //$NON-NLS-1$ item.addListener(SWT.Selection, e -> mainWindowProvider.get().setVisible(true)); item = new MenuItem(menu, SWT.NULL); item.setText(Messages.getString("SystemTrayItem.Exit")); //$NON-NLS-1$ item.addListener(SWT.Selection, e -> guiControllerProvider.get().closeGui()); taskGeneratorProvider.get().addTaskGenerationListener(this); }
private TrayItem initTaskItem(Shell shell) { final Tray tray = shell.getDisplay().getSystemTray(); TrayItem trayItem = new TrayItem(tray, SWT.NONE); trayImage = AbstractUIPlugin.imageDescriptorFromPlugin( "com.dmagik.sheetrackimporter", "/icons/alt_window_16.gif") .createImage(); trayItem.setImage(trayImage); trayItem.setToolTipText("Double-click to maximize SheetRack Importer"); return trayItem; }
static SelectionAdapter create(Widget widget) { if (widget instanceof Button) { return create((Button) widget); } else if (widget instanceof CCombo) { return create((CCombo) widget); } else if (widget instanceof Combo) { return create((Combo) widget); } else if (widget instanceof CoolItem) { return create((CoolItem) widget); } else if (widget instanceof CTabFolder) { return create((CTabFolder) widget); } else if (widget instanceof DateTime) { return create((DateTime) widget); } else if (widget instanceof Link) { return create((Link) widget); } else if (widget instanceof List) { return create((List) widget); } else if (widget instanceof MenuItem) { return create((MenuItem) widget); } else if (widget instanceof Sash) { return create((Sash) widget); } else if (widget instanceof Scale) { return create((Scale) widget); } else if (widget instanceof Slider) { return create((Slider) widget); } else if (widget instanceof Spinner) { return create((Spinner) widget); } else if (widget instanceof StyledText) { return create((StyledText) widget); } else if (widget instanceof TabFolder) { return create((TabFolder) widget); } else if (widget instanceof Table) { return create((Table) widget); } else if (widget instanceof TableColumn) { return create((TableColumn) widget); } else if (widget instanceof TableCursor) { return create((TableCursor) widget); } else if (widget instanceof Text) { return create((Text) widget); } else if (widget instanceof ToolItem) { return create((ToolItem) widget); } else if (widget instanceof ToolTip) { return create((ToolTip) widget); } else if (widget instanceof TrayItem) { return create((TrayItem) widget); } else if (widget instanceof Tree) { return create((Tree) widget); } else if (widget instanceof TreeColumn) { return create((TreeColumn) widget); } else if (widget instanceof TreeCursor) { return create((TreeCursor) widget); } throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported."); }
public TrayItemSWT(TrayDelegate tray, int style) { item = new TrayItem(((TraySWT) tray).getSWT(), style); }
public void setItem(TrayItem item){ this.item = item; }
public EnhancedTrayRestoreListener(final Shell shell, final TrayItem trayItem) { super(shell, trayItem); }
public TrayItem getTrayItem() { return trayItem; }
/** * @return トレイアイコン */ public TrayItem getTrayItem() { return this.trayItem; }
/** Create a listener that restores the shell and hides the tray icon. */ public TrayRestoreListener(final Shell shell, @Nullable final TrayItem trayItem) { this.shell = shell; this.trayItem = trayItem; }
@Nullable protected TrayItem getTrayItem() { return trayItem; }
private void init(TrayItem item) { initContextMenu(); initListeners(); }
public MailsterSWTTrayItem() { trayItem = new TrayItem(tray, SWT.NONE); createSystemTray(); }