org.eclipse.swt.widgets.Button#setSelection ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.Button#setSelection ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: slr-toolkit   文件: SingleChoiceQuestionView.java
@Override
protected List<Control> renderControls() {
    List<Control> controls = new LinkedList<>();
    for (String choice : question.getChoices()) {
        Button btn = new Button(root, SWT.RADIO);
        btn.setText(choice);
        btn.setSelection(choice.equals(question.getAnswer(document)));
        btn.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
                question.addAnswer(document, choice);
                onQuestionChanged.accept(question);
            }
        });
        controls.add(btn);
    }
    return controls;
}
 
源代码2 项目: olca-app   文件: JsonImportPage.java
@Override
public void createControl(Composite parent) {
	Composite body = new Composite(parent, SWT.NONE);
	UI.gridLayout(body, 1);
	Group group = new Group(body, SWT.NONE);
	group.setText("Update mode");
	UI.gridData(group, true, false);
	UI.gridLayout(group, 1);
	for (UpdateMode mode : mods) {
		Button option = new Button(group, SWT.RADIO);
		option.setText(getText(mode));
		option.setSelection(mode == updateMode);
		Controls.onSelect(option, (e) -> {
			updateMode = mode;
		});
	}
	setControl(body);
}
 
/**
 * Creates {@link Button} element for page container
 * 
 * @param container
 *            container for which element is set
 * @param label
 *            label for the GUI element
 * @return {@link Text}
 */
private Button prepareCheckboxGUI(Composite container, String labelText, int horizontalSpan, boolean checked) {
	Button guiElement = new Button(container, SWT.CHECK);
	guiElement.setText(labelText);
	guiElement.setSelection(checked);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = horizontalSpan;
	guiElement.setLayoutData(gd);
	guiElement.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			dialogChanged();
		}
	});
	return guiElement;
}
 
源代码4 项目: tracecompass   文件: RemoteFetchLogWizardPage.java
@Override
protected void createOptionsGroupButtons(Group optionsGroup) {
    // Overwrite checkbox
    fOverwriteExistingResourcesCheckbox = new Button(optionsGroup, SWT.CHECK);
    fOverwriteExistingResourcesCheckbox.setFont(optionsGroup.getFont());
    fOverwriteExistingResourcesCheckbox.setText(Messages.ImportTraceWizard_OverwriteExistingTrace);
    fOverwriteExistingResourcesCheckbox.setSelection(false);
    fOverwriteExistingResourcesCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            updateNextPage();
            setPageComplete(fProfile != null);
        }
    });

    updateWidgetEnablements();
}
 
源代码5 项目: birt   文件: OptionsConfigurationBlock.java
protected Button addCheckBox( Composite parent, String label, Key key,
		String[] values, int indent )
{
	ControlData data = new ControlData( key, values );

	GridData gd = new GridData( GridData.HORIZONTAL_ALIGN_FILL );
	gd.horizontalSpan = 3;
	gd.horizontalIndent = indent;

	Button checkBox = new Button( parent, SWT.CHECK );
	checkBox.setFont( JFaceResources.getDialogFont( ) );
	checkBox.setText( label );
	checkBox.setData( data );
	checkBox.setLayoutData( gd );
	checkBox.addSelectionListener( getSelectionListener( ) );

	String currValue = getValue( key );
	checkBox.setSelection( data.getSelection( currValue ) == 0 );

	fCheckBoxes.add( checkBox );

	updateCheckBox( checkBox );

	return checkBox;
}
 
源代码6 项目: birt   文件: ExcelDataSourcePageHelper.java
/**
 * 
 * @param composite
 */
private void setupColumnNameLineCheckBox( Composite composite )
{
	Label labelFill = new Label( composite, SWT.NONE );
	labelFill.setText( "" ); //$NON-NLS-1$

	columnNameLineCheckBox = new Button( composite, SWT.CHECK );
	columnNameLineCheckBox.setToolTipText( Messages.getString( "tooltip.columnnameline" ) ); //$NON-NLS-1$
	GridData gd = new GridData( );
	gd.horizontalSpan = 3;
	columnNameLineCheckBox.setLayoutData( gd );
	columnNameLineCheckBox.setText( Messages.getString( "label.includeColumnNameLine" ) ); //$NON-NLS-1$
	columnNameLineCheckBox.setSelection( true );
	columnNameLineCheckBox.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			if ( columnNameLineCheckBox.getSelection( ) )
				typeLineCheckBox.setEnabled( true );
			else
			{
				typeLineCheckBox.setSelection( false );
				typeLineCheckBox.setEnabled( false );
			}
		}
	} );

}
 
