예제 #1
0
 public static void main(String args[]) {
   // INFO: Unter MacOsx muss jar wie folgt gestartet werden: java
   // -XstartOnFirstThread -jar
   try {
     if (!ArrayUtils.isEmpty(args) && !args[0].equals("-debug")) {
       BeeLogger.removeConsoleHandler();
     }
     logger.info("xdccBee start");
     window = new Application();
     window.setBlockOnOpen(true);
     window.open();
     if (Display.getCurrent() != null && !Display.getCurrent().isDisposed()) {
       Display.getCurrent().dispose();
     }
   } catch (Exception e) {
     BeeLogger.exception(e);
     throw new RuntimeException(e);
   }
   System.exit(0);
 }
예제 #2
0
 private void makeTray() {
   Display display = window.getShell().getDisplay();
   final Tray tray = display.getSystemTray();
   if (tray == null) {
     // no tray
   } else {
     final TrayItem item = new TrayItem(tray, SWT.NONE);
     item.setToolTipText(XdccBeeMessages.getString("Application_TITLE"));
     final Menu menu = new Menu(window.getShell(), SWT.POP_UP);
     MenuItem mi = new MenuItem(menu, SWT.PUSH);
     mi.setText(XdccBeeMessages.getString("Application_TRAY_OPEN"));
     mi.addListener(
         SWT.Selection,
         new Listener() {
           public void handleEvent(Event event) {
             window.getShell().setVisible(true);
             window.getShell().setMinimized(false);
           }
         });
     menu.setDefaultItem(mi);
     item.addListener(
         SWT.MenuDetect,
         new Listener() {
           public void handleEvent(Event event) {
             menu.setVisible(true);
           }
         });
     item.addListener(
         SWT.Selection,
         new Listener() {
           public void handleEvent(Event event) {
             menu.setVisible(true);
           }
         });
     item.setImage(Images.WINDOW_ICON_LARGE);
   }
 }