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

The following examples show how to use org.eclipse.swt.custom.CCombo#setText() . 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
FilterTraceTypeNodeComposite(Composite parent, TmfFilterTraceTypeNode node) {
    super(parent, node);
    fNode = node;
    fTraceTypeMap = getTraceTypeMap(fNode.getTraceTypeId());

    Label label = new Label(this, SWT.NONE);
    label.setText(Messages.FilterViewer_TypeLabel);

    fTypeCombo = new CCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fTypeCombo.setItems(fTraceTypeMap.keySet().toArray(new String[0]));
    if (fNode.getTraceTypeId() != null) {
        fTypeCombo.setText(fNode.getName());
    }
    fTypeCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TraceTypeHelper helper = checkNotNull(fTraceTypeMap.get(fTypeCombo.getText()));
            fNode.setTraceTypeId(helper.getTraceTypeId());
            fNode.setTraceClass(helper.getTraceClass());
            fNode.setName(fTypeCombo.getText());
            fViewer.refresh(fNode);
        }
    });
}
 
Example 3
private CCombo createSubprocessSourceCombo(final Composite outputMappingControl, final OutputMapping mapping) {
    final CCombo subprocessSourceCombo = getWidgetFactory().createCCombo(outputMappingControl, SWT.BORDER);
    for (final Data subprocessData : callActivityHelper.getCallActivityData()) {
        subprocessSourceCombo.add(subprocessData.getName());
    }
    subprocessSourceCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(15, 0).create());
    subprocessSourceCombo.addListener(SWT.Modify, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            getEditingDomain().getCommandStack()
                    .execute(
                            new SetCommand(getEditingDomain(), mapping,
                                    ProcessPackage.Literals.OUTPUT_MAPPING__SUBPROCESS_SOURCE, subprocessSourceCombo
                                            .getText()));
        }
    });
    if (mapping.getSubprocessSource() != null) {
        subprocessSourceCombo.setText(mapping.getSubprocessSource());
    }
    return subprocessSourceCombo;
}
 
Example 4
protected CCombo createInputMappingTargetCombo(final Composite outputMappingControl, final InputMapping mapping) {
    final CCombo targetCombo = getWidgetFactory().createCCombo(outputMappingControl, SWT.BORDER);
    final InputMappingAssignationType assignationType = mapping.getAssignationType();
    updateAvailableValuesInputMappingTargetCombo(targetCombo, assignationType);
    final GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    targetCombo.setLayoutData(layoutData);
    targetCombo.addListener(SWT.Modify, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            getEditingDomain().getCommandStack().execute(
                    new SetCommand(getEditingDomain(), mapping, ProcessPackage.Literals.INPUT_MAPPING__SUBPROCESS_TARGET,
                            targetCombo.getText()));
        }
    });
    if (mapping.getSubprocessTarget() != null) {
        targetCombo.setText(mapping.getSubprocessTarget());
    }
    targetCombo.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY,
            SWTBotConstants.SWTBOT_ID_CALLACTIVITY_MAPPING_INPUT_CALLEDTARGET);
    return targetCombo;
}
 
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: ControlSpaceKeyAdapter.java    License: Apache License 2.0 5 votes vote down vote up
private static final void applyChanges( Shell shell, List list, Control control, int position,
                                        IInsertText insertTextInterface ) {
  String selection =
    list.getSelection()[ 0 ].contains( Const.getDeprecatedPrefix() )
      ? list.getSelection()[ 0 ].replace( Const.getDeprecatedPrefix(), "" )
      : list.getSelection()[ 0 ];
  String extra = "${" + selection + "}";
  if ( insertTextInterface != null ) {
    insertTextInterface.insertText( extra, position );
  } else {
    if ( control.isDisposed() ) {
      return;
    }

    if ( list.getSelectionCount() <= 0 ) {
      return;
    }
    if ( control instanceof Text ) {
      ( (Text) control ).insert( extra );
    } else if ( control instanceof CCombo ) {
      CCombo combo = (CCombo) control;
      combo.setText( extra ); // We can't know the location of the cursor yet. All we can do is overwrite.
    } else if ( control instanceof StyledTextComp ) {
      ( (StyledTextComp) control ).insert( extra );
    } else if ( control instanceof StyledText ) {
      ( (StyledText) control ).insert( extra );
    }
  }
  if ( !shell.isDisposed() ) {
    shell.dispose();
  }
  if ( !control.isDisposed() ) {
    control.setData( Boolean.FALSE );
  }
}
 