源代码7 项目: texlipse   文件: BuilderSettingsPreferencePage.java
/**
 * Add "Parse .aux files" -checkbox.
 * @param contents parent component
 */
private void addAuxParserCheckBox(Composite contents) {
    Composite checkField = new Composite(contents, SWT.NULL);
    GridData checkData = new GridData(GridData.FILL_HORIZONTAL);
    checkData.horizontalSpan = 2;
    checkField.setLayoutData(checkData);
    GridLayout checkLay = new GridLayout();
    checkLay.numColumns = 2;
    checkField.setLayout(checkLay);
    
    auxParserCheckBox = new Button(checkField, SWT.CHECK);
    auxParserCheckBox.setLayoutData(new GridData());
    auxParserCheckBox.setText(TexlipsePlugin.getResourceString("preferenceBuilderAuxParser"));
    auxParserCheckBox.setSelection(getPreferenceStore().getBoolean(TexlipseProperties.BUILDER_PARSE_AUX_FILES));
}
 
源代码8 项目: xds-ide   文件: TabPageIndentation.java
private Control addSettingControl(Composite parent, FormatterProfile.IndentSetting bs, String label) {
    if (bs.isRange()) {
        Button cbox = null;
        if (bs.isRangeWithCheckbox()) {
            cbox = SWTFactory.createCheckbox(parent, label, 1);
        } else {
            SWTFactory.createLabel(parent, label, 1);
        }
        Combo cmb = SWTFactory.createCombo(parent, 1, SWT.DROP_DOWN | SWT.READ_ONLY, GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END);
        for (int i=bs.getMinVal(); i<=bs.getMaxVal(); ++i) {
            cmb.add(""+i); //$NON-NLS-1$
        }
        cmb.select(fp.getValueForDialog(bs) - bs.getMinVal());
        SettingSelectionListener ssl = new SettingSelectionListener(cmb, cbox, bs);
        cmb.addSelectionListener(ssl);
        if (cbox != null) {
            boolean unch = fp.getRangeCheckboxUncheckedState(bs);
            cbox.setSelection(!unch);
            cmb.setEnabled(!unch);
            cbox.addSelectionListener(ssl);
        }
        return cmb;
    } else {
        Button cb = SWTFactory.createCheckbox(parent, label, 2);
        cb.setSelection(fp.getAsBoolean(bs));
        cb.addSelectionListener(new SettingSelectionListener(cb, null, bs));
        
        GridData gd = (GridData)cb.getLayoutData();
        gd.heightHint = prefHeight;
        cb.setLayoutData(gd);
        
        return cb;
    }
}
 
源代码9 项目: nebula   文件: RadioGroupTest.java
private void simulateClick(RadioItem item) {
	simulateDeselect(group.getSelection());

	Button button = item.getButton();
	button.setSelection(true);
	button.notifyListeners(SWT.Selection, null);
}
 
protected final void performLimitToSelectionChanged(Button button) {
	if (button.getSelection()) {
		for (int i= 0; i < fLimitTo.length; i++) {
			Button curr= fLimitTo[i];
			if (curr != button) {
				curr.setSelection(false);
			}
		}
	}
	updateUseJRE();
}
 
/**
 * Create the export option group.
 *
 * @param parent
 *            the parent composite
 */
protected void createOptionsGroup(Composite parent) {
	Composite optionsGroup= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	optionsGroup.setLayout(layout);

	fExportStructural= new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
	fExportStructural.setText(JarPackagerMessages.JarRefactoringDialog_export_structural);
	fExportStructural.setSelection(fData.isExportStructuralOnly());
}
 
