Java Code Examples for org.eclipse.swt.widgets.Combo#add()
The following examples show how to use
org.eclipse.swt.widgets.Combo#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: SettingsDialog.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
private void createNorth() { Composite northComposite = new Composite(shell, SWT.NONE); northComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); northComposite.setLayout(new GridLayout(2, false)); Label comboLabel = new Label(northComposite, SWT.NONE); comboLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); comboLabel.setText("Please select your chart type: "); comboChartSelect = new Combo(northComposite, SWT.NONE | SWT.READ_ONLY); comboChartSelect.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); comboChartSelect.add("Bar Chart"); comboChartSelect.add("Bubble Chart"); comboChartSelect.add("Pie Chart"); comboChartSelect.select(-1); comboChartSelect.addSelectionListener(this); }
Example 2
Source File: PWCombo.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * @see org.eclipse.nebula.widgets.opal.preferencewindow.widgets.PWWidget#build(org.eclipse.swt.widgets.Composite) */ @Override public Control build(final Composite parent) { buildLabel(parent, GridData.CENTER); final Combo combo = new Combo(parent, SWT.BORDER | (editable ? SWT.NONE : SWT.READ_ONLY)); addControl(combo); for (int i = 0; i < data.size(); i++) { final Object datum = data.get(i); combo.add(datum.toString()); if (datum.equals(PreferenceWindow.getInstance().getValueFor(getPropertyKey()))) { combo.select(i); } } combo.addListener(SWT.Modify, event -> { PreferenceWindow.getInstance().setValue(getPropertyKey(), PWCombo.this.data.get(combo.getSelectionIndex())); }); return combo; }
Example 3
Source File: SelfEncapsulateFieldInputPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void fillWithPossibleInsertPositions(Combo combo, IField field) { int select= 0; combo.add(RefactoringMessages.SelfEncapsulateFieldInputPage_first_method); try { IMethod[] methods= field.getDeclaringType().getMethods(); for (int i= 0; i < methods.length; i++) { combo.add(JavaElementLabels.getElementLabel(methods[i], JavaElementLabels.M_PARAMETER_TYPES)); } if (methods.length > 0) select= methods.length; } catch (JavaModelException e) { // Fall through } combo.select(select); fRefactoring.setInsertionIndex(select - 1); }
Example 4
Source File: FlutterLaunchConfigTab.java From dartboard with Eclipse Public License 2.0 | 5 votes |
@Override public void createControl(Composite parent) { Composite comp = new Group(parent, SWT.NONE); setControl(comp); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(comp); Label labelProject = new Label(comp, SWT.NONE); labelProject.setText(Messages.Launch_Project); GridDataFactory.swtDefaults().applyTo(labelProject); comboProject = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN); for (IProject project : getProjectsInWorkspace()) { comboProject.add(project.getName()); } GridDataFactory.fillDefaults().grab(true, false).applyTo(comboProject); comboProject.addModifyListener(event -> updateLaunchConfigurationDialog()); Label labelSdkLocation = new Label(comp, SWT.NONE); labelSdkLocation.setText(Messages.Preference_SDKLocation_Dart); GridDataFactory.swtDefaults().applyTo(labelSdkLocation); textSdkLocation = new Text(comp, SWT.BORDER); textSdkLocation.setMessage("SDK Location"); GridDataFactory.fillDefaults().grab(true, false).applyTo(textSdkLocation); textSdkLocation.addModifyListener(event -> updateLaunchConfigurationDialog()); createPageSpecificControls(comp); }
Example 5
Source File: AbstractExportDialog.java From ermasterr with Apache License 2.0 | 5 votes |
protected void initCategoryCombo(final Combo categoryCombo) { categoryCombo.add(ResourceString.getResourceString("label.all")); for (final Category category : categoryList) { categoryCombo.add(category.getName()); } categoryCombo.setVisibleItemCount(20); }
Example 6
Source File: RelationshipDialog.java From erflute with Apache License 2.0 | 5 votes |
private void createOnDeleteCombo(Group group) { final GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; onDeleteCombo = new Combo(group, SWT.NONE); onDeleteCombo.setLayoutData(gridData); onDeleteCombo.add("RESTRICT"); onDeleteCombo.add("CASCADE"); onDeleteCombo.add("NO ACTION"); onDeleteCombo.add("SET NULL"); onDeleteCombo.add("SET DEFAULT"); }
Example 7
Source File: TabPageIndentation.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private Control addSettingControl(Composite parent, FormatterProfile.IndentSetting bs, String label) { if (bs.isRange()) { Button cbox = null; if (bs.isRangeWithCheckbox()) { cbox = SWTFactory.createCheckbox(parent, label, 1); } else { SWTFactory.createLabel(parent, label, 1); } Combo cmb = SWTFactory.createCombo(parent, 1, SWT.DROP_DOWN | SWT.READ_ONLY, GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END); for (int i=bs.getMinVal(); i<=bs.getMaxVal(); ++i) { cmb.add(""+i); //$NON-NLS-1$ } cmb.select(fp.getValueForDialog(bs) - bs.getMinVal()); SettingSelectionListener ssl = new SettingSelectionListener(cmb, cbox, bs); cmb.addSelectionListener(ssl); if (cbox != null) { boolean unch = fp.getRangeCheckboxUncheckedState(bs); cbox.setSelection(!unch); cmb.setEnabled(!unch); cbox.addSelectionListener(ssl); } return cmb; } else { Button cb = SWTFactory.createCheckbox(parent, label, 2); cb.setSelection(fp.getAsBoolean(bs)); cb.addSelectionListener(new SettingSelectionListener(cb, null, bs)); GridData gd = (GridData)cb.getLayoutData(); gd.heightHint = prefHeight; cb.setLayoutData(gd); return cb; } }
Example 8
Source File: Regression_143809_swt.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * main() method for constructing the layout. * * @param args */ public static void main( String[] args ) { Display display = Display.getDefault( ); Shell shell = new Shell( display ); shell.setSize( 600, 400 ); shell.setLayout( new GridLayout( ) ); Regression_143809_swt siv = new Regression_143809_swt( shell, SWT.NO_BACKGROUND ); siv.setLayoutData( new GridData( GridData.FILL_BOTH ) ); siv.addPaintListener( siv ); Composite cBottom = new Composite( shell, SWT.NONE ); cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); cBottom.setLayout( new RowLayout( ) ); Label la = new Label( cBottom, SWT.NONE ); la.setText( "Choose: " );//$NON-NLS-1$ cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY ); cbType.add( "Pie Chart" ); cbType.select( 0 ); btn = new Button( cBottom, SWT.NONE ); btn.setText( "Update" );//$NON-NLS-1$ btn.addSelectionListener( siv ); shell.open( ); while ( !shell.isDisposed( ) ) { if ( !display.readAndDispatch( ) ) display.sleep( ); } display.dispose( ); }
Example 9
Source File: MechanicDialog.java From workspacemechanic with Eclipse Public License 1.0 | 5 votes |
/** * Creates a new combo box, initilizes the enty values, and configures * it with a listener capable of updating the right entry in our * map of item->decision. */ private Combo createDecisionCombo(Composite parent, Task item) { Combo combo = new Combo(parent, SWT.READ_ONLY); combo.add(YES); combo.add(NO); combo.add(NEVER); combo.select(0); combo.addSelectionListener(new ComboListener(item)); return combo; }
Example 10
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 设置Combo下拉列表中的数据 */ private void setComboData(Combo combo, String[] data) { if (combo == null || data == null || data.length == 0) { return; } combo.clearSelection(); combo.removeAll(); int i = 0; for (String temp : data) { combo.add(temp, i++); } }
Example 11
Source File: MySQLAdvancedComposite.java From erflute with Apache License 2.0 | 5 votes |
private static void initEngineCombo(Combo combo) { combo.add(""); combo.add("MyISAM"); combo.add("InnoDB"); combo.add("Memory"); combo.add("Merge"); combo.add("Archive"); combo.add("Federated"); combo.add("NDB"); combo.add("CSV"); combo.add("Blackhole"); combo.add("CSV"); }
Example 12
Source File: FontSizeContributionItem.java From ermaster-b with Apache License 2.0 | 5 votes |
@Override protected void setData(Combo combo) { int minimumSize = 5; for (int i = minimumSize; i < 17; i++) { combo.add(String.valueOf(i)); } }
Example 13
Source File: RelationCountFilterEditorControl.java From depan with Apache License 2.0 | 5 votes |
/** * Create the combo-box that defines the types of node count ranges * that are available. * * @param setup initial selection in combo */ private Combo createRangeOp(RelationCount.RangeOption setup) { rangeOp = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY); for (RelationCount.RangeOption option : COMBO_DISPLAY) { rangeOp.add(option.getRangeLabel()); } rangeOp.addSelectionListener(this); rangeOp.select(getRangeIndex(setup)); return rangeOp; }
Example 14
Source File: Chart3DViewer.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * execute application * * @param args */ public static void main( String[] args ) { Display display = Display.getDefault( ); Shell shell = new Shell( display ); shell.setSize( 600, 400 ); shell.setLayout( new GridLayout( ) ); Chart3DViewer c3dViewer = new Chart3DViewer( shell, SWT.NO_BACKGROUND ); c3dViewer.setLayoutData( new GridData( GridData.FILL_BOTH ) ); c3dViewer.addPaintListener( c3dViewer ); Composite cBottom = new Composite( shell, SWT.NONE ); cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); cBottom.setLayout( new RowLayout( ) ); Label la = new Label( cBottom, SWT.NONE ); la.setText( "&Choose: " );//$NON-NLS-1$ cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY ); cbType.add( "3D Bar Chart" ); //$NON-NLS-1$ cbType.add( "3D Line Chart" );//$NON-NLS-1$ cbType.add( "3D Area Chart" );//$NON-NLS-1$ cbType.select( 0 ); btn = new Button( cBottom, SWT.NONE ); btn.setText( "&Update" );//$NON-NLS-1$ btn.addSelectionListener( c3dViewer ); btn.setToolTipText( "Update" );//$NON-NLS-1$ shell.open( ); while ( !shell.isDisposed( ) ) { if ( !display.readAndDispatch( ) ) display.sleep( ); } display.dispose( ); }
Example 15
Source File: Regression_118773_swt.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * main() method for constructing the layout. * * @param args */ public static void main( String[] args ) { Display display = Display.getDefault( ); Shell shell = new Shell( display ); shell.setSize( 600, 400 ); shell.setLayout( new GridLayout( ) ); Regression_118773_swt siv = new Regression_118773_swt( shell, SWT.NO_BACKGROUND ); siv.setLayoutData( new GridData( GridData.FILL_BOTH ) ); siv.addPaintListener( siv ); Composite cBottom = new Composite( shell, SWT.NONE ); cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); cBottom.setLayout( new RowLayout( ) ); Label la = new Label( cBottom, SWT.NONE ); la.setText( "Choose: " );//$NON-NLS-1$ cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY ); cbType.add( "Bar Chart" ); cbType.select( 0 ); btn = new Button( cBottom, SWT.NONE ); btn.setText( "Update" );//$NON-NLS-1$ btn.addSelectionListener( siv ); shell.open( ); while ( !shell.isDisposed( ) ) { if ( !display.readAndDispatch( ) ) display.sleep( ); } display.dispose( ); }
Example 16
Source File: LEDSnippet.java From nebula with Eclipse Public License 2.0 | 5 votes |
private static void createTopPart() { new Label(shell, SWT.NONE); Composite top = new Composite(shell, SWT.NONE); top.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); top.setLayout(new GridLayout(2, true)); LED led = new LED(top, SWT.ICON); led.setLayoutData(new GridData(GridData.END, GridData.FILL, true, true, 1, 2)); led.setCharacter(LEDCharacter.CLEAR); Color idleColor = new Color(shell.getDisplay(), 60, 60, 60); led.setIdleColor(idleColor); SWTGraphicUtil.addDisposer(led, idleColor); Color selectedColor = new Color(shell.getDisplay(), 255, 0, 0); led.setSelectedColor(selectedColor); SWTGraphicUtil.addDisposer(led, selectedColor); Combo combo = new Combo(top, SWT.READ_ONLY); GridData gdCombo = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); gdCombo.minimumWidth = 100; combo.setLayoutData(gdCombo); for (LEDCharacter element : LEDCharacter.values()) { combo.add(element.name()); } combo.setText("CLEAR"); combo.addListener(SWT.Selection, e -> { LEDCharacter c = LEDCharacter.valueOf(combo.getText()); led.setCharacter(c); }); Button checkBox = new Button(top, SWT.CHECK); checkBox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); checkBox.setText("Dot ?"); checkBox.addListener(SWT.Selection, e -> { led.setShowDot(checkBox.getSelection()); }); new Label(shell, SWT.NONE); }
Example 17
Source File: RelationDialog.java From ermasterr with Apache License 2.0 | 5 votes |
public static ColumnComboInfo setReferencedColumnComboData(final Combo columnCombo, final ERTable table) { final ColumnComboInfo info = new ColumnComboInfo(); final int primaryKeySize = table.getPrimaryKeySize(); if (primaryKeySize != 0) { columnCombo.add("PRIMARY KEY"); info.complexUniqueKeyStartIndex = 1; info.candidatePK = true; } else { info.complexUniqueKeyStartIndex = 0; info.candidatePK = false; } for (final ComplexUniqueKey complexUniqueKey : table.getComplexUniqueKeyList()) { columnCombo.add(complexUniqueKey.getLabel()); } info.columnStartIndex = info.complexUniqueKeyStartIndex + table.getComplexUniqueKeyList().size(); for (final NormalColumn column : table.getNormalColumns()) { if (column.isUniqueKey()) { columnCombo.add(column.getLogicalName()); info.candidateColumns.add(column); } } return info; }
Example 18
Source File: NpmLaunchTab.java From wildwebdeveloper with Eclipse Public License 2.0 | 4 votes |
public static void addComboItems(Combo combo, String... commands) { for (String command : commands) { combo.add(command); } }
Example 19
Source File: FindReplaceDialog.java From translationstudio8 with GNU General Public License v2.0 | 3 votes |
/** * Updates the given combo with the given content. * @param combo * combo to be updated * @param content * to be put into the combo */ private void updateCombo(Combo combo, List<String> content) { combo.removeAll(); for (int i = 0; i < content.size(); i++) { combo.add(content.get(i)); } }
Example 20
Source File: TermBaseSearchDialog.java From translationstudio8 with GNU General Public License v2.0 | 3 votes |
/** * Updates the given combo with the given content. * @param combo * combo to be updated * @param content * to be put into the combo */ private void updateCombo(Combo combo, List<String> content) { combo.removeAll(); for (int i = 0; i < content.size(); i++) { combo.add(content.get(i)); } }