Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.MenuItem


            return;
          }

          final Menu menu = new Menu(control.getShell(),SWT.POP_UP);

          MenuItem   item = new MenuItem( menu,SWT.NONE );

          item.setText( MessageText.getString( "ConfigView.copy.to.clipboard.tooltip"));

          item.addSelectionListener(
              new SelectionAdapter()
              {
                public void
                widgetSelected(
                    SelectionEvent arg0)
View Full Code Here


        break;
      }
    }
   
    if ( found_tracker ){
      final MenuItem update_item = new MenuItem( menu, SWT.PUSH);
 
      Messages.setLanguageText(update_item, "GeneralView.label.trackerurlupdate");
     
      update_item.setEnabled( update_ok );
     
      update_item.addListener(
        SWT.Selection,
        new TableSelectedRowsListener(tv)
        {
          public void
          run(
            TableRowCore row )
          {
            for ( Object o: sources ){
             
              TrackerPeerSource ps = (TrackerPeerSource)o;
 
              if ( ps.canManuallyUpdate()){
               
                ps.manualUpdate();
              }
            }
          }
        });
     
      new MenuItem( menu, SWT.SEPARATOR );
    }
  }
View Full Code Here

   * @param menu
   * @param mainWindow
   * @return
   */
  public static Menu createDebugMenuItem(final Menu menu) {
    MenuItem item;

    final UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (null == uiFunctions) {
      throw new IllegalStateException(
          "UIFunctionsManagerSWT.getUIFunctionsSWT() is returning null");
    }

    item = new MenuItem(menu, SWT.CASCADE);
    item.setText("&Debug");
    Menu menuDebug = new Menu(menu.getParent(), SWT.DROP_DOWN);
    item.setMenu(menuDebug);

    item = new MenuItem(menuDebug, SWT.CASCADE);
    item.setText("ScreenSize");
    Menu menuSS = new Menu(menu.getParent(), SWT.DROP_DOWN);
    item.setMenu(menuSS);

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("640x400");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(640, 400);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("800x560");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(850, 560);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1024x700");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1024, 700);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1024x768");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1024, 768);
      }
    });
   
    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1152x784");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1152, 784);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1280x720");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1280, 720);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1280x1024");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1280, 1024);
      }
    });
    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1440x820");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1440, 820);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1600x970");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1600, 970);
      }
    });

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("1920x1200");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(1920, 1200);
      }
    });
   
    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("2560x1520");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        uiFunctions.getMainShell().setSize(2560, 1520);
      }
    });

    item = new MenuItem(menuDebug, SWT.NONE);
    item.setText("Reload messagebundle");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        MessageText.loadBundle(true);
        DisplayFormatters.setUnits();
        DisplayFormatters.loadMessages();
        UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
        if (uiFunctions != null) {
          uiFunctions.refreshLanguage();
        }
      }
    });
   
    item = new MenuItem(menuDebug, SWT.CHECK);
    item.setText("SR ChangeFlagChecker Paused");
    item.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        StartStopRulesDefaultPlugin.pauseChangeFlagChecker = !StartStopRulesDefaultPlugin.pauseChangeFlagChecker;
        ((MenuItem)e.widget).setSelection(StartStopRulesDefaultPlugin.pauseChangeFlagChecker);
      }
    });
View Full Code Here

        Tree tree = toolkit.createTree(schemaSection, SWT.NONE);
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));
        schemaSection.setClient(tree);
       
        final Menu menu = new Menu(Display.getCurrent().getActiveShell(), SWT.POP_UP);
        MenuItem itemNewContentTypeDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewContentTypeDefinition.setText("Content Type Definition");
        itemNewContentTypeDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGContentTypeDefinition cType = _model.createContentTypeDefinition();
                _treeViewer.expandToLevel(cType, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(cType));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewAreaDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewAreaDefinition.setText("Area Definition");
        itemNewAreaDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGAreaDefinition area = _model.createAreaDefinition();
                _treeViewer.expandToLevel(area, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(area));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewLanguageDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewLanguageDefinition.setText("Language Definition");
        itemNewLanguageDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGLanguageDefinition lang = _model.createLanguageDefinition();
                _treeViewer.expandToLevel(lang, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(lang));               
View Full Code Here

    Collections.sort(runtimeList, new WGARuntimeSortByName());
    Iterator<WGARuntime> runtimes = runtimeList.iterator();
    while (runtimes.hasNext()) {
      WGARuntime runtime = runtimes.next();
     
      MenuItem runtimeItem = new MenuItem(menu, SWT.CASCADE);
      runtimeItem.setText(runtime.getName());
      runtimeItem.setData(runtime);
     
      Menu runtimeMenu = new Menu(parent.getShell(), SWT.DROP_DOWN);
      runtimeItem.setMenu(runtimeMenu);
     
      MenuItem startItem = new MenuItem(runtimeMenu, SWT.DROP_DOWN);
      startItem.setText("start");
      startItem.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_START));
      startItem.setData(runtime);
      startItem.setData(ATTRIB_COMMAND, COMMAND_START);
      startItem.addSelectionListener(this);
      if (TomcatUtils.getInstance().isRunning(runtime)) {
        startItem.setEnabled(false);
      }
     
      MenuItem stopItem = new MenuItem(runtimeMenu, SWT.DROP_DOWN);
      stopItem.setText("stop");
      stopItem.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_STOP));
      stopItem.setData(runtime);
      stopItem.setData(ATTRIB_COMMAND, COMMAND_STOP);
      stopItem.addSelectionListener(this);
      if (!TomcatUtils.getInstance().isRunning(runtime)) {
        stopItem.setEnabled(false);
      }
     
      MenuItem configureItem = new MenuItem(runtimeMenu, SWT.DROP_DOWN);
      configureItem.setText("configure");
      configureItem.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_RUNTIME_EDIT));
      configureItem.setData(runtime);
      configureItem.setData(ATTRIB_COMMAND, COMMAND_EDIT);
      configureItem.addSelectionListener(this);
    }
   
   
    return menu;
  }