@Override
protected Composite doCreatePreviewPane(Composite composite, int numColumns) {

	createLabel(numColumns - 1, composite, FormatterMessages.ModifyDialogTabPage_preview_label_text);

	fShowInvisibleButton= new Button(composite, SWT.CHECK);
	fShowInvisibleButton.setText(FormatterMessages.FormatterTabPage_ShowInvisibleCharacters_label);
	fShowInvisibleButton.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, false));
	fShowInvisibleButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			fPreview.showInvisibleCharacters(fShowInvisibleButton.getSelection());
			fDialogSettings.put(SHOW_INVISIBLE_PREFERENCE_KEY, fShowInvisibleButton.getSelection());
			doUpdatePreview();
		}
	});
	fShowInvisibleButton.setSelection(isShowInvisible());

	fPreview= doCreateJavaPreview(composite);
	fDefaultFocusManager.add(fPreview.getControl());
	fPreview.showInvisibleCharacters(fShowInvisibleButton.getSelection());

	final GridData gd= createGridData(numColumns, GridData.FILL_BOTH, 0);
	gd.widthHint= 0;
	gd.heightHint=0;
	fPreview.getControl().setLayoutData(gd);

	return composite;
}
 
protected static void restoreSelection(Object value, Button button) {
	if (((Boolean) value).booleanValue() != button.getSelection())
		button.setSelection(((Boolean) value).booleanValue());
}
 
源代码14 项目: slr-toolkit   文件: SeriesPagePie.java
public SeriesPagePie(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	compositeFirst = new Composite(this, SWT.NONE);
	compositeFirst.setLayout(new GridLayout(2, false));
	compositeFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	
	btnNewButton = new Button(compositeFirst, SWT.NONE);
	btnNewButton.setText("Select Term");
	
	lblSelectedTermIs = new Label(compositeFirst, SWT.CENTER);
	GridData gd_lblSelectedTermIs = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblSelectedTermIs.widthHint = 367;
	lblSelectedTermIs.setLayoutData(gd_lblSelectedTermIs);
	lblSelectedTermIs.setText("No Term Selected");
	btnNewButton.addSelectionListener(this);
	
	
	
	Composite compositeCentre = new Composite(this, SWT.NONE);
	compositeCentre.setLayout(new GridLayout(1, false));
	compositeCentre.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
	
	list = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1);
	gd_list.widthHint = 400;
	list.setLayoutData(gd_list);
	list.setBounds(0, 0, 71, 68);
	list.addSelectionListener(this);
	
	Composite compositeNorth = new Composite(this, SWT.NONE);
	compositeNorth.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	FillLayout fl_compositeNorth = new FillLayout(SWT.HORIZONTAL);
	fl_compositeNorth.marginWidth = 5;
	fl_compositeNorth.spacing = 5;
	compositeNorth.setLayout(fl_compositeNorth);
	
	lblColor = new Label(compositeNorth, SWT.NONE);
	lblColor.setText("Color:");
	
	btnRadioButtonGrey = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonGrey.setText("Grey");
	btnRadioButtonGrey.addSelectionListener(this);
	
	btnRadioButtonCustom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonCustom.setText("Custom");
	btnRadioButtonCustom.addSelectionListener(this);
	
	btnRadioButtonRandom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonRandom.setSelection(true);
	btnRadioButtonRandom.setText("Random");
	
	btnOneColor = new Button(compositeNorth, SWT.RADIO);
	btnOneColor.setText("One Color");
	btnOneColor.addSelectionListener(this);
	
	btnRadioButtonRandom.addSelectionListener(this);
	
	Composite compositeSouth = new Composite(this, SWT.NONE);
	compositeSouth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	compositeSouth.setLayout(new GridLayout(5, false));
	
	btnCheckButton = new Button(compositeSouth, SWT.CHECK);
	btnCheckButton.setBounds(0, 0, 111, 20);
	btnCheckButton.setText("Show in Chart");
	btnCheckButton.addSelectionListener(this);
	
	labelShowColor = new Label(compositeSouth, SWT.BORDER);
	GridData gd_labelShowColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelShowColor.widthHint = 100;
	labelShowColor.setLayoutData(gd_labelShowColor);
	labelShowColor.setBounds(0, 0, 70, 20);
	labelShowColor.setText(" ");
	labelShowColor.addMouseListener(this);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	
	loadSettings();

}
 
