private void createControls(Composite parent) { Group container = new Group(parent, SWT.SHADOW_ETCHED_OUT); container.setText("General interpreter properties"); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); container.setLayoutData(data); container.setLayout(new GridLayout(1, false)); final Button saveButton = new Button(container, SWT.CHECK); saveButton.setText("Save file before loading in interpreter"); saveButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { mSaveBeforeLoad = saveButton.getSelection(); } }); saveButton.setSelection(mSaveBeforeLoad); final Button surroundButton = new Button(container, SWT.CHECK); surroundButton.setText("Surround expressions with (begin ... )"); surroundButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { mSurroundWithBegin = surroundButton.getSelection(); } }); surroundButton.setSelection(mSurroundWithBegin); }
/** Sets the state of the "Example" widgets. */ void setExampleWidgetState() { super.setExampleWidgetState(); Control[] controls = getExampleWidgets(); if (controls.length != 0) { leftButton.setSelection((controls[0].getStyle() & SWT.LEFT) != 0); centerButton.setSelection((controls[0].getStyle() & SWT.CENTER) != 0); rightButton.setSelection((controls[0].getStyle() & SWT.RIGHT) != 0); } }
private void showSelectedType(DBPConnectionType connectionType) { colorPicker.select(UIUtils.getConnectionTypeColor(connectionType)); typeName.setText(connectionType.getName()); typeDescription.setText(connectionType.getDescription()); autocommitCheck.setSelection(connectionType.isAutocommit()); confirmCheck.setSelection(connectionType.isConfirmExecute()); deleteButton.setEnabled(!connectionType.isPredefined()); }
@NotNull public static Button createLabelCheckbox( @NotNull Composite parent, @NotNull String label, @Nullable String tooltip, boolean checked, int style) { Label labelControl = createControlLabel(parent, label); // labelControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Button button = new Button(parent, SWT.CHECK | style); if (checked) { button.setSelection(true); } labelControl.addMouseListener( new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { if (!button.isDisposed() && button.isVisible() && button.isEnabled()) { button.setSelection(!button.getSelection()); button.notifyListeners(SWT.Selection, new Event()); } } }); if (tooltip != null) { labelControl.setToolTipText(tooltip); button.setToolTipText(tooltip); } return button; }
private void createOptionalDependenciesButton(Composite container) { if (isEditable()) { fIncludeOptionalButton = new Button(container, SWT.CHECK); fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional); // initialize value IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { fIncludeOptionalButton.setSelection( "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$ } catch (CoreException e) { } } // create listener to save value when the checkbox is changed fIncludeOptionalButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { file.setPersistentProperty( OPTIONAL_PROPERTY, fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$ } catch (CoreException e1) { } } } }); } }
protected void updateMaxOccur(int max) { if (fMaxOccurSpinner == null) return; boolean isMax = max == Integer.MAX_VALUE; fUnboundSelect.setSelection(isMax); fMaxOccurSpinner.setEnabled(!isMax); if (!isMax) fMaxOccurSpinner.setSelection(max); }
/** * Handle a dialog type combo selection event. * * @param event the selection event */ void dialogSelected(SelectionEvent event) { /* Enable/Disable the buttons */ String name = dialogCombo.getText(); boolean isMessageBox = name.equals(ControlExample.getResourceString("MessageBox")); boolean isFileDialog = name.equals(ControlExample.getResourceString("FileDialog")); okButton.setEnabled(isMessageBox); cancelButton.setEnabled(isMessageBox); yesButton.setEnabled(isMessageBox); noButton.setEnabled(isMessageBox); retryButton.setEnabled(isMessageBox); abortButton.setEnabled(isMessageBox); ignoreButton.setEnabled(isMessageBox); iconErrorButton.setEnabled(isMessageBox); iconInformationButton.setEnabled(isMessageBox); iconQuestionButton.setEnabled(isMessageBox); iconWarningButton.setEnabled(isMessageBox); iconWorkingButton.setEnabled(isMessageBox); noIconButton.setEnabled(isMessageBox); saveButton.setEnabled(isFileDialog); openButton.setEnabled(isFileDialog); multiButton.setEnabled(isFileDialog); /* Unselect the buttons */ if (!isMessageBox) { okButton.setSelection(false); cancelButton.setSelection(false); yesButton.setSelection(false); noButton.setSelection(false); retryButton.setSelection(false); abortButton.setSelection(false); ignoreButton.setSelection(false); } }
public static Button createCheckbox(Composite parent, String label, boolean checked) { final Button button = new Button(parent, SWT.CHECK); button.setText(label); if (checked) { button.setSelection(true); } return button; }
private void setButtonEnabled(String configKey, Button b, boolean enabled) { Boolean previousValue = oldBulkAPIDependencies.put(b, b.getSelection()); b.setSelection( enabled ? (previousValue != null ? previousValue : this.controller.getConfig().getBoolean(configKey)) : false); b.setEnabled(enabled); }
@Override public void refresh() { ISplashInfo info = getSplashInfo(); fBlockNotification = true; fColorSelector.setColorValue(hexToRGB(info.getForegroundColor())); int[] pgeo = info.getProgressGeometry(); boolean addProgress = pgeo != null; info.addProgressBar(addProgress, fBlockNotification); if (addProgress) { for (int i = 0; i < pgeo.length; i++) { fBarSpinners[i].setSelection(pgeo[i]); } } else { resetProgressBarGeometry(); } fAddBarButton.setSelection(addProgress); int[] mgeo = info.getMessageGeometry(); boolean addMessage = mgeo != null; info.addProgressMessage(addMessage, fBlockNotification); if (addMessage) { for (int i = 0; i < mgeo.length; i++) { fMessageSpinners[i].setSelection(mgeo[i]); } } else { resetProgressMessageGeometry(); } fColorSelector.setColorValue( addMessage ? hexToRGB(info.getForegroundColor()) : new RGB(0, 0, 0)); fAddMessageButton.setSelection(addMessage); // Update the UI updateUIFieldTemplateCombo(); fBlockNotification = false; super.refresh(); // Update this sections enablement updateFieldEnablement(); }
/** Creates the "Style" group. */ void createStyleGroup() { super.createStyleGroup(); /* Create the extra widgets */ horizontalButton = new Button(styleGroup, SWT.CHECK); horizontalButton.setText("SWT.H_SCROLL"); horizontalButton.setSelection(true); verticalButton = new Button(styleGroup, SWT.CHECK); verticalButton.setText("SWT.V_SCROLL"); verticalButton.setSelection(true); borderButton = new Button(styleGroup, SWT.CHECK); borderButton.setText("SWT.BORDER"); noBackgroundButton = new Button(styleGroup, SWT.CHECK); noBackgroundButton.setText("SWT.NO_BACKGROUND"); noFocusButton = new Button(styleGroup, SWT.CHECK); noFocusButton.setText("SWT.NO_FOCUS"); noMergePaintsButton = new Button(styleGroup, SWT.CHECK); noMergePaintsButton.setText("SWT.NO_MERGE_PAINTS"); noRedrawResizeButton = new Button(styleGroup, SWT.CHECK); noRedrawResizeButton.setText("SWT.NO_REDRAW_RESIZE"); }
private void createFilterOptions(Composite container) { fFilterOldVersionButton = SWTFactory.createCheckButton( container, PDEUIMessages.ImportWizard_DetailedPage_filterDesc, null, true, 1); if (getDialogSettings().get(SETTINGS_SHOW_LATEST) != null) fFilterOldVersionButton.setSelection(getDialogSettings().getBoolean(SETTINGS_SHOW_LATEST)); else fFilterOldVersionButton.setSelection(true); fFilterOldVersionButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fFilterOldVersionButton.getSelection()) { fAvailableListViewer.addFilter(fVersionFilter); } else { fAvailableListViewer.removeFilter(fVersionFilter); } updateCount(); } }); }
/** Sets the state of the "Example" widgets. */ void setExampleWidgetState() { super.setExampleWidgetState(); horizontalButton.setSelection((canvas.getStyle() & SWT.H_SCROLL) != 0); verticalButton.setSelection((canvas.getStyle() & SWT.V_SCROLL) != 0); borderButton.setSelection((canvas.getStyle() & SWT.BORDER) != 0); noBackgroundButton.setSelection((canvas.getStyle() & SWT.NO_BACKGROUND) != 0); noFocusButton.setSelection((canvas.getStyle() & SWT.NO_FOCUS) != 0); noMergePaintsButton.setSelection((canvas.getStyle() & SWT.NO_MERGE_PAINTS) != 0); noRedrawResizeButton.setSelection((canvas.getStyle() & SWT.NO_REDRAW_RESIZE) != 0); setCaret(); }
protected void initialize(IDialogSettings settings) { ISecurePreferences preferences = getPreferences(settings.getName()); if (preferences == null) { // only in case it is not possible to create secured storage in // default location -> in that case default values are used return; } String keystore = ""; // $NON-NLS-1$ String keypass = ""; // $NON-NLS-1$ String alias = ""; // $NON-NLS-1$ String password = ""; // $NON-NLS-1$ boolean signJars = false; if (preferences.keys().length <= 0) { // nothing stored in secured preferences, check settings for values // from before bug387565 fix keystore = getString(settings, S_KEYSTORE); keypass = getString(settings, S_KEYPASS); alias = getString(settings, S_ALIAS); password = getString(settings, S_PASSWORD); signJars = getBoolean(settings, S_SIGN_JARS); } else { // from secured preferences after bug387565 fix keystore = getString(preferences, S_KEYSTORE); keypass = getString(preferences, S_KEYPASS); alias = getString(preferences, S_ALIAS); password = getString(preferences, S_PASSWORD); signJars = getBoolean(preferences, S_SIGN_JARS); } fKeystoreText.setText(keystore); fKeypassText.setText(keypass); fAliasText.setText(alias); fPasswordText.setText(password); fButton.setSelection(signJars); updateGroup(fButton.getSelection()); }
/** * Creates the dialog's contents * * @param shell the dialog window */ private void createContents(final Shell shell) { final Config config = controller.getConfig(); // Create the ScrolledComposite to scroll horizontally and vertically ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); // Create the parent Composite container for the three child containers Composite container = new Composite(sc, SWT.NONE); GridLayout containerLayout = new GridLayout(1, false); container.setLayout(containerLayout); shell.setLayout(new FillLayout()); GridData data; data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 50; data.widthHint = 400; // START TOP COMPONENT Composite topComp = new Composite(container, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; topComp.setLayout(layout); topComp.setLayoutData(data); Label blank = new Label(topComp, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 10; blank.setLayoutData(data); blank.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); // Show the message Label label = new Label(topComp, SWT.NONE); label.setText(message); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 30; data.widthHint = 370; Font f = label.getFont(); FontData[] farr = f.getFontData(); FontData fd = farr[0]; fd.setStyle(SWT.BOLD); label.setFont(new Font(Display.getCurrent(), fd)); label.setLayoutData(data); label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL); labelSeparator.setLayoutData(data); // END TOP COMPONENT // START MIDDLE COMPONENT Composite restComp = new Composite(container, SWT.NONE); data = new GridData(GridData.FILL_BOTH); restComp.setLayoutData(data); layout = new GridLayout(2, false); layout.verticalSpacing = 10; restComp.setLayout(layout); // Hide welecome screen Label labelHideWelcomeScreen = new Label(restComp, SWT.RIGHT); labelHideWelcomeScreen.setText( Labels.getString("AdvancedSettingsDialog.hideWelcomeScreen")); // $NON-NLS-1$ labelHideWelcomeScreen.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonHideWelcomeScreen = new Button(restComp, SWT.CHECK); buttonHideWelcomeScreen.setSelection(config.getBoolean(Config.HIDE_WELCOME_SCREEN)); // batch size Label labelBatch = new Label(restComp, SWT.RIGHT); labelBatch.setText(Labels.getString("AdvancedSettingsDialog.batchSize")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelBatch.setLayoutData(data); textBatch = new Text(restComp, SWT.BORDER); textBatch.setText(config.getString(Config.LOAD_BATCH_SIZE)); textBatch.setTextLimit(8); textBatch.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 50; textBatch.setLayoutData(data); // insert Nulls Label labelNulls = new Label(restComp, SWT.RIGHT); labelNulls.setText(Labels.getString("AdvancedSettingsDialog.insertNulls")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelNulls.setLayoutData(data); buttonNulls = new Button(restComp, SWT.CHECK); buttonNulls.setSelection(config.getBoolean(Config.INSERT_NULLS)); // assignment rules Label labelRule = new Label(restComp, SWT.RIGHT); labelRule.setText(Labels.getString("AdvancedSettingsDialog.assignmentRule")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelRule.setLayoutData(data); textRule = new Text(restComp, SWT.BORDER); textRule.setTextLimit(18); data = new GridData(); data.widthHint = 115; textRule.setLayoutData(data); textRule.setText(config.getString(Config.ASSIGNMENT_RULE)); // endpoint Label labelEndpoint = new Label(restComp, SWT.RIGHT); labelEndpoint.setText(Labels.getString("AdvancedSettingsDialog.serverURL")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelEndpoint.setLayoutData(data); textEndpoint = new Text(restComp, SWT.BORDER); data = new GridData(); data.widthHint = 250; textEndpoint.setLayoutData(data); String endpoint = config.getString(Config.ENDPOINT); if ("".equals(endpoint)) { // $NON-NLS-1$ endpoint = defaultServer; } textEndpoint.setText(endpoint); // reset url on login Label labelResetUrl = new Label(restComp, SWT.RIGHT); labelResetUrl.setText( Labels.getString("AdvancedSettingsDialog.resetUrlOnLogin")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelResetUrl.setLayoutData(data); buttonResetUrl = new Button(restComp, SWT.CHECK); buttonResetUrl.setSelection(config.getBoolean(Config.RESET_URL_ON_LOGIN)); // insert compression Label labelCompression = new Label(restComp, SWT.RIGHT); labelCompression.setText(Labels.getString("AdvancedSettingsDialog.compression")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelCompression.setLayoutData(data); buttonCompression = new Button(restComp, SWT.CHECK); buttonCompression.setSelection(config.getBoolean(Config.NO_COMPRESSION)); // timeout size Label labelTimeout = new Label(restComp, SWT.RIGHT); labelTimeout.setText(Labels.getString("AdvancedSettingsDialog.timeout")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTimeout.setLayoutData(data); textTimeout = new Text(restComp, SWT.BORDER); textTimeout.setTextLimit(4); textTimeout.setText(config.getString(Config.TIMEOUT_SECS)); textTimeout.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 30; textTimeout.setLayoutData(data); // extraction batch size Label labelQueryBatch = new Label(restComp, SWT.RIGHT); labelQueryBatch.setText(Labels.getString("ExtractionInputDialog.querySize")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelQueryBatch.setLayoutData(data); textQueryBatch = new Text(restComp, SWT.BORDER); textQueryBatch.setText(config.getString(Config.EXTRACT_REQUEST_SIZE)); textQueryBatch.setTextLimit(4); textQueryBatch.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 30; textQueryBatch.setLayoutData(data); // enable/disable output of success file for extracts Label labelOutputExtractStatus = new Label(restComp, SWT.RIGHT); labelOutputExtractStatus.setText( Labels.getString("AdvancedSettingsDialog.outputExtractStatus")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOutputExtractStatus.setLayoutData(data); buttonOutputExtractStatus = new Button(restComp, SWT.CHECK); buttonOutputExtractStatus.setSelection(config.getBoolean(Config.ENABLE_EXTRACT_STATUS_OUTPUT)); // utf-8 for loading Label labelReadUTF8 = new Label(restComp, SWT.RIGHT); labelReadUTF8.setText(Labels.getString("AdvancedSettingsDialog.readUTF8")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelReadUTF8.setLayoutData(data); buttonReadUtf8 = new Button(restComp, SWT.CHECK); buttonReadUtf8.setSelection(config.getBoolean(Config.READ_UTF8)); // utf-8 for extraction Label labelWriteUTF8 = new Label(restComp, SWT.RIGHT); labelWriteUTF8.setText(Labels.getString("AdvancedSettingsDialog.writeUTF8")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelWriteUTF8.setLayoutData(data); buttonWriteUtf8 = new Button(restComp, SWT.CHECK); buttonWriteUtf8.setSelection(config.getBoolean(Config.WRITE_UTF8)); // European Dates Label labelEuropeanDates = new Label(restComp, SWT.RIGHT); labelEuropeanDates.setText( Labels.getString("AdvancedSettingsDialog.useEuropeanDateFormat")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelEuropeanDates.setLayoutData(data); buttonEuroDates = new Button(restComp, SWT.CHECK); buttonEuroDates.setSelection(config.getBoolean(Config.EURO_DATES)); // Field truncation Label labelTruncateFields = new Label(restComp, SWT.RIGHT); labelTruncateFields.setText(Labels.getString("AdvancedSettingsDialog.allowFieldTruncation")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTruncateFields.setLayoutData(data); buttonTruncateFields = new Button(restComp, SWT.CHECK); buttonTruncateFields.setSelection(config.getBoolean(Config.TRUNCATE_FIELDS)); Label labelCsvCommand = new Label(restComp, SWT.RIGHT); labelCsvCommand.setText(Labels.getString("AdvancedSettingsDialog.useCommaAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelCsvCommand.setLayoutData(data); buttonCsvComma = new Button(restComp, SWT.CHECK); buttonCsvComma.setSelection(config.getBoolean(Config.CSV_DELIMETER_COMMA)); Label labelTabCommand = new Label(restComp, SWT.RIGHT); labelTabCommand.setText(Labels.getString("AdvancedSettingsDialog.useTabAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTabCommand.setLayoutData(data); buttonCsvTab = new Button(restComp, SWT.CHECK); buttonCsvTab.setSelection(config.getBoolean(Config.CSV_DELIMETER_TAB)); Label labelOtherCommand = new Label(restComp, SWT.RIGHT); labelOtherCommand.setText(Labels.getString("AdvancedSettingsDialog.useOtherAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOtherCommand.setLayoutData(data); buttonCsvOther = new Button(restComp, SWT.CHECK); buttonCsvOther.setSelection(config.getBoolean(Config.CSV_DELIMETER_OTHER)); Label labelOtherDelimiterValue = new Label(restComp, SWT.RIGHT); labelOtherDelimiterValue.setText( Labels.getString("AdvancedSettingsDialog.csvOtherDelimiterValue")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOtherDelimiterValue.setLayoutData(data); textSplitterValue = new Text(restComp, SWT.BORDER); textSplitterValue.setText(config.getString(Config.CSV_DELIMETER_OTHER_VALUE)); data = new GridData(); data.widthHint = 25; textSplitterValue.setLayoutData(data); // Enable Bulk API Setting Label labelUseBulkApi = new Label(restComp, SWT.RIGHT); labelUseBulkApi.setText(Labels.getString("AdvancedSettingsDialog.useBulkApi")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelUseBulkApi.setLayoutData(data); boolean useBulkAPI = config.getBoolean(Config.BULK_API_ENABLED); buttonUseBulkApi = new Button(restComp, SWT.CHECK); buttonUseBulkApi.setSelection(useBulkAPI); buttonUseBulkApi.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); boolean enabled = buttonUseBulkApi.getSelection(); // update batch size when this setting changes int newDefaultBatchSize = controller.getConfig().getDefaultBatchSize(enabled); logger.info("Setting batch size to " + newDefaultBatchSize); textBatch.setText(String.valueOf(newDefaultBatchSize)); // make sure the appropriate check boxes are enabled or disabled initBulkApiSetting(enabled); } }); // Bulk API serial concurrency mode setting Label labelBulkApiSerialMode = new Label(restComp, SWT.RIGHT); labelBulkApiSerialMode.setText( Labels.getString("AdvancedSettingsDialog.bulkApiSerialMode")); // $NON-NLS-1$ labelBulkApiSerialMode.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonBulkApiSerialMode = new Button(restComp, SWT.CHECK); buttonBulkApiSerialMode.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE)); buttonBulkApiSerialMode.setEnabled(useBulkAPI); // Bulk API serial concurrency mode setting Label labelBulkApiZipContent = new Label(restComp, SWT.RIGHT); labelBulkApiZipContent.setText( Labels.getString("AdvancedSettingsDialog.bulkApiZipContent")); // $NON-NLS-1$ labelBulkApiZipContent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonBulkApiZipContent = new Button(restComp, SWT.CHECK); buttonBulkApiZipContent.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE)); buttonBulkApiZipContent.setEnabled(useBulkAPI); // timezone textTimezone = createTextInput( restComp, "AdvancedSettingsDialog.timezone", Config.TIMEZONE, TimeZone.getDefault().getID(), 200); // proxy Host Label labelProxyHost = new Label(restComp, SWT.RIGHT); labelProxyHost.setText(Labels.getString("AdvancedSettingsDialog.proxyHost")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyHost.setLayoutData(data); textProxyHost = new Text(restComp, SWT.BORDER); textProxyHost.setText(config.getString(Config.PROXY_HOST)); data = new GridData(); data.widthHint = 250; textProxyHost.setLayoutData(data); // Proxy Port Label labelProxyPort = new Label(restComp, SWT.RIGHT); labelProxyPort.setText(Labels.getString("AdvancedSettingsDialog.proxyPort")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyPort.setLayoutData(data); textProxyPort = new Text(restComp, SWT.BORDER); textProxyPort.setText(config.getString(Config.PROXY_PORT)); textProxyPort.setTextLimit(4); textProxyPort.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 25; textProxyPort.setLayoutData(data); // Proxy Username Label labelProxyUsername = new Label(restComp, SWT.RIGHT); labelProxyUsername.setText(Labels.getString("AdvancedSettingsDialog.proxyUser")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyUsername.setLayoutData(data); textProxyUsername = new Text(restComp, SWT.BORDER); textProxyUsername.setText(config.getString(Config.PROXY_USERNAME)); data = new GridData(); data.widthHint = 120; textProxyUsername.setLayoutData(data); // Proxy Password Label labelProxyPassword = new Label(restComp, SWT.RIGHT); labelProxyPassword.setText( Labels.getString("AdvancedSettingsDialog.proxyPassword")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyPassword.setLayoutData(data); textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD); textProxyPassword.setText(config.getString(Config.PROXY_PASSWORD)); data = new GridData(); data.widthHint = 120; textProxyPassword.setLayoutData(data); // proxy NTLM domain Label labelProxyNtlmDomain = new Label(restComp, SWT.RIGHT); labelProxyNtlmDomain.setText( Labels.getString("AdvancedSettingsDialog.proxyNtlmDomain")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyNtlmDomain.setLayoutData(data); textProxyNtlmDomain = new Text(restComp, SWT.BORDER); textProxyNtlmDomain.setText(config.getString(Config.PROXY_NTLM_DOMAIN)); data = new GridData(); data.widthHint = 250; textProxyNtlmDomain.setLayoutData(data); ////////////////////////////////////////////////// // Row to start At Label blankAgain = new Label(restComp, SWT.NONE); data = new GridData(); data.horizontalSpan = 2; blankAgain.setLayoutData(data); // Row to start AT Label labelLastRow = new Label(restComp, SWT.NONE); String lastBatch = controller.getConfig().getString(LastRun.LAST_LOAD_BATCH_ROW); if (lastBatch.equals("")) { // $NON-NLS-1$ lastBatch = "0"; // $NON-NLS-1$ } labelLastRow.setText( Labels.getFormattedString("AdvancedSettingsDialog.lastBatch", lastBatch)); // $NON-NLS-1$ data = new GridData(); data.horizontalSpan = 2; labelLastRow.setLayoutData(data); Label labelRowToStart = new Label(restComp, SWT.RIGHT); labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.startRow")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelRowToStart.setLayoutData(data); textRowToStart = new Text(restComp, SWT.BORDER); textRowToStart.setText(config.getString(Config.LOAD_ROW_TO_START_AT)); data = new GridData(); data.widthHint = 75; textRowToStart.setLayoutData(data); textRowToStart.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); // now that we've created all the buttons, make sure that buttons dependent on the bulk api // setting are enabled or disabled appropriately initBulkApiSetting(useBulkAPI); // the bottow separator Label labelSeparatorBottom = new Label(restComp, SWT.SEPARATOR | SWT.HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; labelSeparatorBottom.setLayoutData(data); // ok cancel buttons new Label(restComp, SWT.NONE); // END MIDDLE COMPONENT // START BOTTOM COMPONENT Composite buttonComp = new Composite(restComp, SWT.NONE); data = new GridData(GridData.HORIZONTAL_ALIGN_END); buttonComp.setLayoutData(data); buttonComp.setLayout(new GridLayout(2, false)); // Create the OK button and add a handler // so that pressing it will set input // to the entered value Button ok = new Button(buttonComp, SWT.PUSH | SWT.FLAT); ok.setText(Labels.getString("UI.ok")); // $NON-NLS-1$ ok.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { Config config = controller.getConfig(); // set the configValues config.setValue(Config.HIDE_WELCOME_SCREEN, buttonHideWelcomeScreen.getSelection()); config.setValue(Config.INSERT_NULLS, buttonNulls.getSelection()); config.setValue(Config.LOAD_BATCH_SIZE, textBatch.getText()); if (!buttonCsvComma.getSelection() && !buttonCsvTab.getSelection() && (!buttonCsvOther.getSelection() || textSplitterValue.getText() == null || textSplitterValue.getText().length() == 0)) { return; } config.setValue(Config.CSV_DELIMETER_OTHER_VALUE, textSplitterValue.getText()); config.setValue(Config.CSV_DELIMETER_COMMA, buttonCsvComma.getSelection()); config.setValue(Config.CSV_DELIMETER_TAB, buttonCsvTab.getSelection()); config.setValue(Config.CSV_DELIMETER_OTHER, buttonCsvOther.getSelection()); config.setValue(Config.EXTRACT_REQUEST_SIZE, textQueryBatch.getText()); config.setValue(Config.ENDPOINT, textEndpoint.getText()); config.setValue(Config.ASSIGNMENT_RULE, textRule.getText()); config.setValue(Config.LOAD_ROW_TO_START_AT, textRowToStart.getText()); config.setValue(Config.RESET_URL_ON_LOGIN, buttonResetUrl.getSelection()); config.setValue(Config.NO_COMPRESSION, buttonCompression.getSelection()); config.setValue(Config.TRUNCATE_FIELDS, buttonTruncateFields.getSelection()); config.setValue(Config.TIMEOUT_SECS, textTimeout.getText()); config.setValue( Config.ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection()); config.setValue(Config.READ_UTF8, buttonReadUtf8.getSelection()); config.setValue(Config.WRITE_UTF8, buttonWriteUtf8.getSelection()); config.setValue(Config.EURO_DATES, buttonEuroDates.getSelection()); config.setValue(Config.TIMEZONE, textTimezone.getText()); config.setValue(Config.PROXY_HOST, textProxyHost.getText()); config.setValue(Config.PROXY_PASSWORD, textProxyPassword.getText()); config.setValue(Config.PROXY_PORT, textProxyPort.getText()); config.setValue(Config.PROXY_USERNAME, textProxyUsername.getText()); config.setValue(Config.PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText()); config.setValue(Config.BULK_API_ENABLED, buttonUseBulkApi.getSelection()); config.setValue(Config.BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection()); config.setValue(Config.BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection()); controller.saveConfig(); controller.logout(); input = Labels.getString("UI.ok"); // $NON-NLS-1$ shell.close(); } }); data = new GridData(); data.widthHint = 75; ok.setLayoutData(data); // Create the cancel button and add a handler // so that pressing it will set input to null Button cancel = new Button(buttonComp, SWT.PUSH | SWT.FLAT); cancel.setText(Labels.getString("UI.cancel")); // $NON-NLS-1$ cancel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { input = null; shell.close(); } }); // END BOTTOM COMPONENT data = new GridData(); data.widthHint = 75; cancel.setLayoutData(data); // Set the OK button as the default, so // user can type input and press Enter // to dismiss shell.setDefaultButton(ok); // Set the child as the scrolled content of the ScrolledComposite sc.setContent(container); // Set the minimum size sc.setMinSize(768, 1024); // Expand both horizontally and vertically sc.setExpandHorizontal(true); sc.setExpandVertical(true); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionPage#targetChanged() */ protected void targetChanged(ITargetDefinition definition) { super.targetChanged(definition); if (definition != null) { // When If the page isn't open yet, try running a UI job so the dialog has time to finish // opening new UIJob(PDEUIMessages.TargetDefinitionContentPage_0) { public IStatus runInUIThread(IProgressMonitor monitor) { ITargetDefinition definition = getTargetDefinition(); if (!definition.isResolved()) { try { getContainer() .run( true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { getTargetDefinition().resolve(new ResolutionProgressMonitor(monitor)); if (monitor.isCanceled()) { throw new InterruptedException(); } } }); } catch (InvocationTargetException e) { PDECore.log(e); } catch (InterruptedException e) { fContentTree.setCancelled(); return Status.CANCEL_STATUS; } } fContentTree.setInput(definition); fLocationTree.setInput(definition); if (definition.isResolved() && definition.getStatus().getSeverity() == IStatus.ERROR) { fLocationTab.setImage( PlatformUI.getWorkbench() .getSharedImages() .getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); } else { fLocationTab.setImage(null); } return Status.OK_STATUS; } }.schedule(); String name = definition.getName(); if (name == null) { name = EMPTY_STRING; } if (name.trim().length() > 0) fNameText.setText(name); else setMessage(PDEUIMessages.TargetDefinitionContentPage_8); fLocationTree.setInput(definition); fContentTree.setInput(definition); String presetValue = (definition.getOS() == null) ? EMPTY_STRING : definition.getOS(); fOSCombo.setText(presetValue); presetValue = (definition.getWS() == null) ? EMPTY_STRING : definition.getWS(); fWSCombo.setText(presetValue); presetValue = (definition.getArch() == null) ? EMPTY_STRING : definition.getArch(); fArchCombo.setText(presetValue); presetValue = (definition.getNL() == null) ? EMPTY_STRING : LocaleUtil.expandLocaleName(definition.getNL()); fNLCombo.setText(presetValue); IPath jrePath = definition.getJREContainer(); if (jrePath == null || jrePath.equals(JavaRuntime.newDefaultJREContainerPath())) { fDefaultJREButton.setSelection(true); } else { String ee = JavaRuntime.getExecutionEnvironmentId(jrePath); if (ee != null) { fExecEnvButton.setSelection(true); fExecEnvsCombo.select(fExecEnvsCombo.indexOf(ee)); } else { String vm = JavaRuntime.getVMInstallName(jrePath); if (vm != null) { fNamedJREButton.setSelection(true); fNamedJREsCombo.select(fNamedJREsCombo.indexOf(vm)); } } } if (fExecEnvsCombo.getSelectionIndex() == -1) fExecEnvsCombo.setText(fExecEnvChoices.first().toString()); if (fNamedJREsCombo.getSelectionIndex() == -1) fNamedJREsCombo.setText(VMUtil.getDefaultVMInstallName()); updateJREWidgets(); presetValue = (definition.getProgramArguments() == null) ? EMPTY_STRING : definition.getProgramArguments(); fProgramArgs.setText(presetValue); presetValue = (definition.getVMArguments() == null) ? EMPTY_STRING : definition.getVMArguments(); fVMArgs.setText(presetValue); fElementViewer.refresh(); } }
/** Creates the "Control" widget children. */ void createControlWidgets() { /* Create the combo */ String[] strings = { ControlExample.getResourceString("ColorDialog"), ControlExample.getResourceString("DirectoryDialog"), ControlExample.getResourceString("FileDialog"), ControlExample.getResourceString("FontDialog"), ControlExample.getResourceString("PrintDialog"), ControlExample.getResourceString("MessageBox"), }; dialogCombo = new Combo(dialogStyleGroup, SWT.READ_ONLY); dialogCombo.setItems(strings); dialogCombo.setText(strings[0]); dialogCombo.setVisibleItemCount(strings.length); /* Create the create dialog button */ createButton = new Button(dialogStyleGroup, SWT.NONE); createButton.setText(ControlExample.getResourceString("Create_Dialog")); createButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); /* Create a group for the various dialog button style controls */ Group buttonStyleGroup = new Group(controlGroup, SWT.NONE); buttonStyleGroup.setLayout(new GridLayout()); buttonStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); buttonStyleGroup.setText(ControlExample.getResourceString("Button_Styles")); /* Create the button style buttons */ okButton = new Button(buttonStyleGroup, SWT.CHECK); okButton.setText("SWT.OK"); cancelButton = new Button(buttonStyleGroup, SWT.CHECK); cancelButton.setText("SWT.CANCEL"); yesButton = new Button(buttonStyleGroup, SWT.CHECK); yesButton.setText("SWT.YES"); noButton = new Button(buttonStyleGroup, SWT.CHECK); noButton.setText("SWT.NO"); retryButton = new Button(buttonStyleGroup, SWT.CHECK); retryButton.setText("SWT.RETRY"); abortButton = new Button(buttonStyleGroup, SWT.CHECK); abortButton.setText("SWT.ABORT"); ignoreButton = new Button(buttonStyleGroup, SWT.CHECK); ignoreButton.setText("SWT.IGNORE"); /* Create a group for the icon style controls */ Group iconStyleGroup = new Group(controlGroup, SWT.NONE); iconStyleGroup.setLayout(new GridLayout()); iconStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); iconStyleGroup.setText(ControlExample.getResourceString("Icon_Styles")); /* Create the icon style buttons */ iconErrorButton = new Button(iconStyleGroup, SWT.RADIO); iconErrorButton.setText("SWT.ICON_ERROR"); iconInformationButton = new Button(iconStyleGroup, SWT.RADIO); iconInformationButton.setText("SWT.ICON_INFORMATION"); iconQuestionButton = new Button(iconStyleGroup, SWT.RADIO); iconQuestionButton.setText("SWT.ICON_QUESTION"); iconWarningButton = new Button(iconStyleGroup, SWT.RADIO); iconWarningButton.setText("SWT.ICON_WARNING"); iconWorkingButton = new Button(iconStyleGroup, SWT.RADIO); iconWorkingButton.setText("SWT.ICON_WORKING"); noIconButton = new Button(iconStyleGroup, SWT.RADIO); noIconButton.setText(ControlExample.getResourceString("No_Icon")); /* Create a group for the modal style controls */ Group modalStyleGroup = new Group(controlGroup, SWT.NONE); modalStyleGroup.setLayout(new GridLayout()); modalStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); modalStyleGroup.setText(ControlExample.getResourceString("Modal_Styles")); /* Create the modal style buttons */ primaryModalButton = new Button(modalStyleGroup, SWT.RADIO); primaryModalButton.setText("SWT.PRIMARY_MODAL"); applicationModalButton = new Button(modalStyleGroup, SWT.RADIO); applicationModalButton.setText("SWT.APPLICATION_MODAL"); systemModalButton = new Button(modalStyleGroup, SWT.RADIO); systemModalButton.setText("SWT.SYSTEM_MODAL"); /* Create a group for the file dialog style controls */ Group fileDialogStyleGroup = new Group(controlGroup, SWT.NONE); fileDialogStyleGroup.setLayout(new GridLayout()); fileDialogStyleGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); fileDialogStyleGroup.setText(ControlExample.getResourceString("File_Dialog_Styles")); /* Create the file dialog style buttons */ openButton = new Button(fileDialogStyleGroup, SWT.RADIO); openButton.setText("SWT.OPEN"); saveButton = new Button(fileDialogStyleGroup, SWT.RADIO); saveButton.setText("SWT.SAVE"); multiButton = new Button(fileDialogStyleGroup, SWT.CHECK); multiButton.setText("SWT.MULTI"); /* Create the orientation group */ if (RTL_SUPPORT_ENABLE) { createOrientationGroup(); } /* Add the listeners */ dialogCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { dialogSelected(event); } }); createButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { createButtonSelected(event); } }); SelectionListener buttonStyleListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { buttonStyleSelected(event); } }; okButton.addSelectionListener(buttonStyleListener); cancelButton.addSelectionListener(buttonStyleListener); yesButton.addSelectionListener(buttonStyleListener); noButton.addSelectionListener(buttonStyleListener); retryButton.addSelectionListener(buttonStyleListener); abortButton.addSelectionListener(buttonStyleListener); ignoreButton.addSelectionListener(buttonStyleListener); /* Set default values for style buttons */ okButton.setEnabled(false); cancelButton.setEnabled(false); yesButton.setEnabled(false); noButton.setEnabled(false); retryButton.setEnabled(false); abortButton.setEnabled(false); ignoreButton.setEnabled(false); iconErrorButton.setEnabled(false); iconInformationButton.setEnabled(false); iconQuestionButton.setEnabled(false); iconWarningButton.setEnabled(false); iconWorkingButton.setEnabled(false); noIconButton.setEnabled(false); saveButton.setEnabled(false); openButton.setEnabled(false); openButton.setSelection(true); multiButton.setEnabled(false); noIconButton.setSelection(true); }
@Override public void createControl(final Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText("&Container:"); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); Button button = new Button(container, SWT.PUSH); button.setText("Browse..."); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleBrowse(); } }); label = new Label(container, SWT.NULL); label.setText("&Choose a model:"); Composite middleComposite = new Composite(container, SWT.NULL); FillLayout fillLayout = new FillLayout(); middleComposite.setLayout(fillLayout); emptyModelButton = new Button(middleComposite, SWT.RADIO); emptyModelButton.setText("Empty"); emptyModelButton.setSelection(true); skeletonModelButton = new Button(middleComposite, SWT.RADIO); skeletonModelButton.setText("Skeleton"); exampleModelButton = new Button(middleComposite, SWT.RADIO); exampleModelButton.setText("Example"); emptyModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "empty"; radioChanged(); } }); exampleModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "example"; radioChanged(); } }); skeletonModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "skeleton"; radioChanged(); } }); /* Need to add empty label so the next controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&File name:"); fileText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Text t = (Text) e.getSource(); String fname = t.getText(); int i = fname.lastIndexOf(".gaml"); if (i > 0) { // model title = filename less extension less all non alphanumeric characters titleText.setText(fname.substring(0, i).replaceAll("[^\\p{Alnum}]", "")); } /* * else if (fname.length()>0) { * int pos = t.getSelection().x; * fname = fname.replaceAll("[[^\\p{Alnum}]&&[^_-]&&[^\\x2E]]", "_"); * t.setText(fname+".gaml"); * t.setSelection(pos); * } else { * t.setText("new.gaml"); * } */ dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Author:"); authorText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); authorText.setLayoutData(gd); authorText.setText(getComputerFullName()); authorText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Model name:"); titleText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); titleText.setLayoutData(gd); titleText.setText("new"); titleText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Model description:"); descriptionText = new Text(container, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); descriptionText.setBounds(0, 0, 250, 100); gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.verticalSpan = 4; descriptionText.setLayoutData(gd); /* * Need to add seven empty labels in order to push next controls after the descriptionText * box. */ // TODO Dirty!! Change the way to do this for (int i = 0; i < 7; i++) { label = new Label(container, SWT.NULL); label.setText(""); } label = new Label(container, SWT.NULL); label.setText("&Create a html template \nfor the model description ?"); middleComposite = new Composite(container, SWT.NULL); fillLayout = new FillLayout(); middleComposite.setLayout(fillLayout); yesButton = new Button(middleComposite, SWT.RADIO); yesButton.setText("Yes"); yesButton.setSelection(true); Button noButton = new Button(middleComposite, SWT.RADIO); noButton.setText("No"); yesButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { dialogChanged(); } }); /* Finished adding the custom control */ initialize(); dialogChanged(); setControl(container); }