Example 7
Source Project: SWET   File: TableEditorEx.java    License: MIT License 5 votes vote down vote up
private static void appendBlankRowToTable(Table table, TableItem item,
		int index) {

	item.setText(new String[] { String.format("%d", index), "Element name",
			"Action keyword", "", "Selector value" });

	TableEditor keywordChoiceEditor = new TableEditor(table);
	CCombo keywordChoiceCombo = new CCombo(table, SWT.NONE);
	keywordChoiceCombo.setText("Choose..");
	for (String keyword : keywordTable.keySet()) {
		keywordChoiceCombo.add(keyword);
	}
	// NOTE: none of options can be currently pre-selected
	keywordChoiceEditor.grabHorizontal = true;
	int keywordChoiceColumn = 2;
	keywordChoiceCombo.setData("column", keywordChoiceColumn);
	keywordChoiceCombo.setData("item", item);
	keywordChoiceEditor.setEditor(keywordChoiceCombo, item,
			keywordChoiceColumn);
	keywordChoiceCombo.addModifyListener(new keywordChoiceListener());

	TableEditor selectorChoiceEditor = new TableEditor(table);
	CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
	selectorChoiceCombo.setText("Choose");
	for (String locator : selectorFromSWD.values()) {
		selectorChoiceCombo.add(locator);
	}
	// NOTE: none of options is initially selected
	selectorChoiceEditor.grabHorizontal = true;
	int selectorChoiceColumn = 3;
	selectorChoiceCombo.setData("item", item);
	selectorChoiceCombo.setData("column", selectorChoiceColumn);
	selectorChoiceEditor.setEditor(selectorChoiceCombo, item,
			selectorChoiceColumn);
	selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
	return;
}
 
Example 8
/**
	 *
	 *
	 */
    private void refreshCombo(IElementParameter childParameter) {
        if (childParameter == null) {
            return;
        }
        CCombo combo = (CCombo) hashCurControls.get(childParameter.getName());

        if (combo == null || combo.isDisposed()) {
            return;
        }
        Object value = childParameter.getValue();
        if (value instanceof String) {
            String version = (String) value;
//            String strValue = ""; //$NON-NLS-1$
//            int nbInList = 0, nbMax = childParameter.getListItemsValue().length;
//            while (strValue.equals(new String("")) && nbInList < nbMax) { //$NON-NLS-1$
//                if (name.equals(childParameter.getListItemsValue()[nbInList])) {
//                    strValue = childParameter.getListItemsDisplayName()[nbInList];
//                }
//                nbInList++;
//            }
            String[] paramItems = getListToDisplay(childParameter);
            String[] comboItems = combo.getItems();

            if (!Arrays.equals(paramItems, comboItems)) {
                combo.setItems(paramItems);
            }
            combo.setText(version);
//            combo.setVisible(true);
        }

    }
 
Example 9
private void createMultiValueExpressionButton( Composite parent,
		final CCombo combo )
{
	Listener listener = new Listener( ) {

		public void handleEvent( Event event )
		{
			addBtn.setEnabled( false );

			boolean change = false;

			Expression expression = ExpressionButtonUtil.getExpression( combo );
			if ( expression == null
					|| expression.getStringExpression( ).trim( ).length( ) == 0 )
				return;
			if ( valueList.indexOf( expression ) < 0 )
			{
				valueList.add( expression );
				change = true;
			}

			if ( change )
			{
				tableViewer.refresh( );
				updateButtons( );
				combo.setFocus( );
				combo.setText( "" );
			}
		}
	};

	ExpressionButtonUtil.createExpressionButton( parent,
			combo,
			getCrosstabExpressionProvider( ),
			designHandle,
			listener );

}
 
Example 10
Source Project: uima-uimaj   File: FindComponentDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite composite = (Composite) super.createDialogArea(parent);

  AbstractSection.spacer(composite);

  new Label(composite, SWT.WRAP).setText("Descriptor file name pattern (e.g. ab*cde):");
  searchByNameText = new Text(composite, SWT.BORDER);
  searchByNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  new Label(composite, SWT.WRAP).setText("Descriptor must specify the input type:");
  inputTypeText = new Text(composite, SWT.BORDER);
  inputTypeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  new Label(composite, SWT.WRAP).setText("Descriptor must specify the output type:");
  outputTypeText = new Text(composite, SWT.BORDER);
  outputTypeText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  new Label(composite, SWT.WRAP).setText("Look in:");

  lookInCombo = new CCombo(composite, SWT.FLAT | SWT.BORDER | SWT.READ_ONLY);
  String[] projectNames = getProjectNames();
  lookInCombo.add(' ' + ALL_PROJECTS);
  for (int i = 0; i < projectNames.length; i++) {
    lookInCombo.add(' ' + projectNames[i]);
  }
  lookInCombo.setText(' ' + ALL_PROJECTS);

  statusLabel1 = new Label(composite, SWT.NONE);
  statusLabel1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  statusLabel2 = new Label(composite, SWT.NONE);
  statusLabel2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  newErrorMessage(composite);

  return composite;
}
 
