Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.SelectionAdapter


    label.setText("Register as new application:");
    _chkCreateContentStore = new Button(_container, SWT.CHECK);
    _chkCreateContentStore.setText("yes");
    _chkCreateContentStore.setSelection(true);
   
    _chkCreateContentStore.addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent e) {
        super.widgetSelected(e);
        _grpCreateContentStore.setVisible(!_grpCreateContentStore.isVisible());
View Full Code Here


    _tmplFile.setLayoutData(txtStyle);
    _tmplFile.addModifyListener(this);

    _btnBrowse = new Button(composite, SWT.PUSH);
    _btnBrowse.setText("...");
    _btnBrowse.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowse();
      }
    });
View Full Code Here

       
    new MenuItem(parent, SWT.SEPARATOR);

    final MenuItem itemDownSpeedManual = new MenuItem(parent, SWT.PUSH);
    Messages.setLanguageText(itemDownSpeedManual, "MyTorrentsView.menu.manual");
    itemDownSpeedManual.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        String kbps_str = MessageText.getString("MyTorrentsView.dialog.setNumber.inKbps",
            new String[]{ DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB ) });

        SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow();
View Full Code Here

      item.setChecked(checked);
    }
    column.pack();
   
    // Update table when list selection changes
    listLogTypes.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        int index = listLogTypes.getSelectionIndex();
        if (index < 0 || index >= logTypes.length)
          return;
        TableItem[] items = tableLogIDs.getItems();
        for (int i = 0; i < items.length; i++) {
          boolean checked = COConfigurationManager.getBooleanParameter(
              "bLog." + logTypes[index] + "." + items[i].getData(),
              true);
          items[i].setChecked(checked);

        }
      }
    });
   
    // Save config when checkbox is clicked
    tableLogIDs.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        if (e.detail != SWT.CHECK)
          return;
        int index = listLogTypes.getSelectionIndex();
        if (index < 0 || index >= logTypes.length)
