Java Code Examples for org.eclipse.swt.custom.CCombo#getText()

The following examples show how to use org.eclipse.swt.custom.CCombo#getText() . 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 Project: hop   File: XsltDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void PopulateFields( CCombo cc ) {
  if ( cc.isDisposed() ) {
    return;
  }
  try {
    String initValue = cc.getText();
    cc.removeAll();
    IRowMeta r = pipelineMeta.getPrevTransformFields( transformName );
    if ( r != null ) {
      cc.setItems( r.getFieldNames() );
    }
    if ( !Utils.isEmpty( initValue ) ) {
      cc.setText( initValue );
    }
  } catch ( HopException ke ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "XsltDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "XsltDialog.FailedToGetFields.DialogMessage" ), ke );
  }

}
 
Example 2
/**
     * DOC nrousseau Comment method "createComboCommand".
     *
     * @param source
     * @return
     */
    private PropertyChangeCommand createComboCommand(CCombo combo) {
        String paramName = (String) combo.getData(PARAMETER_NAME);

        IElementParameter param = elem.getElementParameter(paramName);

        String value = combo.getText();

//        for (int j = 0; j < param.getListItemsValue().length; j++) {
//            if (combo.getText().equals(param.getListItemsDisplayName()[j])) {
//                value = (String) param.getListItemsValue()[j];
//            }
//        }
        if (value.equals(param.getValue())) {
            return null;
        }

        return new PropertyChangeCommand(elem, paramName, value);
    }
 
Example 3
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue;
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( input.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
		strValue = (String) value;
	return modelAdapter.setStringValue( input.get( 0 ), data, key, strValue );
}
 
Example 4
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue;
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( input.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
		strValue = (String) value;
	return modelAdapter.setStringValue( input.get( 0 ), data, key, strValue );
}
 
Example 5
Source Project: pentaho-kettle   File: XsltDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void PopulateFields( CCombo cc ) {
  if ( cc.isDisposed() ) {
    return;
  }
  try {
    String initValue = cc.getText();
    cc.removeAll();
    RowMetaInterface r = transMeta.getPrevStepFields( stepname );
    if ( r != null ) {
      cc.setItems( r.getFieldNames() );
    }
    if ( !Utils.isEmpty( initValue ) ) {
      cc.setText( initValue );
    }
  } catch ( KettleException ke ) {
    new ErrorDialog( shell, BaseMessages.getString( PKG, "XsltDialog.FailedToGetFields.DialogTitle" ), BaseMessages
        .getString( PKG, "XsltDialog.FailedToGetFields.DialogMessage" ), ke );
  }

}
 
Example 6
Source Project: hop   File: ComboVar.java    License: Apache License 2.0 5 votes vote down vote up
private ModifyListener getModifyListenerTooltipText( final CCombo comboField ) {
  return new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      String tip = comboField.getText();
      if ( !Utils.isEmpty( tip ) && !Utils.isEmpty( toolTipText ) ) {
        tip += Const.CR + Const.CR + toolTipText;
      }

      if ( Utils.isEmpty( tip ) ) {
        tip = toolTipText;
      }
      comboField.setToolTipText( variables.environmentSubstitute( tip ) );
    }
  };
}
 
Example 7
Source Project: SWET   File: TableEditorEx.java    License: MIT License 5 votes vote down vote up
@Override
public void modifyText(ModifyEvent event) {
	CCombo combo = (CCombo) event.widget;
	int column = (int) combo.getData("column");
	String oldValue = ((TableItem) combo.getData("item")).getText(column);
	String newValue = combo.getText();
	logger.info(String.format("Updating %s = %s", oldValue, newValue));
	if (selectorFromSWD.containsValue(newValue)) {
		((TableItem) combo.getData("item")).setText(column, newValue);
	}
}
 
Example 8
Source Project: SWET   File: TableEditorEx.java    License: MIT License 5 votes vote down vote up
@Override
public void modifyText(ModifyEvent event) {
	CCombo combo = (CCombo) event.widget;
	int column = (int) combo.getData("column");
	String oldValue = ((TableItem) combo.getData("item")).getText(column);
	String newValue = combo.getText();
	logger.info(String.format("Updating %s = %s", oldValue, newValue));
	if (keywordTable.containsKey(newValue)) {
		((TableItem) combo.getData("item")).setText(column, newValue);
	}
}
 