源代码15 项目: CppStyle   文件: CppStylePropertyPage.java
private void constructPage(Composite parent) {
	Composite composite = createComposite(parent, 2);

	projectSpecificButton = new Button(composite, SWT.CHECK);
	projectSpecificButton.setText(PROJECTS_PECIFIC_TEXT);
	projectSpecificButton.addSelectionListener(this);

	Button perfSetting = new Button(composite, SWT.PUSH);
	perfSetting.setText("Configure Workspace Settings...");
	perfSetting.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			configureWorkspaceSettings();
		}
	});

	createSepeerater(parent);

	composite = createComposite(parent, 1);

	enableCpplintOnSaveButton = new Button(composite, SWT.CHECK);
	enableCpplintOnSaveButton
			.setText(CppStyleConstants.ENABLE_CPPLINT_TEXT);
	enableCpplintOnSaveButton.addSelectionListener(this);

	enableClangFormatOnSaveButton = new Button(composite, SWT.CHECK);
	enableClangFormatOnSaveButton
			.setText(CppStyleConstants.ENABLE_CLANGFORMAT_TEXT);
	enableClangFormatOnSaveButton.addSelectionListener(this);

	createSepeerater(parent);

	composite = createComposite(parent, 1);

	Label laber = new Label(composite, SWT.NONE);
	laber.setText(CppStyleConstants.PROJECT_ROOT_TEXT);

	composite = createComposite(composite, 1);

	projectPath = getCurrentProject();

	projectRoot = new DirectoryFieldEditor(CppStyleConstants.CPPLINT_PATH,
			"Root:", composite) {
		String errorMsg = super.getErrorMessage();

		@Override
		protected boolean doCheckState() {
			this.setErrorMessage(errorMsg);

			String fileName = getTextControl().getText();
			fileName = fileName.trim();
			if (fileName.length() == 0 && isEmptyStringAllowed()) {
				return true;
			}

			File file = new File(fileName);
			if (false == file.isDirectory()) {
				return false;
			}

			this.setErrorMessage("Directory or its up level directories should contain .git, .hg, or .svn.");

			String path = CpplintCheckSettings.getVersionControlRoot(file);

			if (path == null) {
				return false;
			}

			if (!path.startsWith(projectPath)) {
				this.setErrorMessage("Should be a subdirectory of project's root.");
				return false;
			}

			return true;
		}

	};

	projectRoot.setPage(this);
	projectRoot.setFilterPath(new File(projectPath));
	projectRoot.setPropertyChangeListener(this);
	projectRootText = projectRoot.getTextControl(composite);
	projectRootText.addModifyListener(this);
	projectRoot.setEnabled(true, composite);

	if (!getPropertyValue(CppStyleConstants.PROJECTS_PECIFIC_PROPERTY)) {
		projectSpecificButton.setSelection(false);
		enableCpplintOnSaveButton.setEnabled(false);
		enableClangFormatOnSaveButton.setEnabled(false);
	} else {
		projectSpecificButton.setSelection(true);
		enableCpplintOnSaveButton.setEnabled(true);
		enableCpplintOnSaveButton
				.setSelection(getPropertyValue(CppStyleConstants.ENABLE_CPPLINT_PROPERTY));
		enableClangFormatOnSaveButton.setEnabled(true);
		enableClangFormatOnSaveButton
				.setSelection(getPropertyValue(CppStyleConstants.ENABLE_CLANGFORMAT_PROPERTY));
	}

	String root = getPropertyValueString(CppStyleConstants.CPPLINT_PROJECT_ROOT);
	projectRoot.setStringValue(root);
}
 
