org.eclipse.swt.custom.CCombo Java Examples

The following examples show how to use org.eclipse.swt.custom.CCombo. 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: FilterViewer.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
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 #2
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 #3
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createValueExpressionButton( Composite parent,
		final CCombo CCombo )
{
	Listener listener = new Listener( ) {

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

	};

	ExpressionProvider provider = getCrosstabExpressionProvider( );

	ExpressionButtonUtil.createExpressionButton( parent,
			CCombo,
			provider,
			designHandle,
			listener );
}
 
Example #4
Source File: TableView.java    From hop with Apache License 2.0 6 votes vote down vote up
private void applyComboChange( TableItem row, int rownr, int colnr ) {
  String textData;
  if ( combo instanceof ComboVar ) {
    textData = ( (ComboVar) combo ).getText();
  } else {
    textData = ( (CCombo) combo ).getText();
  }
  row.setText( colnr, textData );
  combo.dispose();

  String[] afterEdit = getItemText( row );
  checkChanged( new String[][] { beforeEdit }, new String[][] { afterEdit }, new int[] { rownr } );

  selectionStart = -1;

  fireContentChangedListener( rownr, colnr, textData );
}
 
Example #5
Source File: ChartExpressionButtonUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static IExpressionButton createExpressionButton( Composite parent,
		Control control, ExtendedItemHandle eih, IExpressionProvider ep )
{
	boolean isCube = ChartReportItemHelper.instance( )
			.getBindingCubeHandle( eih ) != null;

	boolean isCombo = control instanceof Combo || control instanceof CCombo;

	ChartExpressionHelper eHelper = isCombo ? new ChartExpressionComboHelper( isCube )
			: new ChartExpressionHelper( isCube );

	return new ChartExpressionButton( parent,
			control,
			eih,
			ep,
			eHelper );
}
 
Example #6
Source File: ExpressionButtonUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public String getExpression( )
{
	if ( control.isDisposed( ) )
	{
		return ""; //$NON-NLS-1$
	}
	if ( control instanceof Text )
	{
		return ( (Text) control ).getText( );
	}
	else if ( control instanceof Combo )
	{
		return ( (Combo) control ).getText( );
	}
	else if ( control instanceof CCombo )
	{
		return ( (CCombo) control ).getText( );
	}
	return ""; //$NON-NLS-1$
}
 
Example #7
Source File: TextEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void handleFormatSelectionEvent( final CCombo combo )
{
	int index = combo.getSelectionIndex( );
	combo.select( -1 );
	switch ( index )
	{
		case 0 :
			String result = " format=\"HTML\""; //$NON-NLS-1$
			textEditor.insert( result );
			break;
		case 1 :
			insertFormat( FormatBuilder.NUMBER );
			break;
		case 2 :
			insertFormat( FormatBuilder.STRING );
			break;
		case 3 :
			insertFormat( FormatBuilder.DATETIME );
			break;
		default :
	}

	textEditor.setFocus( );
}
 
Example #8
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 #9
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 #10
Source File: ChartUIUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static String getText( Control control )
{
	if ( control instanceof Text )
	{
		return ( (Text) control ).getText( );
	}
	if ( control instanceof CCombo )
	{
		// Fix a CCombo bug. Since a blank character is added to display the
		// text correctly, trim it when saving.
		return ( (CCombo) control ).getText( ).trim( );
	}
	if ( control instanceof Combo )
	{
		return ( (Combo) control ).getText( );
	}
	return ""; //$NON-NLS-1$
}
 
Example #11
Source File: ChartUIUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static ComboProxy getInstance( Control control )
{
	if ( control != null && !control.isDisposed( ) )
	{
		if ( control instanceof Combo )
		{
			return new ProxyOfCombo( (Combo) control );
		}
		else if ( control instanceof CCombo )
		{
			return new ProxyOfCCombo( (CCombo) control );
		}
	}

	return null;
}
 
Example #12
Source File: AbstractFormPage.java    From typescript.java with MIT License 6 votes vote down vote up
protected CCombo createCombo(Composite parent, String label, IJSONPath path, String[] values, String defaultValue) {
	FormToolkit toolkit = getToolkit();
	Composite composite = toolkit.createComposite(parent, SWT.NONE);
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	layout.marginBottom = 0;
	layout.marginTop = 0;
	layout.marginHeight = 0;
	layout.verticalSpacing = 0;
	composite.setLayout(layout);

	toolkit.createLabel(composite, label);

	CCombo combo = new CCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
	combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	combo.setItems(values);
	toolkit.adapt(combo, true, false);

	bind(combo, path, defaultValue);
	return combo;
}
 
