Java Code Examples for org.eclipse.swt.widgets.Combo#setData()
The following examples show how to use
org.eclipse.swt.widgets.Combo#setData() .
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: AccountSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
public AccountSelector(Composite parent, IGoogleLoginService loginService) { super(parent, SWT.NONE); this.loginService = loginService; loginMessage = Messages.getString("ACCOUNT_SELECTOR_LOGIN"); combo = new Combo(this, SWT.READ_ONLY); List<Account> sortedAccounts = new ArrayList<>(loginService.getAccounts()); Collections.sort(sortedAccounts, new Comparator<Account>() { @Override public int compare(Account o1, Account o2) { return o1.getEmail().compareTo(o2.getEmail()); } }); for (Account account : sortedAccounts) { combo.add(account.getEmail()); combo.setData(account.getEmail(), account); } combo.add(loginMessage); combo.addSelectionListener(logInOnSelect); GridDataFactory.fillDefaults().grab(true, false).applyTo(combo); GridLayoutFactory.fillDefaults().generateLayout(this); }
Example 2
Source File: OptionsConfigurationBlock.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected Combo newComboControl(Composite composite, String key, String[] values, String[] valueLabels) { ControlData data = new ControlData(key, values); Combo comboBox = new Combo(composite, SWT.READ_ONLY); comboBox.setItems(valueLabels); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.setFont(JFaceResources.getDialogFont()); comboBox.setVisibleItemCount(30); makeScrollableCompositeAware(comboBox); updateCombo(comboBox); comboBoxes.add(comboBox); return comboBox; }
Example 3
Source File: OptionsConfigurationBlock.java From typescript.java with MIT License | 6 votes |
protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels, boolean readOnly) { Combo comboBox = new Combo(composite, readOnly ? SWT.READ_ONLY : SWT.NONE); comboBox.setItems(valueLabels); comboBox.setFont(JFaceResources.getDialogFont()); makeScrollableCompositeAware(comboBox); String currValue = getValue(key); if (readOnly) { ControlData data = new ControlData(key, values); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.select(data.getSelection(currValue)); } else { comboBox.setData(key); if (currValue != null) { comboBox.setText(currValue); } comboBox.addModifyListener(getTextModifyListener()); } fComboBoxes.add(comboBox); return comboBox; }
Example 4
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels) { ControlData data= new ControlData(key, values); Combo comboBox= new Combo(composite, SWT.READ_ONLY); comboBox.setItems(valueLabels); comboBox.setData(data); comboBox.addSelectionListener(getSelectionListener()); comboBox.setFont(JFaceResources.getDialogFont()); SWTUtil.setDefaultVisibleItemCount(comboBox); makeScrollableCompositeAware(comboBox); updateCombo(comboBox); fComboBoxes.add(comboBox); return comboBox; }
Example 5
Source File: OptionsConfigurationBlock.java From birt with Eclipse Public License 1.0 | 6 votes |
protected Combo newComboControl( Composite composite, Key key, String[] values, String[] valueLabels ) { ControlData data = new ControlData( key, values ); Combo comboBox = new Combo( composite, SWT.READ_ONLY ); comboBox.setVisibleItemCount( 30 ); comboBox.setItems( valueLabels ); comboBox.setData( data ); comboBox.addSelectionListener( getSelectionListener( ) ); comboBox.setFont( JFaceResources.getDialogFont( ) ); String currValue = getValue( key ); comboBox.select( data.getSelection( currValue ) ); fComboBoxes.add( comboBox ); return comboBox; }
Example 6
Source File: ComboWidget.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createControl() { final Composite container = new Composite(this, SWT.NONE); container.setLayout(GridLayoutFactory.fillDefaults().margins(1, 1).create()); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(labelAbove ? 2 : 1, 1).create()); int textStyle = 0; if (readOnly) { textStyle = SWT.READ_ONLY; } combo = new Combo(container, textStyle); combo.setData(SWTBOT_WIDGET_ID_KEY, id); combo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); return container; }
Example 7
Source File: InputParametersMappingSection.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected Combo createInputMappingAssignedToCombo(final Composite outputMappingControl, final InputMapping mapping) { final Combo assignationTypeCombo = new Combo(outputMappingControl, SWT.BORDER | SWT.READ_ONLY); getWidgetFactory().adapt(assignationTypeCombo); assignationTypeCombo.setItems(new String[] { Messages.assignToContractInput, Messages.assignToData }); switch (mapping.getAssignationType()) { case CONTRACT_INPUT: assignationTypeCombo.setText(Messages.assignToContractInput); break; case DATA: assignationTypeCombo.setText(Messages.assignToData); break; default: assignationTypeCombo.setText(Messages.assignToContractInput); break; } assignationTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); assignationTypeCombo.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_CALLACTIVITY_MAPPING_INPUT_ASSIGNATIONTYPE); return assignationTypeCombo; }
Example 8
Source File: JSParserValidatorPreferenceCompositeFactory.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public Composite createPreferenceComposite(Composite parent, final IBuildParticipantWorkingCopy participant) { Composite master = new Composite(parent, SWT.NONE); master.setLayout(GridLayoutFactory.fillDefaults().create()); GridDataFactory fillHoriz = GridDataFactory.fillDefaults().grab(true, false); // Options Group group = new Group(master, SWT.BORDER); group.setText(Messages.JSParserValidatorPreferenceCompositeFactory_OptionsGroup); group.setLayout(new GridLayout()); group.setLayoutData(fillHoriz.create()); Composite pairs = new Composite(group, SWT.NONE); pairs.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); Label label = new Label(pairs, SWT.WRAP); label.setText(Messages.JSParserValidatorPreferenceCompositeFactory_MissingSemicolons); Combo combo = new Combo(pairs, SWT.READ_ONLY | SWT.SINGLE); for (IProblem.Severity severity : IProblem.Severity.values()) { combo.add(severity.label()); combo.setData(severity.label(), severity); } String severityValue = participant.getPreferenceString(IPreferenceConstants.PREF_MISSING_SEMICOLON_SEVERITY); combo.setText(IProblem.Severity.create(severityValue).label()); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Combo c = ((Combo) e.widget); int index = c.getSelectionIndex(); String text = c.getItem(index); IProblem.Severity s = (Severity) c.getData(text); participant.setPreference(IPreferenceConstants.PREF_MISSING_SEMICOLON_SEVERITY, s.id()); } }); fillHoriz.applyTo(pairs); // Filters Composite filtersGroup = new ValidatorFiltersPreferenceComposite(master, participant); filtersGroup.setLayoutData(fillHoriz.grab(true, true).hint(SWT.DEFAULT, 150).create()); return master; }
Example 9
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 初始化过滤器列表控件 */ private void initFilterName() { filterName = new Combo(this, SWT.BORDER); filterName.setLayoutData(new GridData(80, 35)); setComboData(filterName, filterData); filterName.setData("filterName"); filterName.select(0); filterName.addSelectionListener(new SelectionAdapter() { private void createSource() { disposeChild(); initTxt(2); initBtn(); } private void createKeyword() { disposeChild(); initConditions(conditionData2); initTxt(1); initBtn(); } private void createMatchQt() { disposeChild(); initConditions(conditionData1); initTxt(1); initMatchQtTextListener(); initBtn(); } @Override public void widgetSelected(SelectionEvent e) { if (isMatchQt()) { createMatchQt(); } if (isKeyword()) { createKeyword(); } if (isSource()) { createSource(); } DynaComposite.this.layout(); } }); }
Example 10
Source File: CustomMatchConditionDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * 初始化过滤器列表控件 */ private void initFilterName() { filterName = new Combo(this, SWT.BORDER); filterName.setLayoutData(new GridData(80, 35)); setComboData(filterName, filterData); filterName.setData("filterName"); filterName.select(0); filterName.addSelectionListener(new SelectionAdapter() { private void createSource() { disposeChild(); initTxt(2); initBtn(); } private void createKeyword() { disposeChild(); initConditions(conditionData2); initTxt(1); initBtn(); } private void createMatchQt() { disposeChild(); initConditions(conditionData1); initTxt(1); initMatchQtTextListener(); initBtn(); } @Override public void widgetSelected(SelectionEvent e) { if (isMatchQt()) { createMatchQt(); } if (isKeyword()) { createKeyword(); } if (isSource()) { createSource(); } DynaComposite.this.layout(); } }); }
Example 11
Source File: GroupDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Creates the group area * * @param parent * the parent composite */ private void createGroupArea( Composite parent ) { Composite composite = new Composite( parent, SWT.NONE ); GridData layoutData = new GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING ); layoutData.verticalSpan = 2; composite.setLayoutData( layoutData ); composite.setLayout( new GridLayout( ) ); sortingGroup = new Group( composite, SWT.NONE ); sortingGroup.setText( SORT_GROUP_TITLE ); sortingGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); sortingGroup.setLayout( new FillLayout( SWT.VERTICAL ) ); Composite sortingGroupComposite = new Composite( sortingGroup, SWT.NONE ); sortingGroupComposite.setLayout( new GridLayout( ) ); ascending = new Button( sortingGroupComposite, SWT.RADIO ); // ascending.setText( sortByAscending.getDisplayName( ) ); ascending.setText( Messages.getString( "GroupDialog.Button.Ascending" ) ); //$NON-NLS-1$ descending = new Button( sortingGroupComposite, SWT.RADIO ); // descending.setText( sortByDescending.getDisplayName( ) ); descending.setText( Messages.getString( "GroupDialog.Button.Descending" ) ); //$NON-NLS-1$ Group pagebreakGroup = new Group( composite, SWT.NONE ); pagebreakGroup.setText( Messages.getString( "GroupDialog.PageBreak" ) ); //$NON-NLS-1$ pagebreakGroup.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); GridLayout layout = new GridLayout( ); layout.numColumns = 3; pagebreakGroup.setLayout( layout ); new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakBefore" ) ); //$NON-NLS-1$ pagebreakBeforeCombo = new Combo( pagebreakGroup, SWT.READ_ONLY | SWT.DROP_DOWN ); for ( int i = 0; i < pagebreakBeforeChoicesAll.length; i++ ) { pagebreakBeforeCombo.add( pagebreakBeforeChoicesAll[i].getDisplayName( ) ); } pagebreakBeforeCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); pagebreakBeforeCombo.setVisibleItemCount( 30 ); WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true ); pagebreakBeforeCombo.setData( pagebreakBeforeChoicesAll ); new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakAfter" ) ); //$NON-NLS-1$ pagebreakAfterCombo = new Combo( pagebreakGroup, SWT.READ_ONLY | SWT.DROP_DOWN ); for ( int i = 0; i < pagebreakAfterChoicesAll.length; i++ ) { pagebreakAfterCombo.add( pagebreakAfterChoicesAll[i].getDisplayName( ) ); } pagebreakAfterCombo.setVisibleItemCount( 30 ); pagebreakAfterCombo.setData( pagebreakAfterChoicesAll ); pagebreakAfterCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true ); new Label( pagebreakGroup, SWT.NONE ).setText( Messages.getString( "GroupDialog.PageBreakInside" ) ); //$NON-NLS-1$ pagebreakInsideCombo = new Combo( pagebreakGroup, SWT.READ_ONLY | SWT.DROP_DOWN ); for ( int i = 0; i < pagebreakInsideChoicesAll.length; i++ ) { pagebreakInsideCombo.add( pagebreakInsideChoicesAll[i].getDisplayName( ) ); } pagebreakInsideCombo.setVisibleItemCount( 30 ); pagebreakInsideCombo.setData( pagebreakInsideChoicesAll ); pagebreakInsideCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); WidgetUtil.createGridPlaceholder( pagebreakGroup, 1, true ); repeatHeaderButton = new Button( pagebreakGroup, SWT.CHECK ); repeatHeaderButton.setText( Messages.getString( "GroupDialog.RepeatHeader" ) ); //$NON-NLS-1$ GridData data = new GridData( ); data.horizontalSpan = 3; repeatHeaderButton.setLayoutData( data ); PropertyHandle propertyHandle = inputGroup.getPropertyHandle( TableHandle.SORT_PROP ); if ( propertyHandle.iterator( ).hasNext( ) ) { ascending.setEnabled( false ); descending.setEnabled( false ); } }
Example 12
Source File: PipenvDialog.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override protected Control createDialogArea(Composite parent) { Composite top = (Composite) super.createDialogArea(parent); Composite composite = new Composite(top, SWT.None); composite.setLayoutData(createGridData(1)); int numberOfColumns = 2; projectLocationFieldEditor = new ProjectDirectoryFieldEditorCustom("unused", "Project location", composite); projectLocationFieldEditor.fillIntoGrid(composite, numberOfColumns); projectLocationFieldEditor.setChangeButtonText("..."); projectLocationFieldEditor.setStringValue(defaultProjectLocation); projectLocationFieldEditor.setEmptyStringAllowed(false); if (this.showBaseInterpreter) { Label label = new Label(composite, SWT.NONE); label.setText("Base Interpreter:"); label.setLayoutData(createGridData(numberOfColumns)); comboBaseInterpreter = new Combo(composite, SWT.READ_ONLY); comboBaseInterpreter.setLayoutData(createGridData(numberOfColumns)); for (IInterpreterInfo info : interpreterInfos) { comboBaseInterpreter.add(info.getNameForUI()); comboBaseInterpreter.setData(info.getNameForUI(), info); } comboBaseInterpreter.setText(interpreterInfos[0].getNameForUI()); } fileFieldEditor = new FileFieldEditorCustom("unused", "pipenv executable", composite); fileFieldEditor.fillIntoGrid(composite, numberOfColumns); fileFieldEditor.setChangeButtonText("..."); fileFieldEditor.setEmptyStringAllowed(false); fileFieldEditor.setStringValue(defaultPipenvLocation); errorMessageText = new Text(composite, SWT.READ_ONLY); errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); errorMessageText.setForeground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_RED)); GridData gridData = createGridData(numberOfColumns); gridData.heightHint = 60; errorMessageText.setLayoutData(gridData); composite.setLayout(new GridLayout(numberOfColumns, false)); return top; }