源代码16 项目: hop   文件: SimpleMappingDialog.java
private void addParametersTab( final MappingParameters parameters ) {

    CTabItem wParametersTab = new CTabItem( wTabFolder, SWT.NONE );
    wParametersTab.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Title" ) );
    wParametersTab.setToolTipText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.Tooltip" ) );

    Composite wParametersComposite = new Composite( wTabFolder, SWT.NONE );
    props.setLook( wParametersComposite );

    FormLayout parameterTabLayout = new FormLayout();
    parameterTabLayout.marginWidth = 15;
    parameterTabLayout.marginHeight = 15;
    wParametersComposite.setLayout( parameterTabLayout );

    // Add a checkbox: inherit all variables...
    //
    Button wInheritAll = new Button( wParametersComposite, SWT.CHECK );
    wInheritAll.setText( BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.InheritAll" ) );
    props.setLook( wInheritAll );
    FormData fdInheritAll = new FormData();
    fdInheritAll.bottom = new FormAttachment( 100, 0 );
    fdInheritAll.left = new FormAttachment( 0, 0 );
    fdInheritAll.right = new FormAttachment( 100, -30 );
    wInheritAll.setLayoutData( fdInheritAll );
    wInheritAll.setSelection( parameters.isInheritingAllVariables() );

    // Now add a tableview with the 2 columns to specify: input and output
    // fields for the source and target transforms.
    //
    ColumnInfo[] colinfo =
      new ColumnInfo[] {
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.Variable" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ),
        new ColumnInfo(
          BaseMessages.getString( PKG, "SimpleMappingDialog.Parameters.column.ValueOrField" ),
          ColumnInfo.COLUMN_TYPE_TEXT, false, false ), };
    colinfo[ 1 ].setUsingVariables( true );

    final TableView wMappingParameters =
      new TableView(
        pipelineMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, parameters
        .getVariable().length, false, lsMod, props, false
      );
    props.setLook( wMappingParameters );
    FormData fdMappings = new FormData();
    fdMappings.left = new FormAttachment( 0, 0 );
    fdMappings.right = new FormAttachment( 100, 0 );
    fdMappings.top = new FormAttachment( 0, 0 );
    fdMappings.bottom = new FormAttachment( wInheritAll, -10 );
    wMappingParameters.setLayoutData( fdMappings );
    wMappingParameters.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 50, 50 ) );

    for ( int i = 0; i < parameters.getVariable().length; i++ ) {
      TableItem tableItem = wMappingParameters.table.getItem( i );
      tableItem.setText( 1, parameters.getVariable()[ i ] );
      tableItem.setText( 2, parameters.getInputField()[ i ] );
    }
    wMappingParameters.setRowNums();
    wMappingParameters.optWidth( true );

    FormData fdParametersComposite = new FormData();
    fdParametersComposite.left = new FormAttachment( 0, 0 );
    fdParametersComposite.top = new FormAttachment( 0, 0 );
    fdParametersComposite.right = new FormAttachment( 100, 0 );
    fdParametersComposite.bottom = new FormAttachment( 100, 0 );
    wParametersComposite.setLayoutData( fdParametersComposite );

    wParametersComposite.layout();
    wParametersTab.setControl( wParametersComposite );

    changeList.add( new MappingParametersTab( wMappingParameters, wInheritAll, parameters ) );
  }
 
