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; }
private void createProgressMessageConfig(Composite parent) { fAddMessageButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressMessage); fAddMessageButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddMessageButton.getSelection(); getSplashInfo().addProgressMessage(enable, false); updateFieldEnablement(); } }); fAddMessageButton.setEnabled(false); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fMessageControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageX); fMessageControls[1] = fMessageSpinners[0] = createSpinner(parent, fToolkit); fMessageControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageY); fMessageControls[3] = fMessageSpinners[1] = createSpinner(parent, fToolkit); fMessageControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageWidth); fMessageControls[5] = fMessageSpinners[2] = createSpinner(parent, fToolkit); fMessageControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageHeight); fMessageControls[7] = fMessageSpinners[3] = createSpinner(parent, fToolkit); fMessageControls[8] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageColor); fColorSelector = new ColorSelector(parent); fColorSelector.addListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (!event.getNewValue().equals(event.getOldValue())) applyColor(); } }); fToolkit.adapt(fColorSelector.getButton(), true, true); fMessageControls[9] = fColorSelector.getButton(); // Add tooltips to coordinate controls addOffsetTooltips(fMessageControls); for (Spinner spinner : fMessageSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(false); } }); } }
private void createProgressBarConfig(Composite parent) { fAddBarButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressBar); fAddBarButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddBarButton.getSelection(); getSplashInfo().addProgressBar(enable, false); updateFieldEnablement(); } }); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.verticalIndent = 5; data.horizontalSpan = F_NUM_COLUMNS; fAddBarButton.setLayoutData(data); fAddBarButton.setEnabled(isEditable()); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fBarControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressX); fBarControls[1] = fBarSpinners[0] = createSpinner(parent, fToolkit); fBarControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressY); fBarControls[3] = fBarSpinners[1] = createSpinner(parent, fToolkit); fBarControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressWidth); fBarControls[5] = fBarSpinners[2] = createSpinner(parent, fToolkit); fBarControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressHeight); fBarControls[7] = fBarSpinners[3] = createSpinner(parent, fToolkit); // Add tooltips to coordinate controls addOffsetTooltips(fBarControls); for (Spinner spinner : fBarSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(true); } }); } Composite filler = fToolkit.createComposite(parent); filler.setLayout(new GridLayout()); GridData gd = new GridData(); gd.horizontalSpan = 2; filler.setLayoutData(gd); }