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

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

源代码1 项目: ermaster-b   文件: IndexTabWrapper.java
public void removeIndex() {
	int selectedIndex = -1;

	for (int i = 0; i < this.checkButtonList.size(); i++) {
		Button checkButton = this.checkButtonList.get(i);
		if (checkButton.getSelection()) {
			selectedIndex = i;
			break;
		}
	}

	if (selectedIndex == -1) {
		return;
	}

	this.copyData.removeIndex(selectedIndex);

	this.restruct();
}
 
源代码2 项目: cmake4eclipse   文件: CMakePropertyTab.java
@Override
public void handleEvent(Event event) {
  final Button btn = (Button) event.widget;
  if (btn != null && Boolean.TRUE.equals(btn.getData())) {
    // button is in tri-state mode
    if (btn.getSelection()) {
      if (!btn.getGrayed()) {
        btn.setGrayed(true);
      }
    } else {
      if (btn.getGrayed()) {
        btn.setGrayed(false);
        btn.setSelection(true);
      }
    }
  }
}
 
源代码3 项目: SWET   文件: ComplexFormEx.java
private static void doSelection(Button button) {
	if (button.getSelection()) {
		String key = (String) button.getData("key");
		if (key != null && key != "" && elementData.containsKey(key)) {
			elementData.replace("ElementSelectedBy", key);
			logger.info("Set ElementSelectedBy: " + key);
		} else {
			// System.out.println(
			// String.format("Skip processing of key '%s'", selectedKey));
		}
	}
	/*
	  idRadio.addListener(SWT.Selection, new Listener() {
	    public void handleEvent(Event event) {
	      switch (event.type) {
	      case SWT.Selection:
	        Button button = ((Button) event.widget);
	        if (button.getSelection()) {
	          System.out.println(button.getText() + " selected (*)");
	        }
	        break;
	      }
	    }
	  });
	*/
}
 
源代码4 项目: ermasterr   文件: IndexTabWrapper.java
public void addIndexData(final Index index, final boolean add) {
    int selectedIndex = -1;

    for (int i = 0; i < checkButtonList.size(); i++) {
        final Button checkButton = checkButtonList.get(i);
        if (checkButton.getSelection()) {
            selectedIndex = i;
            break;
        }
    }

    Index copyIndex = null;

    if (add || selectedIndex == -1) {
        copyIndex = new CopyIndex(copyData, index, null);
        copyData.addIndex(copyIndex);

    } else {
        copyIndex = copyData.getIndex(selectedIndex);
        CopyIndex.copyData(index, copyIndex);

    }

    restruct();
}
 
源代码5 项目: ice   文件: DiscreteEntryComposite.java
@Override
public void widgetSelected(SelectionEvent e) {
	// Notify any listeners that the selection has changed
	notifyListeners(SWT.Selection, new Event());

	// Get the checkbox state
	Button button = (Button) e.getSource();
	if (button.getSelection()) {
		DiscreteEntryComposite.this.setEntryValue(yes);
	} else {
		DiscreteEntryComposite.this.setEntryValue(no);
	}

	logger.info(
			"EntryComposite Message: Updated Entry " + entry.getName() + " with value = " + entry.getValue());

	return;
}
 
源代码6 项目: elexis-3-core   文件: FallDetailBlatt2.java
/**
 * changing state: empty -> checked -> unchecked (cycling through)
 */
@Override
public void widgetSelected(SelectionEvent e){
	Button button = ((Button) e.getSource());
	boolean selection = !button.getSelection();
	boolean grayed = button.getGrayed();
	if (selection) {
		if (grayed) {
			button.setSelection(true);
			button.setGrayed(false);
		} else {
			button.setSelection(false);
			button.setGrayed(false);
		}
	} else {
		button.setSelection(true);
		button.setGrayed(true);
	}
}
 
源代码7 项目: Pydev   文件: CheckDefaultPreferencesDialog.java
private void applyChanges() {
    for (Button bt : checkBoxes) {
        Object data = bt.getData();
        if (data instanceof CheckInfo) {
            if (bt.getSelection()) {
                CheckInfo checkInfo = (CheckInfo) data;
                checkInfo.apply();
            }

        } else if (data.equals(PydevRootPrefs.CHECK_PREFERRED_PYDEV_SETTINGS)) {
            PydevRootPrefs.setCheckPreferredPydevSettings(bt.getSelection());

        } else {
            Log.log("Unexpected data: " + data);
        }
    }
}
 
源代码8 项目: erflute   文件: IndexTabWrapper.java
public ERIndex getTargetIndex() {
    int selectedIndex = -1;
    for (int i = 0; i < checkButtonList.size(); i++) {
        final Button checkButton = checkButtonList.get(i);
        if (checkButton.getSelection()) {
            selectedIndex = i;
            break;
        }
    }
    if (selectedIndex == -1) {
        return null;
    }
    return copyData.getIndex(selectedIndex);
}
 
