Java Code Examples for org.eclipse.swt.widgets.Combo#getData()

The following examples show how to use org.eclipse.swt.widgets.Combo#getData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void updateCombo( Combo curr )
{
	ControlData data = (ControlData) curr.getData( );

	String currValue = getValue( data.getKey( ) );
	curr.select( data.getSelection( currValue ) );

	if ( fProject != null )
	{
		if ( ignoreKeys != null
				&& Arrays.asList( ignoreKeys ).contains( data.getKey( ) ) )
		{
			ControlEnableState.disable( curr );
			Control label = (Control) fLabels.get( curr );
			if ( label != null )
				ControlEnableState.disable( label );
		}
	}
}
 
Example 2
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 5 votes vote down vote up
protected void textChanged(Combo comboControl) {
	Key key = (Key) comboControl.getData();
	String number = comboControl.getText();
	String oldValue = setValue(key, number);
	reconcileControls();
	validateSettings(key, oldValue, number);
}
 
Example 3
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 5 votes vote down vote up
protected Combo getComboBox(Key key) {
	for (int i = fComboBoxes.size() - 1; i >= 0; i--) {
		Combo curr = (Combo) fComboBoxes.get(i);
		ControlData data = (ControlData) curr.getData();
		if (key.equals(data.getKey())) {
			return curr;
		}
	}
	return null;
}
 
Example 4
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected Combo getComboBox(Key key) {
	for (int i= fComboBoxes.size() - 1; i >= 0; i--) {
		Combo curr= fComboBoxes.get(i);
		ControlData data= (ControlData) curr.getData();
		if (key.equals(data.getKey())) {
			return curr;
		}
	}
	return null;
}
 
Example 5
Source File: InputParameterDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * If value in combo data list ,then select it and return true; else do
 * nothing and return false
 * 
 * @param selectIndex
 *            : indicate which item will be selected
 * @param value
 *            : the value which will be selected
 * @param combo
 * @param listParam
 * @return
 */

private boolean dealWithValueInComboList( int selectIndex, Object value,
		Combo combo, ScalarParameter listParam )
{
	boolean found = false;
	if ( selectIndex > 0 )
	{
		combo.select( selectIndex );
		putConfigValue( listParam.getHandle( ).getName( ),
				combo.getData( String.valueOf( combo.getSelectionIndex( ) ) ) );
		listParam.setSelectionValue( lastConfigValues.get( listParam.getHandle( ).getName( ) ) );
		found = true;
		return found;
	}
	for ( int i = 0; i < combo.getItemCount( ); i++ )
	{
		Object data = combo.getData( String.valueOf( i ) );
		if ( value == data || ( value != null && value.equals( data ) ) )
		{
			combo.select( i );
			putConfigValue( listParam.getHandle( ).getName( ),
					combo.getData( String.valueOf( combo.getSelectionIndex( ) ) ) );
			listParam.setSelectionValue( lastConfigValues.get( listParam.getHandle( ).getName( ) ) );
			found = true;
			break;
		}
	}
	return found;
}
 
Example 6
Source File: OptionsConfigurationBlock.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected Combo getComboBox( Key key )
{
	for ( int i = fComboBoxes.size( ) - 1; i >= 0; i-- )
	{
		Combo curr = (Combo) fComboBoxes.get( i );
		ControlData data = (ControlData) curr.getData( );
		if ( key.equals( data.getKey( ) ) )
		{
			return curr;
		}
	}
	return null;
}
 
Example 7
Source File: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
protected void updateCombo(Combo curr) {
	ControlData data = (ControlData) curr.getData();
	String currValue = getValue(data.getKey());
	int selection = data.getSelection(currValue);
	curr.select(selection);
}
 
Example 8
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
protected void updateCombo(Combo curr) {
	ControlData data= (ControlData) curr.getData();

	String currValue= getValue(data.getKey());
	curr.select(data.getSelection(currValue));
}