Example #13
Source File: RuleDialog.java    From LogViewer with Eclipse Public License 2.0 6 votes vote down vote up
private void createMatchModeCombo(Composite parent) {
    // draw label
    Label comboLabel = new Label(parent,SWT.LEFT);
    comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    comboLabel.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.label")); //$NON-NLS-1$
    // draw combo
    matchModeCombo = new CCombo(parent,SWT.BORDER);
    matchModeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    matchModeCombo.setEditable(false);
    String[] matchModes = {LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.find"), LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.match")};
    matchModeCombo.setItems(matchModes);
    if(edit) {
        String[] items = matchModeCombo.getItems();
        for(int i = 0 ; i < items.length ; i++) {
            if(items[i].toLowerCase().indexOf(this.data.getMatchMode())!=-1) {
            	matchModeCombo.select(i);
                return;
            }
        }
    }
}
 
Example #14
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 #15
Source File: AbstractSection.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * New C combo with tip.
 *
 * @param parent the parent
 * @param tip the tip
 * @return the c combo
 */
protected CCombo newCComboWithTip(Composite parent, String tip) {
  CCombo ccombo = new CCombo(parent, SWT.FLAT | SWT.READ_ONLY);
  toolkit.adapt(ccombo, false, false);
  ccombo.setToolTipText(tip);
  ccombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
  ccombo.addListener(SWT.Selection, this);
  // Make the CCombo's border visible since CCombo is NOT a widget supported
  // by FormToolkit.
  // needed apparently by RedHat Linux 
  ccombo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
  return ccombo;
}
 
Example #16
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected String getSelectionValue( 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 );

		if ( dialog.open( ) == IDialogConstants.OK_ID )
		{
			IExpressionConverter converter = ExpressionButtonUtil.getCurrentExpressionConverter( CCombo );
			retValue = dialog.getSelectedExprValue( converter );
		}
	}

	return retValue;
}
 
Example #17
Source File: MultiMergeJoinDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Create widgets for join type selection
 *
 * @param lsMod
 */
private void createJoinTypeWidget( final ModifyListener lsMod ) {
  Label joinTypeLabel = new Label( shell, SWT.LEFT );
  joinTypeLabel.setText( BaseMessages.getString( PKG, "MultiMergeJoinDialog.Type.Label" ) );
  props.setLook( joinTypeLabel );
  FormData fdlType = new FormData();
  fdlType.left = new FormAttachment( 0, 0 );
  fdlType.right = new FormAttachment( 15, -margin );
  if ( wInputTransformArray.length > 0 ) {
    fdlType.top = new FormAttachment( wInputTransformArray[ wInputTransformArray.length - 1 ], margin );
  } else {
    fdlType.top = new FormAttachment( wTransformName, margin );
  }
  joinTypeLabel.setLayoutData( fdlType );
  joinTypeCombo = new CCombo( shell, SWT.BORDER );
  props.setLook( joinTypeCombo );

  joinTypeCombo.setItems( MultiMergeJoinMeta.join_types );

  joinTypeCombo.addModifyListener( lsMod );
  FormData fdType = new FormData();
  if ( wInputTransformArray.length > 0 ) {
    fdType.top = new FormAttachment( wInputTransformArray[ wInputTransformArray.length - 1 ], margin );
  } else {
    fdType.top = new FormAttachment( wTransformName, margin );
  }
  fdType.left = new FormAttachment( 15, 0 );
  fdType.right = new FormAttachment( 35, 0 );
  joinTypeCombo.setLayoutData( fdType );
}
 
Example #18
Source File: OutputPage.java    From typescript.java with MIT License 5 votes vote down vote up
private void createJSXSection(Composite parent) {
	FormToolkit toolkit = super.getToolkit();
	Section section = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
	section.setDescription(TsconfigEditorMessages.OutputPage_JSXSection_desc);
	section.setText(TsconfigEditorMessages.OutputPage_JSXSection_title);
	TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
	section.setLayoutData(data);

	Composite body = createBody(section);

	CCombo jsxCombo = createCombo(body, TsconfigEditorMessages.OutputPage_jsx_label,
			new JSONPath("compilerOptions.jsx"), new String[] { "", "preserve", "react" });
	Text reactNamespaceText = createText(body, TsconfigEditorMessages.OutputPage_reactNamespace_label,
			new JSONPath("compilerOptions.reactNamespace"), null, "jsxFactory");
}
 
Example #19
Source File: TextComboBoxCellEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object doGetValue ()
{
    final int sel = ( (CCombo)getControl () ).getSelectionIndex ();
    if ( sel < 0 )
    {
        return ( (CCombo)getControl () ).getText ();
    }
    else
    {
        return toString ( this.list.get ( sel ) );
    }
}
 