源代码17 项目: uima-uimaj   文件: AddRemoteServiceDialog.java
@Override
protected Control createDialogArea(Composite parent) {

  Composite composite = (Composite) super.createDialogArea(parent);
  
  Composite tc1 = new2ColumnComposite(composite);
  Label tempLabel;
  
  setTextAndTip(tempLabel = new Label(tc1, SWT.WRAP), "Service kind:", S_, SWT.BEGINNING, false);    
  aeOrCcCombo = wideCCombo(tc1, "Specify whether the Service is an Analysis Engine or a Cas Consumer",
          "AnalysisEngine", "CasConsumer");

  setTextAndTip(tempLabel = new Label(tc1, SWT.WRAP), "Protocol Service Type", S_, SWT.BEGINNING, false);
  serviceTypeCombo = wideCCombo(tc1, S_, "UIMA-AS JMS", "SOAP", "Vinci");

  setTextAndTip(uriLabel = new Label(tc1, SWT.NONE), "URI of service or JMS Broker:",
     "The URI for the service, e.g. localhost", SWT.BEGINNING, false);
  uriText = wideTextInput(tc1, S_, m_dialogModifyListener);

  setTextAndTip(endpointLabel = new Label(tc1, SWT.NONE), "Endpoint Name (JMS Service):",
  "For UIMA-AS JMS Services only, the endpoint name", SWT.BEGINNING, false);

  endpointText = wideTextInput(tc1, S_, m_dialogModifyListener);

  setTextAndTip(binarySerializationLabel = new Label(tc1, SWT.NONE), "Binary Serialization (JMS Service):",
      "For UIMA-AS JMS Services only, use binary serialzation (requires all type systems be identical)", 
      SWT.BEGINNING, false);

  binarySerializationCombo = wideCComboTF(tc1, S_);
  
  setTextAndTip(ignoreProcessErrorsLabel = new Label(tc1, SWT.NONE), "Ignore Process Errors (JMS Service):",
  "For UIMA-AS JMS Services only, ignore processing errors");
  ignoreProcessErrorsLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

  ignoreProcessErrorsCombo = wideCComboTF(tc1, S_);   

  setTextAndTip(tempLabel = new Label(tc1, SWT.NONE), "Key (a short mnemonic for this service):",
      "also used as part of the file name", SWT.BEGINNING, false);
  keyText = wideTextInput(tc1, S_, m_dialogModifyListener);
  keyText.addVerifyListener(new DialogVerifyListener());
  keyTextPrev = ".xml";

  createWideLabel(composite, "Where the generated remote descriptor file will be stored:");
  genFilePathUI = new Text(composite, SWT.BORDER | SWT.H_SCROLL);
  genFilePathUI.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  genFilePathUI.setText(rootPath + ".xml");

  createWideLabel(
          composite,
          "Timeouts, in milliseconds.  This is ignored for the Vinci protocol.  Specify 0 to wait forever. If not specified, a default timeout is used.");
  
  tc1 = new2ColumnComposite(composite);
  
  setTextAndTip(timeoutProcessLabel = new Label(tc1, SWT.NONE), "Timeout: Process:",
      "Timeout for processing a CAS", SWT.BEGINNING, false);   
  timeoutText = wideTextInput(tc1, S_);

  setTextAndTip(timeoutJmsGetmetaLabel = new Label(tc1, SWT.NONE), "Timeout: (JMS) GetMeta:",
  "Timeout for querying the metadata from a JMS service", SWT.BEGINNING, false);
  timeoutGetmetaText = wideTextInput(tc1, S_);

  setTextAndTip(timeoutJmsCpcLabel = new Label(tc1, SWT.NONE), "Timeout: (JMS) Collection Processing Complete:",
  "Timeout for Collection Processing Complete", SWT.BEGINNING, false);   
  timeoutJmsCpcText = wideTextInput(tc1, S_);
  createWideLabel(composite,
          "For the Vinci protocol, you can optionally specify the Host/Port for the Vinci Name Service");
  Composite tc = new2ColumnComposite(composite);
  setTextAndTip(vnsHostLabel = new Label(tc, SWT.NONE), "VNS HOST",
          "An IP name or address, e.g. localhost");
  vnsHostUI = newText(tc, SWT.NONE, "An IP name or address, e.g. localhost");
  setTextAndTip(vnsPortLabel = new Label(tc, SWT.NONE), "VNS PORT", "A port number, e.g. 9000");
  vnsPortUI = newText(tc, SWT.NONE, "A port number, e.g. 9000");

  newErrorMessage(composite);

  autoAddToFlowButton = new Button(composite, SWT.CHECK);
  autoAddToFlowButton.setText("Add to end of flow");
  autoAddToFlowButton.setSelection(true);

  new Label(composite, SWT.NONE).setText("");
  importByNameUI = new Button(composite, SWT.RADIO);
  importByNameUI.setText("Import by Name");
  importByNameUI
          .setToolTipText("Importing by name looks up the name on the classpath and datapath.");
  importByNameUI.setSelection(true);

  importByLocationUI = new Button(composite, SWT.RADIO);
  importByLocationUI.setText("Import By Location");
  importByLocationUI.setToolTipText("Importing by location requires a relative or absolute URL");

  String defaultBy = CDEpropertyPage.getImportByDefault(editor.getProject());
  if (defaultBy.equals("location")) {
    importByNameUI.setSelection(false);
    importByLocationUI.setSelection(true);
  } else {
    importByNameUI.setSelection(true);
    importByLocationUI.setSelection(false);
  }

  return composite;
}
 
private static Button createCheckbox(Composite parent, String title, boolean value) {
	Button checkBox= new Button(parent, SWT.CHECK);
	checkBox.setText(title);
	checkBox.setSelection(value);
	return checkBox;
}
 
源代码19 项目: cmake4eclipse   文件: CMakePropertyTab.java
/**
 * Switches the specified button behavior from tri-state mode to toggle mode.
 *
 * @param button
 *          the button to modify
 * @param buttonSelected
 *          the selection of the button
 */
private static void enterToggleMode(Button button, boolean buttonSelected) {
  button.setData(null); // mark toggle mode
  button.setSelection(buttonSelected);
  button.setGrayed(false);
}
 
源代码20 项目: logbook   文件: ShipFilterDialog.java
/**
 * フィルターから艦種のチェックボックスを設定する
 *
 * @param checkbox 艦種のチェックボックス
 * @param dto フィルター
 */
private static void setTypeSelection(ShipFilterDto dto, Button checkbox) {
    String type = checkbox.getText();
    checkbox.setSelection(dto.shipType.contains(type));
}