Example 11
private static final void applyChanges( Shell shell, List list, Control control, int position,
  InsertTextInterface insertTextInterface ) {
  String selection =
      list.getSelection()[0].contains( Const.getDeprecatedPrefix() )
      ? list.getSelection()[0].replace( Const.getDeprecatedPrefix(), "" )
      : list.getSelection()[0];
  String extra = "${" + selection + "}";
  if ( insertTextInterface != null ) {
    insertTextInterface.insertText( extra, position );
  } else {
    if ( control.isDisposed() ) {
      return;
    }

    if ( list.getSelectionCount() <= 0 ) {
      return;
    }
    if ( control instanceof Text ) {
      ( (Text) control ).insert( extra );
    } else if ( control instanceof CCombo ) {
      CCombo combo = (CCombo) control;
      combo.setText( extra ); // We can't know the location of the cursor yet. All we can do is overwrite.
    } else if ( control instanceof StyledTextComp ) {
      ( (StyledTextComp) control ).insert( extra );
    } else if ( control instanceof StyledText ) {
      ( (StyledText) control ).insert( extra );
    }
  }
  if ( !shell.isDisposed() ) {
    shell.dispose();
  }
  if ( !control.isDisposed() ) {
    control.setData( Boolean.FALSE );
  }
}
 
Example 12
Source Project: hop   File: HopPluginExplorePerspective.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initialize( HopGui hopGui, Composite parent ) {
	this.hopGui = hopGui;
	this.parent = parent;

	this.loadPlugin();

	PropsUi props = PropsUi.getInstance();

	composite = new Composite( parent, SWT.NONE );
	composite.setLayout( new FormLayout() );

	formData = new FormData();
	formData.left = new FormAttachment( 0, 0 );
	formData.top = new FormAttachment( 0, 0 );
	formData.right = new FormAttachment( 100, 0 );
	formData.bottom = new FormAttachment( 100, 0 );
	composite.setLayoutData( formData );

	Label label = new Label( composite, SWT.LEFT );
	label.setText( "Plugin type" );
	FormData fdlFields = new FormData();
	fdlFields.left = new FormAttachment( 0, 0 );
	fdlFields.top = new FormAttachment( 0, props.getMargin() );
	label.setLayoutData( fdlFields );

	wPluginType = new CCombo( composite, SWT.LEFT | SWT.READ_ONLY | SWT.BORDER );
	wPluginType.setItems( pluginsType );
	wPluginType.setText( selectedPluginType );
	props.setLook( wPluginType );
	FormData fdlSubject = new FormData();
	fdlSubject.left = new FormAttachment( label, props.getMargin() );
	fdlSubject.top = new FormAttachment( label, 0, SWT.CENTER );
	wPluginType.setLayoutData( fdlSubject );

	wPluginType.addSelectionListener( new SelectionAdapter() {
		@Override
		public void widgetSelected( SelectionEvent arg0 ) {
			selectedPluginType = wPluginType.getText();
			refresh();
		}
	} );

	IRowMeta rowMeta = metaMap.get( selectedPluginType );
	ColumnInfo[] colinf = new ColumnInfo[ rowMeta.size() ];
	for ( int i = 0; i < rowMeta.size(); i++ ) {
		IValueMeta v = rowMeta.getValueMeta( i );
		colinf[ i ] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() );
		colinf[ i ].setToolTip( v.toStringMeta() );
		colinf[ i ].setValueMeta( v );
	}

	wPluginView = new TableView( new Variables(), composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0,
		null, props );
	wPluginView.setShowingBlueNullValues( true );

	FormData fdFields = new FormData();
	fdFields.left = new FormAttachment( 0, 0 );
	fdFields.top = new FormAttachment( wPluginType, props.getMargin() );
	fdFields.right = new FormAttachment( 100, 0 );
	fdFields.bottom = new FormAttachment( 100, 0 );
	wPluginView.setLayoutData( fdFields );

	this.refresh();
}
 