View Full Code Here

        Button show_folder_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( show_folder_button, "MyTorrentsView.menu.explore");
        
         show_folder_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent e )
             {
               ManagerUtils.open( option_file );
             }
           });

         label = new Label(gJVM, SWT.NULL);     
        Messages.setLanguageText(label, "jvm.reset");

        Button reset_button = new Button( gJVM, SWT.PUSH );
       
         Messages.setLanguageText( reset_button, "Button.reset");
        
         reset_button.addSelectionListener(
           new SelectionAdapter()
           {
             public void
             widgetSelected(
               SelectionEvent event )
             {
View Full Code Here

    }

     final MenuItem itemPositionManual = new MenuItem(menuAdvanced, SWT.PUSH);
    Messages.setLanguageText(itemPositionManual,
        "MyTorrentsView.menu.reposition.manual");
    itemPositionManual.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow(
            "MyTorrentsView.dialog.setPosition.title",
            "MyTorrentsView.dialog.setPosition.text");
        entryWindow.prompt(new UIInputReceiverListener() {
View Full Code Here

    String menu_key = "MyTorrentsView.menu.manual";
    if (num_entries > 1) {menu_key += (isTorrentContext?".per_torrent":".per_peer" );}

    final MenuItem itemDownSpeedManualSingle = new MenuItem(menuDownSpeed, SWT.PUSH);
    Messages.setLanguageText(itemDownSpeedManualSingle, menu_key);
    itemDownSpeedManualSingle.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        int speed_value = getManualSpeedValue(shell, true);
        if (speed_value > 0) {adapter.setDownSpeed(speed_value);}
      }
    });
   
    if (num_entries > 1) {
      final MenuItem itemDownSpeedManualShared = new MenuItem(menuDownSpeed, SWT.PUSH);
      Messages.setLanguageText(itemDownSpeedManualShared, isTorrentContext?"MyTorrentsView.menu.manual.shared_torrents":"MyTorrentsView.menu.manual.shared_peers");
      itemDownSpeedManualShared.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          int speed_value = getManualSharedSpeedValue(shell, true, num_entries);
          if (speed_value > 0) {adapter.setDownSpeed(speed_value);}
        }
      });
    }
   
    // advanced >Upload Speed Menu //
    final MenuItem itemUpSpeed = new MenuItem(menuAdvanced, SWT.CASCADE);
    Messages.setLanguageText(itemUpSpeed, "MyTorrentsView.menu.setUpSpeed"); //$NON-NLS-1$
    Utils.setMenuItemImage(itemUpSpeed, "speed");

    final Menu menuUpSpeed = new Menu(shell, SWT.DROP_DOWN);
    itemUpSpeed.setMenu(menuUpSpeed);

    final MenuItem itemCurrentUpSpeed = new MenuItem(menuUpSpeed, SWT.PUSH);
    itemCurrentUpSpeed.setEnabled(false);
    separator = "";
    speedText = new StringBuffer();
    //itemUpSpeed.                  
    if (upSpeedDisabled) {
      speedText.append(MessageText
          .getString("MyTorrentsView.menu.setSpeed.disabled"));
      separator = " / ";
    }
    if (upSpeedUnlimited) {
      speedText.append(separator);
      speedText.append(MessageText
          .getString("MyTorrentsView.menu.setSpeed.unlimited"));
      separator = " / ";
    }
    if (totalUpSpeed > 0) {
      speedText.append(separator);
      speedText.append(DisplayFormatters
          .formatByteCountToKiBEtcPerSec(totalUpSpeed));
    }
    itemCurrentUpSpeed.setText(speedText.toString());

    // ---
    new MenuItem(menuUpSpeed, SWT.SEPARATOR);

    final MenuItem itemsUpSpeed[] = new MenuItem[12];
    Listener itemsUpSpeedListener = new Listener() {
      public void handleEvent(Event e) {
        if (e.widget != null && e.widget instanceof MenuItem) {
          MenuItem item = (MenuItem) e.widget;
          int speed = item.getData("maxul") == null ? 0 : ((Integer) item
              .getData("maxul")).intValue();
          adapter.setUpSpeed(speed);
        }
      }
    };

    itemsUpSpeed[1] = new MenuItem(menuUpSpeed, SWT.PUSH);
    Messages.setLanguageText(itemsUpSpeed[1],
        "MyTorrentsView.menu.setSpeed.unlimit");
    itemsUpSpeed[1].setData("maxul", new Integer(0));
    itemsUpSpeed[1].addListener(SWT.Selection, itemsUpSpeedListener);

    if (hasSelection) {
      //using 75KiB/s as the default limit when no limit set.
      if (maxUpload == 0){
        maxUpload = 75 * 1024;
      }else{
        if ( upSpeedSetMax == 0 ){
          maxUpload = 200 * 1024;
        }else{
          maxUpload = 4 * ( upSpeedSetMax/1024 ) * 1024;
        }
      }
      for (int i = 2; i < 12; i++) {
        itemsUpSpeed[i] = new MenuItem(menuUpSpeed, SWT.PUSH);
        itemsUpSpeed[i].addListener(SWT.Selection, itemsUpSpeedListener);

        int limit = (int)( maxUpload / (10 * num_entries) * (12 - i));
        StringBuffer speed = new StringBuffer();
        speed.append(DisplayFormatters.formatByteCountToKiBEtcPerSec(limit
            * num_entries));
        if (num_entries > 1) {
          speed.append(" ");
          speed.append(MessageText
              .getString("MyTorrentsView.menu.setSpeed.in"));
          speed.append(" ");
          speed.append(num_entries);
          speed.append(" ");
          speed.append(MessageText
              .getString("MyTorrentsView.menu.setSpeed.slots"));
          speed.append(" ");
          speed
              .append(DisplayFormatters.formatByteCountToKiBEtcPerSec(limit));
        }

        itemsUpSpeed[i].setText(speed.toString());
        itemsUpSpeed[i].setData("maxul", new Integer(limit));
      }
    }

    new MenuItem(menuUpSpeed, SWT.SEPARATOR);

    final MenuItem itemUpSpeedManualSingle = new MenuItem(menuUpSpeed, SWT.PUSH);
    Messages.setLanguageText(itemUpSpeedManualSingle, menu_key);
    itemUpSpeedManualSingle.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        int speed_value = getManualSpeedValue(shell, false);
        if (speed_value > 0) {adapter.setUpSpeed(speed_value);}
      }
    });
   
    if (num_entries > 1) {
      final MenuItem itemUpSpeedManualShared = new MenuItem(menuUpSpeed, SWT.PUSH);
      Messages.setLanguageText(itemUpSpeedManualShared, isTorrentContext?"MyTorrentsView.menu.manual.shared_torrents":"MyTorrentsView.menu.manual.shared_peers" );
      itemUpSpeedManualShared.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          int speed_value = getManualSharedSpeedValue(shell, false, num_entries);
          if (speed_value > 0) {adapter.setUpSpeed(speed_value);}
        }
      });
View Full Code Here

          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

    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

    s.setSize(500,500);
    s.layout();
   
    Utils.centreWindow(s);
    ok.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        //abandonSelection(s);
        setSelectedIndex(s, table, checkBox, candidates,selected_candidate);
        s.dispose();
      }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.events.SelectionAdapter

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.