Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.TrayItem


  private Timer timer;
  private boolean isBusy;

  public SystemTrayItem(final GuiController guiController) {
    Tray tray = guiController.getDisplay().getSystemTray();
    this.trayItem = new TrayItem(tray, SWT.NULL);

    imageList = new Image[2];
    imageList[0] = guiController.getImage("fullsync48.png"); //$NON-NLS-1$
    imageList[1] = guiController.getImage("fullsync48_r.png"); //$NON-NLS-1$
    imageActive = 0;
View Full Code Here


                                                       
                            tray = Utilities.getDisplay().getSystemTray();
                            if (tray == null) {
                                System.out.println ("The system tray is not available");
                            } else {
                                 TrayItem TRAY_ITEM = new TrayItem(tray, SWT.NONE);
                                 TRAY_ITEM.setImage(ImageRepository.getImage("icon"));
                                 TRAY_ITEM.setVisible(true);
                                 TRAY_ITEM.setToolTipText("FireFrog - Right Click for menu");
                         
                                
                                
                                 final Menu popupmenu = new Menu(View.composite.getShell(), SWT.POP_UP);
                                
                                
                                
                                 download_manager = new MenuItem(popupmenu, SWT.PUSH);
                                 download_manager.setText("Open FireFrog");
                                 download_manager.setImage(ImageRepository.getImage("icon"));
                                 download_manager.addListener(SWT.Selection, new Listener () {
                                    public void handleEvent (Event e){
                                        DownloadManagerShell.open();
                                    }
                                 });
                                
                               
                                
                                 //Pause/Resume All Cascade
                                 MenuItem transfers = new MenuItem(popupmenu, SWT.CASCADE);
                                 transfers.setText("Transfers");
                                 Menu transfers_menu = new Menu(View.composite.getShell(),SWT.DROP_DOWN);
                                 transfers.setMenu(transfers_menu);
                                
                                 MenuItem pauseAll = new MenuItem(transfers_menu,SWT.PUSH);
                                 pauseAll.setText("Stop All Transfers");
                                 pauseAll.addListener(SWT.Selection, new Listener () {
                                     public void handleEvent (Event e){
                                         Plugin.getPluginInterface().getDownloadManager().stopAllDownloads();
                                     }
                                 });
                                
                                
                                
                                 MenuItem startAll = new MenuItem(transfers_menu,SWT.PUSH);
                                 startAll.setText("Start All Transfers");
                                 startAll.addListener(SWT.Selection, new Listener () {
                                     public void handleEvent (Event e){
                                         Plugin.getPluginInterface().getDownloadManager().startAllDownloads();
                                     }
                                 });
                                
                                
                                
                                 //Advanced Options Cascade
                                 MenuItem advanced_item = new MenuItem(popupmenu, SWT.CASCADE);
                                 advanced_item.setText("Advanced Options");
                                
                                 Menu advanced = new Menu(View.composite.getShell(),SWT.DROP_DOWN);
                                
                                 advanced_item.setMenu(advanced);
                                
                                 showAzureus = new MenuItem(advanced, SWT.PUSH);
                                 showAzureus.setText("Hide Azureus");
                                 showAzureus.addListener(SWT.Selection, new Listener () {
                                     public void handleEvent (Event e){
                                        
                                         if(showAzureus.getText().equalsIgnoreCase("Show Azureus")){
                                             if(!org.gudy.azureus2.ui.swt.mainwindow.MainWindow.getWindow().isVisible()){
                                                 showAzureus.setText("Hide Azureus");
                                                 org.gudy.azureus2.ui.swt.mainwindow.MainWindow.getWindow().setVisible(true);   
                                             }else      
                                                 showAzureus.setText("Hide Azureus");
                                         }else{
                                             if(org.gudy.azureus2.ui.swt.mainwindow.MainWindow.getWindow().isVisible()){
                                                 org.gudy.azureus2.ui.swt.mainwindow.MainWindow.getWindow().setVisible(false);
                                                 showAzureus.setText("Show Azureus");   
                                             }else
                                                 showAzureus.setText("Show Azureus");
                                         }
                                            
                                     }
                                  });
                                
                                
                             
                                
                                
                                 exit = new MenuItem(popupmenu, SWT.PUSH);
                                 exit.setText("Exit FireFrog and Azureus");
                                 exit.addListener(SWT.Selection, new Listener () {
                                     public void handleEvent (Event e){
                                        
                                         try {
                                             Shell shell = new Shell(Utilities.getDisplay());
                                             MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                                             messageBox.setText("Exit Confirmation");
                                             messageBox.setMessage("Are you sure you want to exit FireFrog and Azureus?");
                                             int response = messageBox.open();
                                             switch (response){
                                             case SWT.YES:
                                                 Plugin.getPluginInterface().getUpdateManager().applyUpdates(false);
                                                 shell.dispose();
                                                break;
                                             case SWT.NO:
                                                 break;
                                             }
                                            
                                        } catch (UpdateException e1) {
                                            e1.printStackTrace();
                                        }
                                     }
                                  });
                                
                                
                                 TRAY_ITEM.addListener (SWT.Selection, new Listener () {
                                     public void handleEvent (Event event) {
                                         //System.out.println("selection");
                                         //popupmenu.setVisible (true);
                                     }
                                 });
                                
                                 TRAY_ITEM.addListener (SWT.MenuDetect, new Listener () {
                                    public void handleEvent (Event event) {
                                        popupmenu.setVisible (true);
                                    }
                                });
                                
                                 TRAY_ITEM.addListener(SWT.DefaultSelection, new Listener()
                                 {
                                     public void handleEvent(Event e)
                                     {
                                         if(DownloadManagerShell.DOWNLOAD_MANAGER_SHELL == null || DownloadManagerShell.DOWNLOAD_MANAGER_SHELL.isDisposed()){
                                             DownloadManagerShell.open();
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.TrayItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.