源代码9 项目: hop   文件: RadioTab.java
public int selectedIndex() {
  Control[] children = radioGroup.getChildren();
  for ( int i = 0; i < children.length; i++ ) {
    Control child = children[ i ];
    Button button = (Button) child;
    if ( button.getSelection() ) {
      return i;
    }
  }
  return -1;
}
 
源代码10 项目: hop   文件: MappingDialog.java
private void setTabFlags( Button wMainPath, Label wlInputTransform, Text wInputTransform, Button wbInputTransform,
                          Label wlOutputTransform, Text wOutputTransform, Button wbOutputTransform, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputTransform.setEnabled( !mainPath );
  wInputTransform.setEnabled( !mainPath );
  wbInputTransform.setEnabled( !mainPath );
  wlOutputTransform.setEnabled( !mainPath );
  wOutputTransform.setEnabled( !mainPath );
  wbOutputTransform.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
源代码11 项目: birt   文件: SubtaskSheetImpl.java
protected boolean getToggleButtonSelection( String buttonId )
{
	Button button = popupButtonRegistry.get( buttonId );
	if ( button == null )
	{
		button = popupButtonRegistry.get( getNodePath( ) + buttonId );
	}
	if ( button != null )
	{
		return button.getSelection( );
	}
	return false;
}
 
private int getSearchFor() {
	for (int i= 0; i < fSearchFor.length; i++) {
		Button button= fSearchFor[i];
		if (button.getSelection()) {
			return getIntData(button);
		}
	}
	Assert.isTrue(false, "shouldNeverHappen"); //$NON-NLS-1$
	return -1;
}
 
源代码13 项目: pentaho-kettle   文件: MappingDialog.java
private void setTabFlags( Button wMainPath, Label wlInputStep, Text wInputStep, Button wbInputStep,
                          Label wlOutputStep, Text wOutputStep, Button wbOutputStep, Label wlDescription,
                          Text wDescription ) {
  boolean mainPath = wMainPath.getSelection();
  wlInputStep.setEnabled( !mainPath );
  wInputStep.setEnabled( !mainPath );
  wbInputStep.setEnabled( !mainPath );
  wlOutputStep.setEnabled( !mainPath );
  wOutputStep.setEnabled( !mainPath );
  wbOutputStep.setEnabled( !mainPath );
  wlDescription.setEnabled( !mainPath );
  wDescription.setEnabled( !mainPath );
}
 
private void doWidgetSelected(SelectionEvent e) {
	Button button= (Button)e.widget;
	for (int i= 0; i < fButtons.length; i++) {
		if (fButtons[i] == button) {
			fButtonsSelected[i]= button.getSelection();
			dialogFieldChanged();
			return;
		}
	}
}
 
源代码15 项目: ermasterr   文件: TranslationManageDialog.java
public void validatePage() {
    final List<String> selectedTranslations = new ArrayList<String>();

    for (final String translation : allTranslations) {
        final Button button = (Button) translationCheckMap.get(translation).getEditor();

        if (button.getSelection()) {
            selectedTranslations.add(translation);
        }
    }

    translationSettings.setSelectedTranslations(selectedTranslations);
    translationSettings.setUse(useButton.getSelection());
}
 
源代码16 项目: elexis-3-core   文件: TristateCheckbox.java
@Override
public void widgetSelected(SelectionEvent e){
	Button button = ((Button) e.getSource());
	boolean selection = !button.getSelection();
	boolean grayed = button.getGrayed();
	if (falseFirst) {
		if (selection) {
			if (grayed) {
				button.setSelection(false);
				button.setGrayed(false);
			} else {
				button.setSelection(true);
				button.setGrayed(true);
			}
		} else {
			button.setSelection(true);
			button.setGrayed(false);
		}
	} else {
		if (selection) {
			if (grayed) {
				button.setSelection(true);
				button.setGrayed(false);
			} else {
				button.setSelection(false);
				button.setGrayed(false);
			}
		} else {
			button.setSelection(true);
			button.setGrayed(true);
		}
	}
}
 
源代码17 项目: codewind-eclipse   文件: CodewindPrefsParentPage.java
@Override
public boolean performOk() {
	if (!isValid()) {
		return false;
	}
	
	if (CodewindInstall.ENABLE_STOP_APPS_OPTION) {
		for (Button button : stopAppsButtons) {
			if (button.getSelection()) {
				prefs.setValue(InstallUtil.STOP_APP_CONTAINERS_PREFSKEY, (String)button.getData());
				break;
			}
		}
	}
	
	prefs.setValue(CodewindCorePlugin.AUTO_OPEN_OVERVIEW_PAGE, autoOpenOverviewButton.getSelection());
	prefs.setValue(CodewindCorePlugin.ENABLE_SUPPORT_FEATURES, supportFeaturesButton.getSelection());
	
	prefs.setValue(CodewindCorePlugin.CW_INSTALL_TIMEOUT, Integer.parseInt(installTimeoutText.getText().trim()));
	prefs.setValue(CodewindCorePlugin.CW_UNINSTALL_TIMEOUT, Integer.parseInt(uninstallTimeoutText.getText().trim()));
	prefs.setValue(CodewindCorePlugin.CW_START_TIMEOUT, Integer.parseInt(startTimeoutText.getText().trim()));
	prefs.setValue(CodewindCorePlugin.CW_STOP_TIMEOUT, Integer.parseInt(stopTimeoutText.getText().trim()));
	
	// validate in validate() that this is a good integer
	int debugTimeout = Integer.parseInt(debugTimeoutText.getText().trim());
	prefs.setValue(CodewindCorePlugin.DEBUG_CONNECT_TIMEOUT_PREFSKEY, debugTimeout);

	// removes any trimmed space
	debugTimeoutText.setText("" + debugTimeout); //$NON-NLS-1$
	
	if (useBuiltinDebugButton != null) {
		prefs.setValue(CodewindCorePlugin.USE_BUILTIN_NODEJS_DEBUG_PREFSKEY, useBuiltinDebugButton.getSelection());
	}
	
	if (this.webBrowserCombo != null) {
		// The first option in the webBrowserCombo is to not use the default browser.
		// As a result, if the first option is selected, then remove the preference
		if (webBrowserCombo.getSelectionIndex() > 0) {
			// If it is selected, then save the preference. Do not add if it's the first item, since the option
			// for the first entry is "No browser selected"
			if (browserName != null) {
				prefs.setValue(CodewindCorePlugin.NODEJS_DEBUG_BROWSER_PREFSKEY, browserName);
			}
		} else {
			prefs.setToDefault(CodewindCorePlugin.NODEJS_DEBUG_BROWSER_PREFSKEY);
		}
	}

	return true;
}
 
源代码18 项目: birt   文件: TaskSelectType.java
protected void handleSubtypeBtnSelected( SelectionEvent e )
{
	Button btn = (Button) e.getSource( );
	if ( btn.getSelection( ) )
	{
		if ( this.sSubType != null
				&& !getSubtypeFromButton( btn ).equals( sSubType ) )
		{
			int iTypeIndex = vSubTypeNames.indexOf( sSubType );
			if ( iTypeIndex >= 0 )
			{
				( (Button) cmpTypeButtons.getChildren( )[iTypeIndex] ).setSelection( false );
				cmpTypeButtons.redraw( );
			}
		}

		// Cache label position for stacked or non-stacked case.
		ChartUIUtil.saveLabelPositionIntoCache( getSeriesDefinitionForProcessing( ) );

		sSubType = getSubtypeFromButton( btn );
		ChartCacheManager.getInstance( ).cacheSubtype( sType,
				sSubType );
	}
	else
	{
		if ( this.sSubType != null
				&& getSubtypeFromButton( btn ).equals( sSubType ) )
		{
			// Clicking on the same button should not cause it to be
			// unselected
			btn.setSelection( true );

			// Disable the statement to avoid when un-check all
			// stacked attributes of series on format tab, the
			// default chart is painted as side-by-side, but it
			// can't select stacked button to change chart type to
			// stacked in chart type tab.
			// needUpdateModel = false;
		}
	}
}
 
源代码19 项目: APICloud-Studio   文件: UnmanageAction.java
public void widgetSelected(SelectionEvent e) {
	Button button = (Button) e.widget;
	if (button.getSelection()) {
		deleteContent = (button == radio1);
	}
}
 
/**
 * Creates the project location specification controls.
 *
 * @param parent the parent composite
 */
private final void createProjectLocationGroup(Composite parent) {
    Font font = parent.getFont();
    // project specification group
    Composite projectGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    projectGroup.setFont(font);

    // new project label
    Label projectContentsLabel = new Label(projectGroup, SWT.NONE);
    projectContentsLabel.setFont(font);

    projectContentsLabel.setText("Project contents:");

    GridData labelData = new GridData();
    labelData.horizontalSpan = 3;
    projectContentsLabel.setLayoutData(labelData);

    final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
    useDefaultsButton.setText("Use &default");
    useDefaultsButton.setSelection(useDefaults);
    useDefaultsButton.setFont(font);

    GridData buttonData = new GridData();
    buttonData.horizontalSpan = 3;
    useDefaultsButton.setLayoutData(buttonData);

    createUserSpecifiedProjectLocationGroup(projectGroup, !useDefaults);

    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            useDefaults = useDefaultsButton.getSelection();
            browseButton.setEnabled(!useDefaults);
            locationPathField.setEnabled(!useDefaults);
            locationLabel.setEnabled(!useDefaults);
            if (useDefaults) {
                customLocationFieldValue = locationPathField.getText();
                setLocationForSelection();
            } else {
                locationPathField.setText(customLocationFieldValue);
            }
        }
    };
    useDefaultsButton.addSelectionListener(listener);
}