Example 9
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue;
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( contentInput.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
		strValue = (String) value;
	return modelAdapter.setStringValue( contentInput.get( 0 ),
			data,
			key,
			strValue );
}
 
Example 10
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue;
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( contentInput.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
		strValue = (String) value;
	return modelAdapter.setStringValue( contentInput.get( 0 ),
			data,
			key,
			strValue );
}
 
Example 11
Source Project: olca-app   File: ModifySupport.java    License: Mozilla Public License 2.0 5 votes vote down vote up
private String getCellText() {
	Control control = getControl();
	if (!(control instanceof CCombo))
		return null;
	CCombo combo = (CCombo) getControl();
	return combo.getText();
}
 
Example 12
Source Project: pentaho-kettle   File: ComboVar.java    License: Apache License 2.0 5 votes vote down vote up
private ModifyListener getModifyListenerTooltipText( final CCombo comboField ) {
  return new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      String tip = comboField.getText();
      if ( !Utils.isEmpty( tip ) && !Utils.isEmpty( toolTipText ) ) {
        tip += Const.CR + Const.CR + toolTipText;
      }

      if ( Utils.isEmpty( tip ) ) {
        tip = toolTipText;
      }
      comboField.setToolTipText( variables.environmentSubstitute( tip ) );
    }
  };
}
 
Example 13
Source Project: hop   File: MultiMergeJoinDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Get the meta data
 *
 * @param meta
 */
private void getMeta( MultiMergeJoinMeta meta ) {
  TransformIOMetaInterface transformIOMeta = meta.getTransformIOMeta();
  List<StreamInterface> infoStreams = transformIOMeta.getInfoStreams();
  StreamInterface stream;
  String streamDescription;
  ArrayList<String> inputTransformNameList = new ArrayList<>();
  ArrayList<String> keyList = new ArrayList<>();
  CCombo wInputTransform;
  String inputTransformName;
  for ( int i = 0; i < wInputTransformArray.length; i++ ) {
    wInputTransform = wInputTransformArray[ i ];
    inputTransformName = wInputTransform.getText();

    if ( Utils.isEmpty( inputTransformName ) ) {
      continue;
    }

    inputTransformNameList.add( inputTransformName );
    keyList.add( keyValTextBox[ i ].getText() );

    if ( infoStreams.size() < inputTransformNameList.size() ) {
      streamDescription = BaseMessages.getString( PKG, "MultiMergeJoin.InfoStream.Description" );
      stream = new Stream( StreamType.INFO, null, streamDescription, StreamIcon.INFO, null );
      transformIOMeta.addStream( stream );
    }
  }

  int inputTransformCount = inputTransformNameList.size();
  meta.allocateInputTransforms( inputTransformCount );
  meta.allocateKeys( inputTransformCount );

  String[] inputTransforms = meta.getInputTransforms();
  String[] keyFields = meta.getKeyFields();
  infoStreams = transformIOMeta.getInfoStreams();
  for ( int i = 0; i < inputTransformCount; i++ ) {
    inputTransformName = inputTransformNameList.get( i );
    inputTransforms[ i ] = inputTransformName;
    stream = infoStreams.get( i );
    stream.setTransformMeta( pipelineMeta.findTransform( inputTransformName ) );
    keyFields[ i ] = keyList.get( i );
  }

  meta.setJoinType( joinTypeCombo.getText() );
}
 