Example 13
Source Project: hop   File: TeraFastDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @param property property.
 * @param combo    text variable.
 */
public static void setTextIfPropertyValue( final IPluginProperty property, final CCombo combo ) {
  if ( property.evaluate() ) {
    combo.setText( ( (KeyValue<?>) property ).stringValue() );
  }
}
 
Example 14
private static void createCCombo(final Group group) {
	group.setLayout(new GridLayout(2, false));
	group.setText("CCombo widget");

	final Label lbl0 = new Label(group, SWT.NONE);
	lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl0.setText("No prompt :");

	final CCombo combo0 = new CCombo(group, SWT.BORDER);
	combo0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lbl1 = new Label(group, SWT.NONE);
	lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl1.setText("Simple text prompt :");

	final CCombo txt1 = new CCombo(group, SWT.BORDER);
	txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt1);

	final Label lbl2 = new Label(group, SWT.NONE);
	lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl2.setText("Other style (bold) :");

	final CCombo txt2 = new CCombo(group, SWT.BORDER);
	txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want in bold", txt2);
	PromptSupport.setFontStyle(SWT.BOLD, txt2);

	final Label lbl3 = new Label(group, SWT.NONE);
	lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl3.setText("Behaviour highlight :");

	final CCombo txt3 = new CCombo(group, SWT.BORDER);
	txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt3);
	PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3);

	final Label lbl4 = new Label(group, SWT.NONE);
	lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl4.setText("Change colors :");

	final CCombo txt4 = new CCombo(group, SWT.BORDER);
	txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt4);
	PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4);
	PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4);

	final Label lbl5 = new Label(group, SWT.NONE);
	lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl5.setText("Change when widget is initialized :");

	final CCombo txt5 = new CCombo(group, SWT.BORDER);
	txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	txt5.setText("Remove what is typed...");
	txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW));

	PromptSupport.setPrompt("Type anything you want", txt5);
	PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5);
	PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5);

}
 
Example 15
Source Project: SWET   File: TableEditorEx.java    License: MIT License 4 votes vote down vote up
private static void appendRowToTable(Table table, List<String> stepIds) {

		TableItem[] tableItems = table.getItems();
		int cnt = 0;
		for (String stepId : stepIds) {

			// get element data
			TableItem tableItem = tableItems[cnt];
			Map<String, String> elementData = testData.get(stepId);
			String selectorChoice = selectorFromSWD
					.get(elementData.get("ElementSelectedBy"));

			String selectorValue = elementData
					.get(elementData.get("ElementSelectedBy"));

			// Append row into the TableEditor
			tableItem.setText(new String[] { elementData.get("ElementStepNumber"),
					elementData.get("ElementCodeName"), String.format("Action %d", cnt),
					selectorChoice, selectorValue });
			// some columns need to be converted to selects

			TableEditor keywordChoiceEditor = new TableEditor(table);
			CCombo keywordChoiceCombo = new CCombo(table, SWT.NONE);
			keywordChoiceCombo.setText("Choose..");
			for (String keyword : keywordTable.keySet()) {
				keywordChoiceCombo.add(keyword);
			}
			// NOTE: none of options is initially selected
			keywordChoiceEditor.grabHorizontal = true;
			int keywordChoiceColumn = 2;
			keywordChoiceCombo.setData("column", keywordChoiceColumn);
			keywordChoiceCombo.setData("item", tableItem);
			keywordChoiceEditor.setEditor(keywordChoiceCombo, tableItem,
					keywordChoiceColumn);
			keywordChoiceCombo.addModifyListener(new keywordChoiceListener());

			TableEditor selectorChoiceEditor = new TableEditor(table);
			CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
			for (String locator : selectorFromSWD.values()) {
				selectorChoiceCombo.add(locator);
			}
			// java.lang.ClassCastException: java.util.LinkedHashMap$LinkedValues
			// cannot be cast to java.util.List
			selectorChoiceCombo.select(new ArrayList<String>(selectorFromSWD.values())
					.indexOf(selectorFromSWD.get(elementData.get("ElementSelectedBy"))));
			selectorChoiceEditor.grabHorizontal = true;
			int selectorChoiceColumn = 3;
			selectorChoiceCombo.setData("item", tableItem);
			selectorChoiceCombo.setData("column", selectorChoiceColumn);
			selectorChoiceEditor.setEditor(selectorChoiceCombo, tableItem,
					selectorChoiceColumn);
			selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
			cnt = cnt + 1;
		}
		return;
	}
 