Example #20
Source File: PipelineExecutionConfigurationDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
protected void optionsSectionControls() {

    wlLogLevel = new Label( gDetails, SWT.NONE );
    props.setLook( wlLogLevel );
    wlLogLevel.setText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Label" ) );
    wlLogLevel.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    FormData fdlLogLevel = new FormData();
    fdlLogLevel.top = new FormAttachment( 0, 10 );
    fdlLogLevel.left = new FormAttachment( 0, 10 );
    wlLogLevel.setLayoutData( fdlLogLevel );

    wLogLevel = new CCombo( gDetails, SWT.READ_ONLY | SWT.BORDER );
    wLogLevel.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    props.setLook( wLogLevel );
    FormData fdLogLevel = new FormData();
    fdLogLevel.top = new FormAttachment( wlLogLevel, -2, SWT.TOP );
    fdLogLevel.width = 350;
    fdLogLevel.left = new FormAttachment( wlLogLevel, 6 );
    wLogLevel.setLayoutData( fdLogLevel );
    wLogLevel.setItems( LogLevel.getLogLevelDescriptions() );

    wClearLog = new Button( gDetails, SWT.CHECK );
    wClearLog.setText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.ClearLog.Label" ) );
    wClearLog.setToolTipText( BaseMessages.getString( PKG, "PipelineExecutionConfigurationDialog.ClearLog.Tooltip" ) );
    props.setLook( wClearLog );
    FormData fdClearLog = new FormData();
    fdClearLog.top = new FormAttachment( wLogLevel, 10 );
    fdClearLog.left = new FormAttachment( 0, 10 );
    wClearLog.setLayoutData( fdClearLog );

  }
 
Example #21
Source File: StaticAnalyzerPreferences.java    From CogniCrypt with Eclipse Public License 2.0 5 votes vote down vote up
/***
 * This method creates a table with check boxes for the CrySL rule sets.
 */
private void createRulesTable() {
	TableViewerColumn rulesColumn = new TableViewerColumn(table, SWT.FILL);
	TableViewerColumn versionsColumn = new TableViewerColumn(table, SWT.FILL);
	TableViewerColumn rulesURL = new TableViewerColumn(table, SWT.FILL);
	rulesColumn.getColumn().setText(Constants.TABLE_HEADER_RULES);
	versionsColumn.getColumn().setText(Constants.TABLE_HEADER_VERSION);
	rulesURL.getColumn().setText(Constants.TABLE_HEADER_URL);
	rulesColumn.getColumn().setWidth(200);
	versionsColumn.getColumn().setWidth(100);
	rulesURL.getColumn().setWidth(200);

	listOfRulesets = getRulesetsFromPrefs();

	for (Iterator<Ruleset> itr = listOfRulesets.iterator(); itr.hasNext();) {
		Ruleset ruleset = (Ruleset) itr.next();
		ruleset.setVersions(new CCombo(table.getTable(), SWT.NONE));
		String[] items = CrySLUtils.getRuleVersions(ruleset.getFolderName());
		if (items != null) {
			ruleset.getVersions().setItems(items);
			ruleset.getVersions().setItems(CrySLUtils.getRuleVersions(ruleset.getFolderName()));
			ruleset.setSelectedVersion(
					(ruleset.getSelectedVersion().length() > 0) ? ruleset.getSelectedVersion() : ruleset.getVersions().getItem(ruleset.getVersions().getItemCount() - 1));
			ruleset.getVersions().select(ruleset.getVersions().indexOf(ruleset.getSelectedVersion()));
		}
		createRulesTableRow(ruleset);
		ruleset.getVersions().addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				super.widgetSelected(e);

				ruleset.setSelectedVersion(ruleset.getVersions().getItem(ruleset.getVersions().getSelectionIndex()));
			}
		});
	}
}
 
Example #22
Source File: MyComboBoxCellEditor.java    From JDeodorant with MIT License 5 votes vote down vote up
protected Control createControl(Composite parent) {
	CCombo control = (CCombo)super.createControl(parent);
	control.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			focusLost();
		}
	});
	return control;
}
 
Example #23
Source File: OutputTypeEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CellEditor getCellEditor(final Object element) {
    final ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(), defaultTypes) ;
    editor.getControl().addListener(SWT.Modify, new Listener() {

        @Override
        public void handleEvent(Event event) {
            CCombo combo = (CCombo) editor.getControl() ;
            if(Messages.browse.equals(combo.getText())){
                openClassSelectionDialog() ;
            }
        }
    }) ;
    return  editor;
}
 
Example #24
Source File: RouteResourceController.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
/**
	 *
	 *
	 */
    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 #25
Source File: MultiMergeJoinDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Create widgets for join type selection
 *
 * @param lsMod
 */