Example 14
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	// Clear the value of value2 when operator is not "between" or "not
	// between"
	// if ( property.equals( "Operator" ) )
	if ( property.equals( modelAdapter.getColumnNames( columnKeys )[1] ) )
	{
		if ( !( value.equals( getDisplayName( FilterCondition.OPERATOR_MEMBER,
				DesignChoiceConstants.FILTER_OPERATOR_BETWEEN ) ) || value.equals( getDisplayName( FilterCondition.OPERATOR_MEMBER,
				DesignChoiceConstants.FILTER_OPERATOR_NOT_BETWEEN ) ) ) )
		{
			modelAdapter.setStringValue( input.get( 0 ),
					data,
					FilterCondition.VALUE2_MEMBER,
					"" ); //$NON-NLS-1$
		}
	}

	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue = ""; //$NON-NLS-1$
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( input.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
	{
		strValue = (String) value;
	}

	return modelAdapter.setStringValue( input.get( 0 ), data, key, strValue );
}
 
Example 15
public boolean modify( Object data, String property, Object value )
		throws NameException, SemanticException
{
	// Clear the value of value2 when operator is not "between" or "not
	// between"
	// if ( property.equals( "Operator" ) )
	// if ( property.equals( modelAdapter.getColumnNames( columnKeys )[1] )
	// )
	// {
	// if ( !( value.equals( getDisplayName(
	// FilterCondition.OPERATOR_MEMBER,
	// DesignChoiceConstants.FILTER_OPERATOR_BETWEEN ) ) || value.equals(
	// getDisplayName( FilterCondition.OPERATOR_MEMBER,
	// DesignChoiceConstants.FILTER_OPERATOR_NOT_BETWEEN ) ) ) )
	// {
	// modelAdapter.setStringValue( input.get( 0 ),
	// data,
	// FilterCondition.VALUE2_MEMBER,
	// "" ); //$NON-NLS-1$
	// }
	// }

	int index = Arrays.asList( columnNames ).indexOf( property );
	String key = columnKeys[index];

	String strValue = ""; //$NON-NLS-1$
	if ( value instanceof Integer )
	{
		int intValue = ( (Integer) value ).intValue( );
		if ( intValue == -1 )
		{
			CCombo combo = (CCombo) editors[index].getControl( );
			strValue = combo.getText( );
		}
		else
		{
			String[] choices = modelAdapter.getChoiceSet( contentInput.get( 0 ),
					columnKeys[index] );
			strValue = choices[intValue];
		}
	}
	else
	{
		strValue = (String) value;
	}

	return modelAdapter.setStringValue( contentInput.get( 0 ), data, key, strValue );
}
 
Example 16
/**
 * Get the meta data
 *
 * @param meta
 */
private void getMeta( MultiMergeJoinMeta meta ) {
  StepIOMetaInterface stepIOMeta = meta.getStepIOMeta();
  List<StreamInterface> infoStreams = stepIOMeta.getInfoStreams();
  StreamInterface stream;
  String streamDescription;
  ArrayList<String> inputStepNameList = new ArrayList<String>();
  ArrayList<String> keyList = new ArrayList<String>();
  CCombo wInputStep;
  String inputStepName;
  for ( int i = 0; i < wInputStepArray.length; i++ ) {
    wInputStep = wInputStepArray[i];
    inputStepName = wInputStep.getText();

    if ( Utils.isEmpty( inputStepName ) ) {
      continue;
    }

    inputStepNameList.add( inputStepName );
    keyList.add( keyValTextBox[i].getText() );

    if ( infoStreams.size() < inputStepNameList.size() ) {
      streamDescription = BaseMessages.getString( PKG, "MultiMergeJoin.InfoStream.Description" );
      stream = new Stream( StreamType.INFO, null, streamDescription, StreamIcon.INFO, null );
      stepIOMeta.addStream( stream );
    }
  }

  int inputStepCount = inputStepNameList.size();
  meta.allocateInputSteps( inputStepCount );
  meta.allocateKeys( inputStepCount );

  String[] inputSteps = meta.getInputSteps();
  String[] keyFields = meta.getKeyFields();
  infoStreams = stepIOMeta.getInfoStreams();
  for ( int i = 0; i < inputStepCount; i++ ) {
    inputStepName = inputStepNameList.get( i );
    inputSteps[i] = inputStepName;
    stream = infoStreams.get( i );
    stream.setStepMeta( transMeta.findStep( inputStepName ) );
    keyFields[i] = keyList.get( i );
  }

  meta.setJoinType( joinTypeCombo.getText() );
}