View Full Code Here

  public void widgetDefaultSelected(SelectionEvent e) {   
  }

  public void widgetSelected(SelectionEvent e) {
    if (e.getSource() instanceof MenuItem) {
      MenuItem item = (MenuItem) e.getSource();
      WGARuntime runtime = (WGARuntime) item.getData();
      String command = (String) item.getData(ATTRIB_COMMAND);
      if (COMMAND_START.equals(command)) {
        StartWGARuntime.call(runtime);
      } else if (COMMAND_STOP.equals(command)){
        StopWGARuntime.call();
      } else if (COMMAND_EDIT.equals(command)) {       
View Full Code Here

  }
 
  public void buildMenu(Menu menu, MenuEvent menuEvent) {

    // Start All
    MenuItem start_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(start_all, "MainWindow.menu.transfers.startalltransfers");
    Utils.setMenuItemImage(start_all, "start");
    start_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncStartAll();
      }
    });
    start_all.setEnabled(true);

    // Stop All
    MenuItem stop_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(stop_all, "MainWindow.menu.transfers.stopalltransfers");
    Utils.setMenuItemImage(stop_all, "stop");
    stop_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncStopAll();
      }
    });
    stop_all.setEnabled(true);
   
    // Pause All
    MenuItem pause_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(pause_all, "MainWindow.menu.transfers.pausetransfers");
    Utils.setMenuItemImage(pause_all, "pause");
    pause_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncPause();
      }
    });
    pause_all.setEnabled(g_manager.canPauseDownloads());
   
    // Resume All
    MenuItem resume_all = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(resume_all, "MainWindow.menu.transfers.resumetransfers");
    Utils.setMenuItemImage(resume_all, "resume");
    resume_all.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.asyncResume();
      }
    });
    resume_all.setEnabled(g_manager.canResumeDownloads());
   
    new MenuItem(menu, SWT.SEPARATOR);
    super.buildMenu(menu);
  }
View Full Code Here

  }
 
  public void buildMenu(Menu menu, MenuEvent menuEvent) {
   
    // Queue
    final MenuItem itemQueue = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemQueue, "MyTorrentsView.menu.queue");
    Utils.setMenuItemImage(itemQueue, "start");
    itemQueue.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.queue(download, splash);
      }
    });
    itemQueue.setEnabled(ManagerUtils.isStartable(download));


    // Stop
    final MenuItem itemStop = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemStop, "MyTorrentsView.menu.stop");
    Utils.setMenuItemImage(itemStop, "stop");
    itemStop.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        ManagerUtils.stop(download, splash);
      }
    });
    itemStop.setEnabled(ManagerUtils.isStopable(download));
   
    new MenuItem(menu, SWT.SEPARATOR);
    super.buildMenu(menu);
  }
View Full Code Here

      return;
    }
    try {
      Utils.execSWTThread(new AERunnable() {
        public void runSupport() {
          final MenuItem torrentItem = MenuFactory.findMenuItem(
              mainWindow.getMainMenu().getMenu(IMenuConstants.MENU_ID_MENU_BAR),
              MenuFactory.MENU_ID_TORRENT, false);

          if (null != torrentItem) {

            DownloadManager[] dms = SelectedContentManager.getDMSFromSelectedContent();

            final DownloadManager[] dm_final = dms;
            final boolean detailed_view_final = false;
            if (null == dm_final) {
              torrentItem.setEnabled(false);
            } else {
              TableView<?> tv = SelectedContentManager.getCurrentlySelectedTableView();

              torrentItem.getMenu().setData("TableView", tv);
              torrentItem.getMenu().setData("downloads", dm_final);
              torrentItem.getMenu().setData("is_detailed_view",
                  Boolean.valueOf(detailed_view_final));
              torrentItem.setEnabled(true);
            }
          }
        }
      });
View Full Code Here

    peers_table =  new DownloadPeerList(content);
    peers_table.setLayoutData(new GridData(GridData.FILL_BOTH));
   
    popup_menu = new Menu(peers_table);
   
    MenuItem column_setup = new MenuItem(popup_menu,SWT.NONE);
    column_setup.setText(_._("downloadinfowindow.tab.peerlist.menu.column_setup"));
    column_setup.setImage(SWTImageRepository.getImage("columns_setup.png"));
    column_setup.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        peers_table.showColumnEditorWindow();
      }
    });
  }
View Full Code Here

TOP

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

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.