下面列出了org.eclipse.swt.widgets.Combo#getData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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 );
}
}
}
protected void textChanged(Combo comboControl) {
Key key = (Key) comboControl.getData();
String number = comboControl.getText();
String oldValue = setValue(key, number);
reconcileControls();
validateSettings(key, oldValue, number);
}
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;
}
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;
}
/**
* 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;
}
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;
}
protected void updateCombo(Combo curr) {
ControlData data = (ControlData) curr.getData();
String currValue = getValue(data.getKey());
int selection = data.getSelection(currValue);
curr.select(selection);
}
protected void updateCombo(Combo curr) {
ControlData data= (ControlData) curr.getData();
String currValue= getValue(data.getKey());
curr.select(data.getSelection(currValue));
}