Example 16
private void selectMultiValues( CCombo CCombo )
{
	String[] retValue = null;

	List selectValueList = getSelectedValueList( );
	if ( selectValueList == null || selectValueList.size( ) == 0 )
	{
		MessageDialog.openInformation( null,
				Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
				Messages.getString( "SelectValueDialog.messages.info.selectVauleUnavailable" ) ); //$NON-NLS-1$

	}
	else
	{
		SelectValueDialog dialog = new SelectValueDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "ExpressionValueCellEditor.title" ) ); //$NON-NLS-1$
		dialog.setSelectedValueList( selectValueList );
		dialog.setMultipleSelection( true );
		if ( dialog.open( ) == IDialogConstants.OK_ID )
		{
			retValue = dialog.getSelectedExprValues( );
		}
	}

	if ( retValue != null )
	{
		addBtn.setEnabled( false );

		if ( retValue.length == 1 )
		{
			CCombo.setText( DEUtil.resolveNull( retValue[0] ) );
		}
		else if ( retValue.length > 1 )
		{
			CCombo.setText( "" ); //$NON-NLS-1$
		}

		boolean change = false;
		List strValues = new ArrayList( );
		for ( int i = 0; i < valueList.size( ); i++ )
		{
			strValues.add( ( (Expression) valueList.get( i ) ).getStringExpression( ) );
		}
		for ( int i = 0; i < retValue.length; i++ )
		{
			if ( strValues.indexOf( DEUtil.resolveNull( retValue[i] ) ) < 0 )
			{
				valueList.add( new Expression( DEUtil.resolveNull( retValue[i] ),
						ExpressionButtonUtil.getExpressionButton( CCombo )
								.getExpressionHelper( )
								.getExpressionType( ) ) );
				change = true;
			}
		}
		if ( change )
		{
			tableViewer.refresh( );
			updateButtons( );
			CCombo.setFocus( );
		}
	}
}
 
Example 17
private void selectMultiValues( CCombo CCombo )
{
	String[] retValue = null;

	List selectValueList = getSelectedValueList( );
	if ( selectValueList == null || selectValueList.size( ) == 0 )
	{
		MessageDialog.openInformation( null,
				Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
				Messages.getString( "SelectValueDialog.messages.info.selectVauleUnavailable" ) ); //$NON-NLS-1$

	}
	else
	{
		SelectValueDialog dialog = new SelectValueDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "ExpressionValueCellEditor.title" ) ); //$NON-NLS-1$
		dialog.setSelectedValueList( selectValueList );
		dialog.setMultipleSelection( true );
		if ( dialog.open( ) == IDialogConstants.OK_ID )
		{
			retValue = dialog.getSelectedExprValues( );
		}
	}

	if ( retValue != null )
	{
		addBtn.setEnabled( false );

		if ( retValue.length == 1 )
		{
			CCombo.setText( DEUtil.resolveNull( retValue[0] ) );
		}
		else if ( retValue.length > 1 )
		{
			CCombo.setText( "" ); //$NON-NLS-1$
		}

		boolean change = false;
		List strValues = new ArrayList( );
		for ( int i = 0; i < valueList.size( ); i++ )
		{
			strValues.add( ( (Expression) valueList.get( i ) ).getStringExpression( ) );
		}
		for ( int i = 0; i < retValue.length; i++ )
		{
			if ( strValues.indexOf( DEUtil.resolveNull( retValue[i] ) ) < 0 )
			{
				valueList.add( new Expression( DEUtil.resolveNull( retValue[i] ),
						ExpressionButtonUtil.getExpressionButton( CCombo )
								.getExpressionHelper( )
								.getExpressionType( ) ) );
				change = true;
			}
		}
		if ( change )
		{
			tableViewer.refresh( );
			updateButtons( );
			CCombo.setFocus( );
		}
	}
}
 
Example 18
Source Project: uima-uimaj   File: AbstractDialog.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Sets the text and tip.
 *
 * @param c the c
 * @param label the label
 * @param tip the tip
 */
protected void setTextAndTip(CCombo c, String label, String tip) {
  c.setText(label);
  c.setToolTipText(tip);
}
 
Example 19
Source Project: pentaho-kettle   File: TeraFastDialog.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * @param property
 *          property.
 * @param combo
 *          text variable.
 */
public static void setTextIfPropertyValue( final PluginProperty property, final CCombo combo ) {
  if ( property.evaluate() ) {
    combo.setText( ( (KeyValue<?>) property ).stringValue() );
  }
}