private void createJoinTypeWidget( final ModifyListener lsMod ) {
  Label joinTypeLabel = new Label( shell, SWT.LEFT );
  joinTypeLabel.setText( BaseMessages.getString( PKG, "MultiMergeJoinDialog.Type.Label" ) );
  props.setLook( joinTypeLabel );
  FormData fdlType = new FormData();
  fdlType.left = new FormAttachment( 0, 0 );
  fdlType.right = new FormAttachment( 15, -margin );
  if ( wInputStepArray.length > 0 ) {
    fdlType.top = new FormAttachment( wInputStepArray[wInputStepArray.length - 1], margin );
  } else {
    fdlType.top = new FormAttachment( wStepname, margin );
  }
  joinTypeLabel.setLayoutData( fdlType );
  joinTypeCombo = new CCombo( shell, SWT.BORDER );
  props.setLook( joinTypeCombo );

  joinTypeCombo.setItems( MultiMergeJoinMeta.join_types );

  joinTypeCombo.addModifyListener( lsMod );
  FormData fdType = new FormData();
  if ( wInputStepArray.length > 0 ) {
    fdType.top = new FormAttachment( wInputStepArray[wInputStepArray.length - 1], margin );
  } else {
    fdType.top = new FormAttachment( wStepname, margin );
  }
  fdType.left = new FormAttachment( 15, 0 );
  fdType.right = new FormAttachment( 35, 0 );
  joinTypeCombo.setLayoutData( fdType );
}
 
Example #26
Source File: RouteResourceController.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
public void widgetSelected(SelectionEvent selectionEvent) {
    final PropertyChangeCommand cmd;
    if (selectionEvent.getSource() instanceof Button) {
        cmd = createButtonCommand((Button) selectionEvent.getSource());
    } else if (selectionEvent.getSource() instanceof CCombo) {
        cmd = createComboCommand((CCombo) selectionEvent.getSource());
    } else {
        cmd = null;
    }
    if (cmd != null) {
        cmd.setUpdate(true);
        executeCommand(cmd);
    }
}
 
Example #27
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 #28
Source File: CComboAssistField.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void initModifyListener( )
{
	( (CCombo) control ).addModifyListener( new ModifyListener( ) {

		public void modifyText( ModifyEvent event )
		{
			FieldAssistHelper.getInstance( )
					.handleFieldModify( CComboAssistField.this );
		}
	} );
}
 
Example #29
Source File: VfsFileChooserControls.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected void addFileWidgets() {
  Label wlLocation = new Label( this, SWT.RIGHT );
  wlLocation.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Location.Label" ) );
  wlLocation.setLayoutData( new FormDataBuilder( ).left( 0, 0 ).top( 0, 0 ).result() );
  wLocation = new CCombo( this, SWT.BORDER | SWT.READ_ONLY );
  List<VFSScheme> availableVFSSchemes = getAvailableVFSSchemes();
  availableVFSSchemes.forEach( scheme -> wLocation.add( scheme.schemeName ) );
  wLocation.addListener( SWT.Selection, event -> {
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
    this.wPath.setText( "" );
  } );
  if ( !availableVFSSchemes.isEmpty() ) {
    wLocation.select( 0 );
    this.selectedVFSScheme = availableVFSSchemes.get( wLocation.getSelectionIndex() );
  }
  wLocation.addModifyListener( lsMod );
  wLocation.setLayoutData(
    new FormDataBuilder().left( 0, 0 ).top( wlLocation, FIELD_LABEL_SEP ).width( FIELD_SMALL ).result() );

  Label wlPath = new Label( this, SWT.RIGHT );
  wlPath.setText( BaseMessages.getString( PKG, "VfsFileChooserControls.Filename.Label" ) );
  wlPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wLocation, FIELDS_SEP ).result() );
  wPath = new TextVar( space, this, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  wPath.addModifyListener( lsMod );
  wPath.setLayoutData( new FormDataBuilder().left( 0, 0 ).top( wlPath, FIELD_LABEL_SEP ).width( FIELD_LARGE + VAR_EXTRA_WIDTH ).result() );

  wbBrowse = new Button( this, SWT.PUSH );
  wbBrowse.setText( BaseMessages.getString( PKG, "System.Button.Browse" ) );
  wbBrowse.addListener( SWT.Selection, event -> browseForFileInputPath() );
  int bOffset = ( wbBrowse.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y
    - wPath.computeSize( SWT.DEFAULT, SWT.DEFAULT, false ).y ) / 2;
  wbBrowse.setLayoutData( new FormDataBuilder().left( wPath, FIELD_LABEL_SEP ).top( wlPath, FIELD_LABEL_SEP - bOffset ).result() );
}
 
Example #30
Source File: CrosstabFilterConditionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 );

}