protected Combo addInversedComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indent; gd.horizontalSpan= 3; Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; composite.setLayout(layout); composite.setLayoutData(gd); Combo comboBox= newComboControl(composite, key, values, valueLabels); comboBox.setFont(JFaceResources.getDialogFont()); comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); Label labelControl= new Label(composite, SWT.LEFT | SWT.WRAP); labelControl.setText(label); labelControl.setLayoutData(new GridData()); fLabels.put(comboBox, labelControl); return comboBox; }
protected Combo addInversedComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indent; gd.horizontalSpan= 3; Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; composite.setLayout(layout); composite.setLayoutData(gd); Combo comboBox= newComboControl(composite, key, values, valueLabels); comboBox.setFont(JFaceResources.getDialogFont()); comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); Label labelControl= new Label(composite, SWT.LEFT | SWT.WRAP); labelControl.setText(label); labelControl.setLayoutData(new GridData()); fLabels.put(comboBox, labelControl); return comboBox; }
protected Combo addInversedComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indent; gd.horizontalSpan= 3; Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; composite.setLayout(layout); composite.setLayoutData(gd); Combo comboBox= newComboControl(composite, key, values, valueLabels); comboBox.setFont(JFaceResources.getDialogFont()); comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); Label labelControl= new Label(composite, SWT.LEFT | SWT.WRAP); labelControl.setText(label); labelControl.setLayoutData(new GridData()); fLabels.put(comboBox, labelControl); return comboBox; }
protected Combo getComboControl(Composite parent) { if(combo != null) { return combo; } combo = new Combo(parent,SWT.RIGHT); combo.setFont(parent.getFont()); return combo; }
private static Combo createProfileCombo(Composite composite, int span, int widthHint) { final GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; gd.widthHint= widthHint; final Combo combo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY ); combo.setFont(composite.getFont()); combo.setLayoutData(gd); return combo; }
private static Combo createProfileCombo(Composite composite, int span, int widthHint) { final GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; gd.widthHint= widthHint; final Combo combo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY ); combo.setFont(composite.getFont()); SWTUtil.setDefaultVisibleItemCount(combo); combo.setLayoutData(gd); return combo; }
private static Combo createProfileCombo(Composite composite, int span, int widthHint) { final GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = span; gd.widthHint= widthHint; final Combo combo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY ); combo.setFont(composite.getFont()); SWTUtil.setDefaultVisibleItemCount(combo); combo.setLayoutData(gd); return combo; }
protected static Combo newCombo(Composite parent, String title, int combostyle) { if (title != null) { Label label = new Label(parent, SWT.NONE); label.setText(Translate.getInstance().labelName(title) + ": "); label.setFont(fonts.dialogFontBold()); label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING)); } Combo combo = new Combo(parent, combostyle); combo.setFont(fonts.dialogFont()); combo.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL)); combo.setVisibleItemCount(20); setBG(combo); return combo; }
/** * This method is used to make a combo box with a default fill style of GridData.FILL_HORIZONTAL * @param parent the parent composite to add the new combo to * @param style the style for the Combo * @param hspan the horizontal span to take up on the parent composite * @param items the item to put into the combo * @return a new Combo instance */ public static Combo createCombo(Composite parent, int style, int hspan, String[] items) { Combo c = new Combo(parent, style); c.setFont(parent.getFont()); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = hspan; c.setLayoutData(gd); c.setItems(items); c.select(0); return c; }
/** * This method is used to make a combo box * @param parent the parent composite to add the new combo to * @param style the style for the Combo * @param hspan the horizontal span to take up on the parent composite * @param fill how the combo will fill into the composite * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code> * @param items the item to put into the combo * @return a new Combo instance */ public static Combo createCombo(Composite parent, int style, int hspan, int fill, String[] items) { Combo c = new Combo(parent, style); c.setFont(parent.getFont()); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; c.setLayoutData(gd); c.setItems(items); c.select(0); return c; }
private Combo getComboBoxControl(Composite parent) { if (fCombo == null) { fCombo = new Combo(parent, SWT.READ_ONLY); fCombo.setFont(parent.getFont()); for (int i = 0; i < fEntryNamesAndValues.length; i++) { fCombo.add(fEntryNamesAndValues[i][0], i); } fCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent evt) { String oldValue = fValue; String name = fCombo.getText(); fValue = getValueForName(name); setPresentsDefaultValue(false); fireValueChanged(VALUE, oldValue, fValue); } }); } return fCombo; }
private Combo getComboBoxControl(Composite parent) { if (fCombo == null) { fCombo = new Combo(parent, SWT.READ_ONLY); fCombo.setFont(parent.getFont()); for (int i = 0; i < fEntryNamesAndValues.length; i++) { fCombo.add(fEntryNamesAndValues[i][0], i); } fCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { String oldValue = fValue; String name = fCombo.getText(); fValue = getValueForName(name); setPresentsDefaultValue(false); fireValueChanged(VALUE, oldValue, fValue); } }); } return fCombo; }
@Override protected Combo createControl(Composite parent) { Combo combo= new Combo(parent, SWT.SINGLE | SWT.READ_ONLY); combo.setFont(parent.getFont()); SWTUtil.setDefaultVisibleItemCount(combo); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String selected= fItems.get(fControl.getSelectionIndex()); for (ComboPreference pref : findPreferences(ComboPreference.class)) { int index= pref.fControl.indexOf(selected); if (index >= 0) pref.fControl.select(index); pref.updateValue(); } prepareControl(); } }); return combo; }
/** * Creates a combo box with the given parent, items, and selection * * @param parent the parent composite * @param items the items for the combo box * @param selectionIndex the index of the item to select * @return the combo box */ Combo createCombo(Composite parent, String[] items, int selectionIndex) { Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.setFont(parent.getFont()); combo.setItems(items); combo.select(selectionIndex); combo.addSelectionListener(selectionListener); return combo; }
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; }
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; }
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; }
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()); makeScrollableCompositeAware(comboBox); String currValue= getValue(key); comboBox.select(data.getSelection(currValue)); fComboBoxes.add(comboBox); return comboBox; }
private Combo getComboBoxControl(Composite parent) { if (fCombo == null) { fCombo = new Combo(parent, SWT.READ_ONLY); fCombo.setFont(parent.getFont()); for (int i = 0; i < fEntryNamesAndValues.length; i++) { fCombo.add(fEntryNamesAndValues[i][0], i); } fCombo.addSelectionListener(widgetSelectedAdapter(evt -> { String oldValue = fValue; String name = fCombo.getText(); fValue = getValueForName(name); setPresentsDefaultValue(false); fireValueChanged(VALUE, oldValue, fValue); })); } return fCombo; }
/** * @param parentComposite The composite on which the SWT widgets are added. * @param indent how many levels of indentation to apply. * @param label The label text for this Preference or {@code null} if none. * @param key The key to store the values. * @param values An array of n elements indicating the values to store for each selection. * @param items An array of n elements indicating the text to be written in the combo box. * @param highlight whether highlight arrow should be added. * @return a newly created ComboPreference. */ public static ComboPreference create(Composite parentComposite, int indent, String label, String key, String[] values, String[] items, boolean highlight) { Combo combo= new Combo(parentComposite, SWT.SINGLE | SWT.READ_ONLY); combo.setFont(parentComposite.getFont()); SWTUtil.setDefaultVisibleItemCount(combo); combo.setItems(items); combo.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_FILL, combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 0)); ComboPreference comboPreference= new ComboPreference(combo, label, key, values); comboPreference.addLabel(label, highlight, indent); return comboPreference; }