protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) { fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel); fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(3, false); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMaxOccurSpinner = new Spinner(comp, SWT.BORDER); fMaxOccurSpinner.setMinimum(1); fMaxOccurSpinner.setMaximum(999); fMaxOccurSpinner.setIncrement(1); fUnboundSelect = toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK); gd = new GridData(); gd.horizontalIndent = 10; fUnboundSelect.setLayoutData(gd); fUnboundSelect.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (blockListeners()) return; fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement()); } }); return comp; }
private Spinner createSpinner(Composite parent, FormToolkit toolkit) { Spinner spinner = new Spinner(parent, SWT.BORDER); spinner.setMinimum(0); spinner.setMaximum(9999); toolkit.adapt(spinner, false, false); return spinner; }
@NotNull public static Spinner createLabelSpinner( @NotNull Composite parent, @NotNull String label, int value, int minimum, int maximum) { createControlLabel(parent, label); Spinner spinner = new Spinner(parent, SWT.BORDER); spinner.setMinimum(minimum); spinner.setMaximum(maximum); spinner.setSelection(value); return spinner; }
protected Composite createMinOccurComp(Composite parent, FormToolkit toolkit) { fMinLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_minOccurLabel); fMinLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMinOccurSpinner = new Spinner(comp, SWT.BORDER); fMinOccurSpinner.setMinimum(0); fMinOccurSpinner.setMaximum(999); return comp; }