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

The following examples show how to use org.eclipse.swt.custom.CCombo#add() . 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: OutputParametersMappingSection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 2
Source File: TableEditorEx.java    From SWET with 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 3
Source File: InputParametersMappingSection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void updateAvailableValuesInputMappingTargetCombo(final CCombo targetCombo,
        final InputMappingAssignationType assignationType) {
    if (InputMappingAssignationType.DATA == assignationType) {
        for (final Data subprocessData : callActivityHelper.getCallActivityData()) {
            targetCombo.add(subprocessData.getName());
        }
    } else {
        for (final String contractInputOfCalledActivity : callActivityHelper.getCallActivityContractInput()) {
            targetCombo.add(contractInputOfCalledActivity);
        }
    }
}
 
Example 4
Source File: AddRemoteServiceDialog.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Wide C combo.
 *
 * @param tc the tc
 * @param tip the tip
 * @param entries the entries
 * @return the c combo
 */
private CCombo wideCCombo(Composite tc, String tip, String ... entries) {
  CCombo cc = newCCombo(tc, tip);
  for (String e : entries) {
    cc.add(e);
  }
  ((GridData) cc.getLayoutData()).grabExcessHorizontalSpace = true;;
  cc.select(0);
  return cc;
}
 
Example 5
Source File: FindComponentDialog.java    From uima-uimaj with 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 6
Source File: JobEntryDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the databases from the job metadata to the combo box.
 *
 * @param wConnection the w connection
 */
public void addDatabases( CCombo wConnection ) {
  for ( int i = 0; i < jobMeta.nrDatabases(); i++ ) {
    DatabaseMeta ci = jobMeta.getDatabase( i );
    wConnection.add( ci.getName() );
  }
}
 
Example 7
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the databases with the specified type to the Combo Box component.
 *
 * @param wConnection  the Combo Box component
 * @param databaseType the database type
 */
public void addDatabases( CCombo wConnection, Class<? extends DatabaseInterface> databaseType ) {
  for ( int i = 0; i < transMeta.nrDatabases(); i++ ) {
    DatabaseMeta ci = transMeta.getDatabase( i );
    if ( databaseType == null || ci.getDatabaseInterface().getClass().equals( databaseType ) ) {
      wConnection.add( ci.getName() );
    }
  }
}
 
Example 8
Source File: TableEditorEx.java    From SWET with 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 9
Source File: ChartCubeFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private CCombo createExpressionValue( Composite parent )
{
	final CCombo expressionValue = new CCombo( parent, SWT.BORDER );
	expressionValue.add( CHOICE_SELECT_VALUE );
	expressionValue.addListener( SWT.Verify, expValueVerifyListener );
	expressionValue.addListener( SWT.Selection, expValueSelectionListener );
	Listener listener = new Listener( ) {

		public void handleEvent( Event event )
		{
			updateButtons( );
		}

	};
	expressionValue.addListener( SWT.Modify, listener );
	expressionValue.addListener( SWT.MouseDown, new Listener( ) {

		public void handleEvent( Event arg0 )
		{
			if ( isMeasureSelected( ) )
			{
				if ( expressionValue.getItemCount( ) > 0 )
				{
					expressionValue.remove( 0 );
				}
				expressionValue.setVisibleItemCount( 0 );
			}
			else
			{
				if ( expressionValue.getItemCount( ) == 0 )
				{
					expressionValue.add( CHOICE_SELECT_VALUE );
				}
				expressionValue.setVisibleItemCount( 1 );
			}
		}
	} );
	
	IExpressionButton ceb = ChartExpressionButtonUtil.createExpressionButton( parent,
			expressionValue,
			(ExtendedItemHandle) designHandle,
			expressionProvider );
	ceb.addListener( listener );

	return expressionValue;
}