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 File: XsltDialog.java    From hop with 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
Source File: RouteResourceController.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
/**
     * 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
Source File: GroupHandleProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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
Source File: SortingHandleProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
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 File: XsltDialog.java    From pentaho-kettle with 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 File: ComboVar.java    From hop with 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 File: TableEditorEx.java    From SWET with 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 File: TableEditorEx.java    From SWET with 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
Source File: GroupHandleProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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
Source File: SortingHandleProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 File: ModifySupport.java    From olca-app with 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 File: ComboVar.java    From pentaho-kettle with 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 File: MultiMergeJoinDialog.java    From hop with 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
Source File: FilterHandleProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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
Source File: FilterHandleProvider.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
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
Source File: MultiMergeJoinDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * 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() );
}