当前位置: 首页>>代码示例>>Java>>正文


Java Button.addListener方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Button.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java Button.addListener方法的具体用法?Java Button.addListener怎么用?Java Button.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Button的用法示例。


在下文中一共展示了Button.addListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createButtonsForButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Create");
    ok.setEnabled(false);
    setButtonLayoutData(ok);

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> {
        function.setFunctionName(null);
        function.setPackageName(null);
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:18,代码来源:FunctionSWT.java

示例2: createButtonsForButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Apply");
    ok.setEnabled(false);
    setButtonLayoutData(ok);
    
    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> {
        if (futureTask != null && ! futureTask.isDone()) {
            futureTask.cancel(true);
        }
        code.setFunctionName(null);
        code.setFunctionGivenName(null);
        code.setResultType(null);
        code.setReturnedType(null);
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:23,代码来源:CodeSWT.java

示例3: createButtonsForButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Ok");
    ok.setEnabled(false);
    setButtonLayoutData(ok);
    ok.addListener(SWT.Selection, e -> pluginsBean.setPlugins(target));

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    cancel.setFocus();
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> pluginsBean.setPlugins(null));
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:17,代码来源:PluginsSWT.java

示例4: createButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected Control createButtonBar(Composite parent) {
    final Composite buttonBar = (Composite) super.createButtonBar(parent);

    logout = new Button(buttonBar, SWT.CENTER);
    final GridData layoutData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
    layoutData.widthHint = 100;
    logout.setLayoutData(layoutData);
    logout.setText("Log Out");
    logout.setVisible(credentials.isKeepLogged());
    logout.addListener(SWT.Selection, e -> {
        credentials.setApplication(null);
        credentials.setUserKey(false, null);
        close();
    });
    logout.moveAbove(super.buttonControl);

    return buttonBar;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:20,代码来源:ApplicationsSWT.java

示例5: createButtonsForButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Apply");
    ok.setEnabled(false);
    setButtonLayoutData(ok);
    
    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> {
        if (futureTask != null && ! futureTask.isDone()) {
            futureTask.cancel(true);
        }
        credentials.setApplication(null); 
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:20,代码来源:ApplicationsSWT.java

示例6: createDestinationGroup

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
/**
 * Create the export destination specification widgets
 */
protected void createDestinationGroup(Composite parent) {
	Font font = parent.getFont();
	// destination specification group
	Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(
			GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
	destinationSelectionGroup.setFont(font);

	Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
	destinationLabel.setText(getTargetLabel());
	destinationLabel.setFont(font);

	// destination name entry field
	destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE
			| SWT.BORDER);
	destinationNameField.addListener(SWT.Modify, this);
	destinationNameField.addListener(SWT.Selection, this);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	destinationNameField.setLayoutData(data);
	destinationNameField.setFont(font);

	// destination browse button
	destinationBrowseButton = new Button(destinationSelectionGroup,
			SWT.PUSH);
	destinationBrowseButton.setText(N4ExportMessages.DataTransfer_browse);
	destinationBrowseButton.addListener(SWT.Selection, this);
	destinationBrowseButton.setFont(font);
	setButtonLayoutData(destinationBrowseButton);

	// new Label(parent, SWT.NONE); // vertical spacer
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:40,代码来源:AbstractExportToSingleFileWizardPage.java

示例7: createControl

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
public void createControl(Composite parent) {
	initializeDialogUnits(parent);
	Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(new GridLayout());

	runNpmCheckbox = new Button(composite, SWT.CHECK | SWT.LEFT);
	runNpmCheckbox.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
	runNpmCheckbox.setText("Run npm tool for each project");
	runNpmCheckbox.setFont(parent.getFont());
	runNpmCheckbox.addListener(SWT.Selection, this);

	Label label = createPlainLabel(composite, "npm");
	label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));

	createOptionsGroup(composite);

	textProcessOut = new Text(composite, SWT.MULTI | SWT.READ_ONLY);
	textProcessOut.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	restoreWidgetValues();

	setControl(composite);

	// sync the page completion
	updatePageCompletion();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:NpmToolRunnerPage.java

示例8: createButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected Control createButtonBar(Composite parent) {
    final Composite buttonBar = (Composite) super.createButtonBar(parent);

    Button help = new Button(buttonBar, SWT.CENTER);
    final GridData layoutData = new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1);
    layoutData.widthHint = 100;
    help.setLayoutData(layoutData);
    help.setText("Help");
    help.addListener(SWT.Selection, e -> openURL(GLUON_DOWN_URL));
    help.moveAbove(buttonControl);
    
    return buttonBar;
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:15,代码来源:PluginsSWT.java

示例9: createButtonsForButtonBar

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button ok = getButton(IDialogConstants.OK_ID);
    ok.setText("Sign In");
    ok.setEnabled(false);
    setButtonLayoutData(ok);
    ok.addListener(SWT.Selection, e -> {
        disableDialog();

        futureTask = DialogUtils.supplyAsync(new AccountTask(userText.getText(), passwordText.getText()))
            .exceptionally(ex -> {
                ex.printStackTrace();
                restoreDialog(null); 
                return null;
            })
            .thenAccept(this::restoreDialog);
    });

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("Cancel");
    setButtonLayoutData(cancel);
    cancel.addListener(SWT.Selection, e -> {
        if (futureTask != null && ! futureTask.isDone()) {
            futureTask.cancel(true);
        }
        credentials.setUserKey(false, null);
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:31,代码来源:AccountSWT.java

示例10: createAppendMode

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
private void createAppendMode() {
	btnAppendRadioButton = new Button(this, SWT.RADIO);
	btnAppendRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnAppendRadioButton.setText(MessageUtil.getString("append_mode"));
	btnAppendRadioButton.setSelection(true);
	btnAppendRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnAppendRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_APPEND_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblAppendClassNameLabel = new Label(composite, SWT.NONE);
	lblAppendClassNameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblAppendClassNameLabel.setText("Class name");

	comboAppendClassnameViewer = new AncestorViewer(composite);
	comboAppendClassnameViewer.initialize(GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST, false);
	comboAppendClassnameViewer.getCombo().setData(GW4E_CONVERSION_WIDGET_ID, GW4E_CONVERSION_COMBO_ANCESTOR_APPEND_TEST);
	Combo combo = comboAppendClassnameViewer.getCombo();
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	combo.setEnabled(true);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:32,代码来源:GeneratorChoiceComposite.java

示例11: createNewMode

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
private void createNewMode() {
	btnCreateNewRadioButton = new Button(this, SWT.RADIO);
	btnCreateNewRadioButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	btnCreateNewRadioButton.setText(MessageUtil.getString("standalone_mode"));
	btnCreateNewRadioButton.setSelection(false);
	btnCreateNewRadioButton.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event e) {
			switch (e.type) {
			case SWT.Selection:
				updateUI();
				break;
			}
		}
	});
	btnCreateNewRadioButton.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_CHECKBOX);

	Composite composite = new Composite(this, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 12, 1));
	composite.setLayout(new GridLayout(12, false));

	lblNewClassnameLabel = new Label(composite, SWT.NONE);
	lblNewClassnameLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	lblNewClassnameLabel.setText("Class name");
	lblNewClassnameLabel.setEnabled(false);

	newClassnameText = new Text(composite, SWT.BORDER);
	newClassnameText.setEnabled(false);
	newClassnameText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			listener.handleEvent(null);
		}
	});
	newClassnameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 8, 1));
	newClassnameText.setEnabled(false);
	newClassnameText.setData(GW4E_CONVERSION_WIDGET_ID, GW4E_NEWCLASS_TEXT);
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:37,代码来源:GeneratorChoiceComposite.java

