Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Button


    final Group gRadio = new Group(cMode, SWT.WRAP);
    Messages.setLanguageText(gRadio, "ConfigView.section.mode.title");
    gRadio.setLayoutData(gridData);
    gRadio.setLayout(new RowLayout(SWT.HORIZONTAL));

    Button button0 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button0, "ConfigView.section.mode.beginner");
    button0.setData("iMode", "0");
    button0.setData("sMode", "beginner.text");
   
    Button button1 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button1, "ConfigView.section.mode.intermediate");
    button1.setData("iMode", "1");
    button1.setData("sMode", "intermediate.text");
   
    Button button2 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button2, "ConfigView.section.mode.advanced");
    button2.setData("iMode", "2");
    button2.setData("sMode", "advanced.text");
   
    if ( userMode == 0) {
      initsMode = "beginner.text";
      button0.setSelection(true);
    } else if ( userMode == 1) {
      initsMode = "intermediate.text";
      button1.setSelection(true);
    } else {
      initsMode = "advanced.text";
      button2.setSelection(true);
    }

   
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final Label label = new Label(cMode, SWT.WRAP);
    gridData.horizontalSpan = 4;
    label.setLayoutData(gridData);
  text[0] = MessageText.getString("ConfigView.section.mode." + initsMode);
  label.setText(text[0]);
  label.addListener (SWT.Selection, new Listener () {
    public void handleEvent(Event event) {
      Utils.launch(event.text);
    }
  });
 
  Group gWiki = new Group(cMode, SWT.WRAP);
    gridData = new GridData();
    gridData.widthHint = 350;
    gWiki.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 1;
    gWiki.setLayout(layout);
   
    gWiki.setText(MessageText.getString("Utils.link.visit"));

      final Label linkLabel = new Label(gWiki, SWT.NULL);
      linkLabel.setText( MessageText.getString( messTexts[userMode] ) );
      linkLabel.setData( links[userMode] );
      linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
      linkLabel.setForeground(Colors.blue);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      linkLabel.setLayoutData( gridData );
      linkLabel.addMouseListener(new MouseAdapter() {
        public void mouseDoubleClick(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
        public void mouseUp(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
      });
     
      final Label linkLabel1 = new Label(gWiki, SWT.NULL);
      linkLabel1.setText( (userMode == 1)?MessageText.getString(messTexts[3]):"");
      linkLabel1.setData( links[3] );
      linkLabel1.setCursor(linkLabel1.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
      linkLabel1.setForeground(Colors.blue);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      linkLabel1.setLayoutData( gridData );
      linkLabel1.addMouseListener(new MouseAdapter() {
        public void mouseDoubleClick(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
        public void mouseUp(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
      });

   
    Listener radioGroup = new Listener () {
      public void handleEvent (Event event) {
       
        Control [] children = gRadio.getChildren ();
       
        for (int j=0; j<children.length; j++) {
           Control child = children [j];
           if (child instanceof Button) {
             Button button = (Button) child;
             if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
           }
        }

        Button button = (Button) event.widget;
        button.setSelection (true);
        int mode = Integer.parseInt((String)button.getData("iMode"));
        text[0] = MessageText.getString("ConfigView.section.mode." + (String)button.getData("sMode"));
        label.setText(text[0]);
        linkLabel.setText( MessageText.getString(messTexts[mode]) );
        linkLabel.setData( links[mode] );
        if(mode == 1){
          linkLabel1.setText( MessageText.getString(messTexts[3]) );
          linkLabel1.setData( links[3] );
        } else{
          linkLabel1.setText( "" );
          linkLabel1.setData( "" );
        }
        COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
        }
    };
   
    button0.addListener (SWT.Selection, radioGroup);
    button1.addListener (SWT.Selection, radioGroup);
    button2.addListener (SWT.Selection, radioGroup);

    Label padding = new Label(cMode, SWT.NULL );
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    padding.setLayoutData( gridData );
   
      // reset to defaults
   
  Composite gReset = new Composite(cMode, SWT.WRAP);
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    gReset.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gReset.setLayout(layout);

    Label reset_label = new Label(gReset, SWT.NULL );
    Messages.setLanguageText(reset_label, "ConfigView.section.mode.resetdefaults" );
   
    Button reset_button = new Button(gReset, SWT.PUSH);

    Messages.setLanguageText(reset_button, "Button.reset" );

    reset_button.addListener(SWT.Selection,
    new Listener()
    {
          public void
      handleEvent(Event event)
          {
View Full Code Here


    });
    file.setText(((NewTorrentWizard) wizard).singlePath);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    file.setLayoutData(gridData);
   
    Button browse = new Button(panel, SWT.PUSH);
    browse.addListener(SWT.Selection, new Listener() {
      /*
       * (non-Javadoc)
       *
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
 
View Full Code Here

   
    label = new Label(shell,SWT.WRAP);
   
    combo = new Combo(shell,SWT.READ_ONLY);
   
    Button ok = new Button(shell,SWT.PUSH);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
       result = combo.getText();
       shell.dispose();      
      }
    });
    ok.setText(MessageText.getString("Button.ok"));
   
    Button cancel = new Button(shell,SWT.PUSH);
    cancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
       
        result = null;
      
       shell.dispose();      
      }
    });
    cancel.setText(MessageText.getString("Button.cancel"));
   
   
    shell.addListener(SWT.Dispose,new Listener() {
      public void handleEvent(Event arg0) {
      }
    });
   
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.heightHint = 30;
    label.setLayoutData(data);
   
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    combo.setLayoutData(data);
       
    data = new GridData();
    data.widthHint = 80;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    data.verticalAlignment = SWT.END;
    data.horizontalAlignment = SWT.END;
    ok.setLayoutData(data);
   
    data = new GridData();
    data.grabExcessVerticalSpace = true;
    data.verticalAlignment = SWT.END;
    data.widthHint = 80;   
    cancel.setLayoutData(data);
   
    shell.setSize(300,150);
    shell.layout();
   
    Utils.centerWindowRelativeTo(shell,parentShell);
View Full Code Here

    gLayout.marginWidth = 25;
    gLayout.marginTop = 0;
    gLayout.marginBottom = 0;
    toolbarPanel.setLayout(gLayout);

    final Button autoClearButton = new Button(toolbarPanel, SWT.CHECK);
    autoClearButton.setText(MessageText.getString("Progress.reporting.window.remove.auto"));
    autoClearButton.setToolTipText(MessageText.getString("Progress.reporting.window.remove.auto.tooltip"));
    autoClearButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER,
        false, false));

    autoClearButton.setSelection(COConfigurationManager.getBooleanParameter("auto_remove_inactive_items"));

    Label dummy = new Label(toolbarPanel, SWT.NONE);
    dummy.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    final Button clearInActiveButton = new Button(toolbarPanel, SWT.NONE);
    clearInActiveButton.setText(MessageText.getString("Progress.reporting.window.remove.now"));
    clearInActiveButton.setToolTipText(MessageText.getString("Progress.reporting.window.remove.now.tooltip"));
    clearInActiveButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false,
        false));
    clearInActiveButton.setEnabled(!COConfigurationManager.getBooleanParameter("auto_remove_inactive_items"));

    /*
     * Toggles the checked state of auto remove
     */
    autoClearButton.addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        COConfigurationManager.setParameter("auto_remove_inactive_items",
            autoClearButton.getSelection());

        /*
         * Disable clearInActiveButton if auto remove is checked
         */
        clearInActiveButton.setEnabled(!autoClearButton.getSelection());

        isAutoRemove = autoClearButton.getSelection();

        /*
         * Removes any inactive panels that may already be in the window if this option is set to true
         */
        if (true == isAutoRemove) {
          removeInActivePanels();
        }

      }

      public void widgetDefaultSelected(SelectionEvent e) {
        widgetSelected(e);
      }

    });

    /*
     * Remove inactive when clicked
     */
    clearInActiveButton.addSelectionListener(new SelectionListener() {
      public void widgetSelected(SelectionEvent e) {
        removeInActivePanels();
      }

      public void widgetDefaultSelected(SelectionEvent e) {
View Full Code Here

    layout.numColumns = 3;
    panel.setLayout(layout);       
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    panel.setLayoutData(gridData);
    Button ok = new Button(panel, SWT.PUSH);
    ok.setText(MessageText.getString("Button.ok"));
    gridData = new GridData();
    gridData.widthHint = 70;
    ok.setLayoutData(gridData);
    shell.setDefaultButton(ok);
    ok.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        try {
          for ( DownloadManager dm: dms ){
            TOTorrent  torrent = dm.getTorrent();
           
            if ( torrent != null ){
           
              TorrentUtils.announceGroupsInsertFirst( torrent, url.getText());
           
              TorrentUtils.writeToFile( torrent );
           
              TRTrackerAnnouncer announcer = dm.getTrackerClient();
             
              if ( announcer != null ){
           
                announcer.resetTrackerUrl(false);
              }
            }
          }
         
          shell.dispose();
        }
        catch (Exception e) {
          Debug.printStackTrace( e );
        }
      }
    });

    Button cancel = new Button(panel, SWT.PUSH);
    cancel.setText(MessageText.getString("Button.cancel"));
    gridData = new GridData();
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        shell.dispose();
View Full Code Here

    // default is shared installation
 
  ((InstallPluginWizard) wizard).shared = true;

  Button bSharedMode = new Button(panel,SWT.RADIO);
  Messages.setLanguageText(bSharedMode,"installPluginsWizard.installMode.shared");
  bSharedMode.setData("mode",new Integer(MODE_SHARED));
  bSharedMode.setSelection(true);
  GridData data = new GridData(GridData.FILL_VERTICAL);
  data.verticalAlignment = GridData.VERTICAL_ALIGN_END;
  bSharedMode.setLayoutData(data);
 
 
  Button bUserMode = new Button(panel,SWT.RADIO);
  Messages.setLanguageText(bUserMode,"installPluginsWizard.installMode.user");
  bUserMode.setData("mode",new Integer(MODE_USER));
  data = new GridData(GridData.FILL_VERTICAL);
  data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
  bUserMode.setLayoutData(data);
 
 
  Listener modeListener = new Listener() {
    public void handleEvent(Event e) {
      ((InstallPluginWizard) wizard).shared = ((Integer) e.widget.getData("mode")).intValue() == MODE_SHARED;
    }
  };

  bUserMode.addListener(SWT.Selection,modeListener);
  bSharedMode.addListener(SWT.Selection,modeListener);
  }
View Full Code Here

    gridData.widthHint = 150;
    final StringParameter pathParameter = new StringParameter(gStats, "Stats Dir", ""); //$NON-NLS-1$ //$NON-NLS-2$
    pathParameter.setLayoutData(gridData);
    controls[0] = lStatsPath;
    controls[1] = pathParameter.getControl();
    Button browse = new Button(gStats, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
    controls[2] = browse;
    browse.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
View Full Code Here

    FormData formData;
   
      // text blocked area
   
    final StyledText textBlocked = new StyledText(window,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    Button btnClear = new Button(window,SWT.PUSH);
    textBlocked.setEditable(false);
   
    final StyledText textBanned = new StyledText(window,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    Button btnOk = new Button(window,SWT.PUSH);
    Button btnReset = new Button(window,SWT.PUSH);
    textBanned.setEditable(false);
   
           
    formData = new FormData();
    formData.left = new FormAttachment(0,0);
    formData.right = new FormAttachment(100,0);
    formData.top = new FormAttachment(0,0);  
    formData.bottom = new FormAttachment(40,0);  
    textBlocked.setLayoutData(formData);
    textBlocked.setText(ipsBlocked);
   
   
    // label blocked area
   
    Label  blockedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(blockedInfo,"ConfigView.section.ipfilter.blockedinfo");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(btnClear);   
    formData.left = new FormAttachment(0,0);   
    blockedInfo.setLayoutData( formData );
      // clear button
   
   
    Messages.setLanguageText(btnClear,"Button.clear");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(95,0 );   
    //formData.bottom = new FormAttachment(textBanned);
    formData.width = 70;
    btnClear.setLayoutData(formData);
    btnClear.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
    
      azureus_core.getIpFilterManager().getIPFilter().clearBlockedIPs();
     
      textBlocked.setText( "" );
    }
    });
   
   
      // text banned area
    formData = new FormData();
    formData.left = new FormAttachment(0,0);
    formData.right = new FormAttachment(100,0);
    formData.top = new FormAttachment(btnClear);  
    formData.bottom = new FormAttachment(btnOk);  
    textBanned.setLayoutData(formData);
    textBanned.setText(ipsBanned);
   
      // label banned area
   
    Label  bannedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(bannedInfo,"ConfigView.section.ipfilter.bannedinfo");
    formData = new FormData();
    formData.right = new FormAttachment(btnReset);   
    formData.left = new FormAttachment(0,0);   
    formData.bottom = new FormAttachment(100,0)
    bannedInfo.setLayoutData( formData );
   
      // reset button
   
    Messages.setLanguageText(btnReset,"Button.reset");
    formData = new FormData();
    formData.right = new FormAttachment(btnOk);   
    formData.bottom = new FormAttachment(100,0);   
    formData.width = 70;
    btnReset.setLayoutData(formData);
    btnReset.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
      azureus_core.getIpFilterManager().getIPFilter().clearBannedIps();
      azureus_core.getIpFilterManager().getBadIps().clearBadIps();
   
View Full Code Here

    defaultValue = _defaultValue;
    if (actionPerformer != null) {
      performers.add(actionPerformer);
    }
    boolean value = adapter.getBooleanValue(name, defaultValue);
    checkBox = new Button(composite, SWT.CHECK);
    if (textKey != null)
      Messages.setLanguageText(checkBox, textKey);
    checkBox.setSelection(value);

    checkBox.addListener(SWT.Selection, new Listener() {
View Full Code Here

        layout = new RowLayout();
        layout.center = true;
        right.setLayout(layout);

       
        _btnDirectAccess = new Button(right, SWT.CHECK);
        _btnDirectAccess.setText("direct access");
       

        boolean isDirectAccess = false;
        try {
            isDirectAccess = WGADesignStructureHelper.isDirectAccess(getInputFile());
        }
        catch (Exception e1) {           
        }  
       
        _btnDirectAccess.setSelection(isDirectAccess);
        if (hasMDHeader()) {
            _btnDirectAccess.setEnabled(false);
        } else {
            _btnDirectAccess.setEnabled(true);
        }
       
        _btnDirectAccess.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                if (_tmlFileModel != null) {
                    _tmlFileModel.setDirectAccess(_btnDirectAccess.getSelection());
                    _dirty = true;
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                }
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
       
        _btnOpenInBrowser = new Button(right, SWT.PUSH);
        _btnOpenInBrowser.setText("open in browser");
        if (isDirectAccess) {
            _btnOpenInBrowser.setEnabled(true);
        } else {
            _btnOpenInBrowser.setEnabled(false);
View Full Code Here

TOP

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

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.