示例12: GenericBooleanParameter

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
public GenericBooleanParameter(GenericParameterAdapter _adapter,
		Composite composite, final String _name, Boolean _defaultValue,
		String textKey, IAdditionalActionPerformer actionPerformer) {
	adapter = _adapter;
	name = _name;
	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);
	if (value != null) {
		checkBox.setGrayed(false);
		checkBox.setSelection(value);
	} else {
		checkBox.setGrayed(true);
		checkBox.setSelection(true);
	}

	checkBox.addListener(SWT.Selection, new Listener() {
		@Override
		public void handleEvent(Event event) {
			setSelected(checkBox.getSelection(), true);
		}
	});
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:29,代码来源:GenericBooleanParameter.java

示例13: DirectoryParameter

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
public
DirectoryParameter(
	final Composite pluginGroup,
	String			name,
	String			defaultValue )
{
 	super(name);
  	controls = new Control[2];

    sp = new StringParameter(pluginGroup, name, defaultValue);

    controls[0] = sp.getControl();
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    controls[0].setLayoutData(gridData);

    Button browse = new Button(pluginGroup, SWT.PUSH);
    ImageLoader.getInstance().setButtonImage(browse, getBrowseImageResource());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));

    browse.addListener(SWT.Selection, new Listener() {
      @Override
      public void handleEvent(Event event) {
    	  String path = DirectoryParameter.this.openDialog(pluginGroup.getShell(), sp.getValue());
    	  if (path != null) {
    		  sp.setValue(path);
    	  }
      }
    });
    controls[1] = browse;
  }
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:31,代码来源:DirectoryParameter.java

示例14: RadioParameter

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
public RadioParameter(Composite composite, final String sConfigName, final int iButtonValue,
                      IAdditionalActionPerformer actionPerformer) {
	super(sConfigName);
  if ( actionPerformer != null ){
    performers.add( actionPerformer );
  }
  int iDefaultValue = COConfigurationManager.getIntParameter(sConfigName);

  radioButton = new Button(composite, SWT.RADIO);
  radioButton.setSelection(iDefaultValue == iButtonValue);
  radioButton.addListener(SWT.Selection, new Listener() {
    @Override
    public void handleEvent(Event event) {
      boolean selected = radioButton.getSelection();
      if (selected)
        COConfigurationManager.setParameter(sConfigName, iButtonValue);

      if (performers.size() > 0 ) {
        for (int i = 0;i < performers.size(); i++) {
          IAdditionalActionPerformer  performer = (IAdditionalActionPerformer)performers.get(i);

          performer.setSelected(selected);
          performer.performAction();
        }
      }
    }
  });
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:29,代码来源:RadioParameter.java

示例15: createDialogArea

import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);

    GridLayout layout = new GridLayout(2, false);
    layout.marginRight = 5;
    layout.marginLeft = 10;
    layout.marginTop = 10;
    container.setLayout(layout);

    TMTreeViewerDataSource dataSource = treeViewer.getDataSource();

    int columnsCount = dataSource.numberOfColumns();
    for (int i = 0; i < columnsCount; i++) {
        final int columnIndex = i;
        Button checkBoxButton = new Button(container, SWT.CHECK);
        checkBoxButton.setText(dataSource.columnTitleForColumnIndex(columnIndex));
        checkBoxButton.setSelection(!collapsedColumnsIndexes.contains(columnIndex));
        checkBoxButton.addListener(SWT.Selection, event -> {
            if (collapsedColumnsIndexes.contains(columnIndex)) {
                collapsedColumnsIndexes.remove(columnIndex);
            } else {
                collapsedColumnsIndexes.add(columnIndex);
            }
        });
    }

    return container;
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:30,代码来源:TMTreeViewerColumnsDialog.java


注:本文中的org.eclipse.swt.widgets.Button.addListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。