private void radioChanged() { if (exampleModelButton.getSelection()) { descriptionText.setText("This model displays an awesome simulation of something ..."); titleText.setText("example"); fileText.setText("example.gaml"); updateStatus(null); } if (emptyModelButton.getSelection() || skeletonModelButton.getSelection()) { descriptionText.setText(""); titleText.setText("new"); fileText.setText("new.gaml"); updateStatus(null); } dialogChanged(); }
protected void enableMinMax(boolean enable) { fMinOccurSpinner.setEnabled(enable); fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && enable); fUnboundSelect.setEnabled(enable); fMinLabel.setEnabled(enable); fMaxLabel.setEnabled(enable); }
protected void saveSettings(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 do not persist settings return; } try { preferences.putBoolean(S_SIGN_JARS, fButton.getSelection(), true); preferences.put(S_KEYSTORE, fKeystoreText.getText().trim(), true); preferences.put(S_ALIAS, fAliasText.getText().trim(), true); preferences.put(S_PASSWORD, fPasswordText.getText().trim(), true); preferences.put(S_KEYPASS, fKeypassText.getText().trim(), true); // bug387565 - for keys which are starting with this bugfix to be // stored // in secured storage, replace value in settings with empty string // to avoid keeping sensitive info in plain text String[] obsoleted = new String[] {S_KEYSTORE, S_ALIAS, S_PASSWORD, S_KEYPASS}; for (String key : obsoleted) { if (settings.get(key) != null) { settings.put(key, ""); // $NON-NLS-1$ } } } catch (StorageException e) { PDEPlugin.log( "Failed to store JarSigning settings in secured preferences store"); //$NON-NLS-1$ } }
/** * Handle a button style selection event. * * @param event the selection event */ void buttonStyleSelected(SelectionEvent event) { /* * Only certain combinations of button styles are * supported for various dialogs. Make sure the * control widget reflects only valid combinations. */ boolean ok = okButton.getSelection(); boolean cancel = cancelButton.getSelection(); boolean yes = yesButton.getSelection(); boolean no = noButton.getSelection(); boolean abort = abortButton.getSelection(); boolean retry = retryButton.getSelection(); boolean ignore = ignoreButton.getSelection(); okButton.setEnabled(!(yes || no || retry || abort || ignore)); cancelButton.setEnabled(!(abort || ignore || (yes != no))); yesButton.setEnabled(!(ok || retry || abort || ignore || (cancel && !yes && !no))); noButton.setEnabled(!(ok || retry || abort || ignore || (cancel && !yes && !no))); retryButton.setEnabled(!(ok || yes || no)); abortButton.setEnabled(!(ok || cancel || yes || no)); ignoreButton.setEnabled(!(ok || cancel || yes || no)); createButton.setEnabled( !(ok || cancel || yes || no || retry || abort || ignore) || ok || (ok && cancel) || (yes && no) || (yes && no && cancel) || (retry && cancel) || (abort && retry && ignore)); }
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); }
protected String[] getSigningInfo() { if (fButton.getSelection()) { return new String[] { fAliasText.getText().trim(), fKeystoreText.getText().trim(), fPasswordText.getText().trim(), fKeypassText.getText().trim() }; } return null; }
/** Creates the "Example" widgets. */ void createExampleWidgets() { /* Compute the widget style */ int style = getDefaultStyle(); if (horizontalButton.getSelection()) style |= SWT.H_SCROLL; if (verticalButton.getSelection()) style |= SWT.V_SCROLL; if (borderButton.getSelection()) style |= SWT.BORDER; if (noBackgroundButton.getSelection()) style |= SWT.NO_BACKGROUND; if (noFocusButton.getSelection()) style |= SWT.NO_FOCUS; if (noMergePaintsButton.getSelection()) style |= SWT.NO_MERGE_PAINTS; if (noRedrawResizeButton.getSelection()) style |= SWT.NO_REDRAW_RESIZE; /* Create the example widgets */ paintCount = 0; cx = 0; cy = 0; canvas = new Canvas(canvasGroup, style); canvas.addPaintListener( new PaintListener() { public void paintControl(PaintEvent e) { paintCount++; GC gc = e.gc; if (fillDamageButton.getSelection()) { Color color = e.display.getSystemColor(colors[paintCount % colors.length]); gc.setBackground(color); gc.fillRectangle(e.x, e.y, e.width, e.height); } Point size = canvas.getSize(); gc.drawArc(cx + 1, cy + 1, size.x - 2, size.y - 2, 0, 360); gc.drawRectangle(cx + (size.x - 10) / 2, cy + (size.y - 10) / 2, 10, 10); } }); canvas.addControlListener( new ControlAdapter() { public void controlResized(ControlEvent event) { Point size = canvas.getSize(); maxX = size.x * 3 / 2; maxY = size.y * 3 / 2; resizeScrollBars(); } }); ScrollBar bar = canvas.getHorizontalBar(); if (bar != null) { bar.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollHorizontal((ScrollBar) event.widget); } }); } bar = canvas.getVerticalBar(); if (bar != null) { bar.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { scrollVertical((ScrollBar) event.widget); } }); } }
protected String validate() { String error = null; if (fButton.getSelection()) { if (fKeystoreText.getText().trim().length() == 0) { error = PDEUIMessages.AdvancedPluginExportPage_noKeystore; } else if (fAliasText.getText().trim().length() == 0) { error = PDEUIMessages.AdvancedPluginExportPage_noAlias; } else if (fPasswordText.getText().trim().length() == 0) { error = PDEUIMessages.AdvancedPluginExportPage_noPassword; } } return error; }
/** Sets or clears the caret in the "Example" widget. */ void setCaret() { Caret oldCaret = canvas.getCaret(); if (caretButton.getSelection()) { Caret newCaret = new Caret(canvas, SWT.NONE); Font font = canvas.getFont(); newCaret.setFont(font); GC gc = new GC(canvas); gc.setFont(font); newCaret.setBounds(1, 1, 1, gc.getFontMetrics().getHeight()); gc.dispose(); canvas.setCaret(newCaret); canvas.setFocus(); } else { canvas.setCaret(null); } if (oldCaret != null) oldCaret.dispose(); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#buttonSelected(int) */ protected void buttonSelected(int index) { switch (index) { case 0: handleAdd(); break; case 1: handleAddWorkingSet(); break; case 2: handleAddRequired(getProduct().getPlugins(), fIncludeOptionalButton.getSelection()); break; case 3: handleDelete(); break; case 4: handleRemoveAll(); break; case 5: handleProperties(); break; } }
private void addFilters() { fVersionFilter = new VersionFilter(); fVersionFilter.setModel(fModels); fSourceFilter = new SourcePluginFilter(fPage1.getState()); fAvailableFilter = new AvailableFilter(); fAvailableListViewer.addFilter(fAvailableFilter); if (fFilterOldVersionButton.getSelection()) { fAvailableListViewer.addFilter(fVersionFilter); } fAvailableListViewer.addFilter(fSourceFilter); fRepositoryFilter = new RepositoryFilter(); fAvailableListViewer.addFilter(fRepositoryFilter); fFilterJob = new WorkbenchJob("FilterJob") { // $NON-NLS-1$ @Override public IStatus runInUIThread(IProgressMonitor monitor) { handleFilter(); return Status.OK_STATUS; } }; fFilterJob.setSystem(true); }
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()); }
@Override public void widgetSelected(SelectionEvent e) { Button selectedButton = (Button) e.widget; if (!selectedButton.getSelection()) return; for (int i = 0; i < 3; i++) if (selectedButton == buttons[i]) pickAncestor(i); }
public boolean includeOptionalDependencies() { return fIncludeOptionalButton.getSelection(); }
@Override public void storeSettings() { IDialogSettings settings = getDialogSettings(); settings.put(SETTINGS_SHOW_LATEST, fFilterOldVersionButton.getSelection()); super.storeSettings(); }
private void createMultiUserGroup(Composite parent) { final Group multiUserGroup = NSISWizardDialogUtil.createGroup( parent, 2, "MultiUser Installation", null, false); // $NON-NLS-1$ GridData data = (GridData) multiUserGroup.getLayoutData(); data.verticalAlignment = SWT.FILL; data.horizontalAlignment = SWT.FILL; data.grabExcessHorizontalSpace = true; NSISWizardSettings settings = mWizard.getSettings(); Composite composite = new Composite(multiUserGroup, SWT.NONE); data = new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); final Button multiUser = NSISWizardDialogUtil.createCheckBox( composite, EclipseNSISPlugin.getResourceString("enable.multiuser.label"), // $NON-NLS-1$ settings.isMultiUserInstallation(), settings.getInstallerType() == INSTALLER_TYPE_MUI2, null, false); multiUser.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selection = multiUser.getSelection(); mWizard.getSettings().setMultiUserInstallation(selection); validateField(MULTIUSER_CHECK); } }); final MasterSlaveController m = new MasterSlaveController(multiUser); boolean enabled = multiUser.isEnabled() && multiUser.getSelection(); final Combo execLevel = NSISWizardDialogUtil.createCombo( composite, NSISWizardDisplayValues.MULTIUSER_EXEC_LEVELS, settings.getMultiUserExecLevel(), true, EclipseNSISPlugin.getResourceString("multiuser.exec.level.label"), // $NON-NLS-1$ enabled, m, false); ((GridData) execLevel.getLayoutData()).horizontalAlignment = SWT.FILL; ((GridData) execLevel.getLayoutData()).grabExcessHorizontalSpace = true; final Group instModeGroup = NSISWizardDialogUtil.createGroup( multiUserGroup, 1, "Installation Mode", m, false); // $NON-NLS-1$ data = (GridData) instModeGroup.getLayoutData(); data.verticalAlignment = SWT.FILL; data.horizontalAlignment = SWT.FILL; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 1; MasterSlaveEnabler mse = new MasterSlaveEnabler() { public void enabled(Control control, boolean flag) {} public boolean canEnable(Control c) { return isMultiUser(); } }; m.addSlave(execLevel, mse); enabled = enabled && execLevel.getSelectionIndex() != MULTIUSER_EXEC_LEVEL_STANDARD; mse = new MasterSlaveEnabler() { public void enabled(Control control, boolean flag) {} public boolean canEnable(Control c) { return isMultiUser() && mWizard.getSettings().getMultiUserExecLevel() != MULTIUSER_EXEC_LEVEL_STANDARD; } }; execLevel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mWizard.getSettings().setMultiUserExecLevel(execLevel.getSelectionIndex()); m.updateSlaves(); validateField(MULTIUSER_CHECK); } }); final Combo instMode = NSISWizardDialogUtil.createCombo( instModeGroup, NSISWizardDisplayValues.MULTIUSER_INSTALL_MODES, settings.getMultiUserInstallMode(), true, EclipseNSISPlugin.getResourceString("multiuser.install.mode.label"), enabled, m, false); //$NON-NLS-1$ ((GridData) instMode.getLayoutData()).grabExcessHorizontalSpace = true; ((GridData) instMode.getLayoutData()).horizontalAlignment = SWT.FILL; instMode.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mWizard.getSettings().setMultiUserInstallMode(instMode.getSelectionIndex()); validateField(MULTIUSER_CHECK); } }); m.addSlave(instMode, mse); composite = new Composite(instModeGroup, SWT.NONE); data = new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); layout = new GridLayout(2, true); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); final Button instModeRemember = NSISWizardDialogUtil.createCheckBox( composite, EclipseNSISPlugin.getResourceString("multiuser.install.mode.remember.label"), settings.isMultiUserInstallModeRemember(), // $NON-NLS-1$ enabled, m, false); ((GridData) instModeRemember.getLayoutData()).horizontalSpan = 1; instModeRemember.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mWizard.getSettings().setMultiUserInstallModeRemember(instModeRemember.getSelection()); validateField(MULTIUSER_CHECK); } }); m.addSlave(instModeRemember, mse); final Button instModeAsk = NSISWizardDialogUtil.createCheckBox( composite, EclipseNSISPlugin.getResourceString("multiuser.install.mode.ask.label"), settings.isMultiUserInstallModeAsk(), // $NON-NLS-1$ enabled, m, false); ((GridData) instModeAsk.getLayoutData()).horizontalSpan = 1; instModeAsk.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mWizard.getSettings().setMultiUserInstallModeAsk(instModeAsk.getSelection()); validateField(MULTIUSER_CHECK); } }); m.addSlave(instModeAsk, mse); m.updateSlaves(); addPageChangedRunnable( new Runnable() { public void run() { if (isCurrentPage()) { NSISWizardDialogUtil.setEnabled( multiUser, mWizard.getSettings().getInstallerType() == INSTALLER_TYPE_MUI2); m.updateSlaves(); } } }); mWizard.addSettingsListener( new INSISWizardSettingsListener() { public void settingsChanged( NSISWizardSettings oldSettings, NSISWizardSettings newSettings) { NSISWizardSettings settings = mWizard.getSettings(); multiUser.setSelection(settings.isMultiUserInstallation()); execLevel.select(settings.getMultiUserExecLevel()); instMode.select(settings.getMultiUserInstallMode()); instModeRemember.setSelection(settings.isMultiUserInstallModeRemember()); instModeAsk.setSelection(settings.isMultiUserInstallModeAsk()); NSISWizardDialogUtil.setEnabled( multiUser, settings.getInstallerType() == INSTALLER_TYPE_MUI2); m.updateSlaves(); } }); }
/** Return true if the user wants a html template, and false otherwise */ public Boolean getValueHtmlTemplate() { return yesButton.getSelection(); }
/** * Handle the create button selection event. * * @param event org.eclipse.swt.events.SelectionEvent */ void createButtonSelected(SelectionEvent event) { /* Compute the appropriate dialog style */ int style = getDefaultStyle(); if (okButton.getEnabled() && okButton.getSelection()) style |= SWT.OK; if (cancelButton.getEnabled() && cancelButton.getSelection()) style |= SWT.CANCEL; if (yesButton.getEnabled() && yesButton.getSelection()) style |= SWT.YES; if (noButton.getEnabled() && noButton.getSelection()) style |= SWT.NO; if (retryButton.getEnabled() && retryButton.getSelection()) style |= SWT.RETRY; if (abortButton.getEnabled() && abortButton.getSelection()) style |= SWT.ABORT; if (ignoreButton.getEnabled() && ignoreButton.getSelection()) style |= SWT.IGNORE; if (iconErrorButton.getEnabled() && iconErrorButton.getSelection()) style |= SWT.ICON_ERROR; if (iconInformationButton.getEnabled() && iconInformationButton.getSelection()) style |= SWT.ICON_INFORMATION; if (iconQuestionButton.getEnabled() && iconQuestionButton.getSelection()) style |= SWT.ICON_QUESTION; if (iconWarningButton.getEnabled() && iconWarningButton.getSelection()) style |= SWT.ICON_WARNING; if (iconWorkingButton.getEnabled() && iconWorkingButton.getSelection()) style |= SWT.ICON_WORKING; if (primaryModalButton.getEnabled() && primaryModalButton.getSelection()) style |= SWT.PRIMARY_MODAL; if (applicationModalButton.getEnabled() && applicationModalButton.getSelection()) style |= SWT.APPLICATION_MODAL; if (systemModalButton.getEnabled() && systemModalButton.getSelection()) style |= SWT.SYSTEM_MODAL; if (saveButton.getEnabled() && saveButton.getSelection()) style |= SWT.SAVE; if (openButton.getEnabled() && openButton.getSelection()) style |= SWT.OPEN; if (multiButton.getEnabled() && multiButton.getSelection()) style |= SWT.MULTI; /* Open the appropriate dialog type */ String name = dialogCombo.getText(); if (name.equals(ControlExample.getResourceString("ColorDialog"))) { ColorDialog dialog = new ColorDialog(shell, style); dialog.setRGB(new RGB(100, 100, 100)); dialog.setText(ControlExample.getResourceString("Title")); RGB result = dialog.open(); textWidget.append(ControlExample.getResourceString("ColorDialog") + Text.DELIMITER); textWidget.append( ControlExample.getResourceString("Result", new String[] {"" + result}) + Text.DELIMITER); textWidget.append("getRGB() = " + dialog.getRGB() + Text.DELIMITER + Text.DELIMITER); return; } if (name.equals(ControlExample.getResourceString("DirectoryDialog"))) { DirectoryDialog dialog = new DirectoryDialog(shell, style); dialog.setMessage(ControlExample.getResourceString("Example_string")); dialog.setText(ControlExample.getResourceString("Title")); String result = dialog.open(); textWidget.append(ControlExample.getResourceString("DirectoryDialog") + Text.DELIMITER); textWidget.append( ControlExample.getResourceString("Result", new String[] {"" + result}) + Text.DELIMITER + Text.DELIMITER); return; } if (name.equals(ControlExample.getResourceString("FileDialog"))) { FileDialog dialog = new FileDialog(shell, style); dialog.setFileName(ControlExample.getResourceString("readme_txt")); dialog.setFilterNames(FilterNames); dialog.setFilterExtensions(FilterExtensions); dialog.setText(ControlExample.getResourceString("Title")); String result = dialog.open(); textWidget.append(ControlExample.getResourceString("FileDialog") + Text.DELIMITER); textWidget.append( ControlExample.getResourceString("Result", new String[] {"" + result}) + Text.DELIMITER); textWidget.append("getFileNames() =" + Text.DELIMITER); if ((dialog.getStyle() & SWT.MULTI) != 0) { String[] files = dialog.getFileNames(); for (int i = 0; i < files.length; i++) { textWidget.append("\t" + files[i] + Text.DELIMITER); } } textWidget.append( "getFilterIndex() = " + dialog.getFilterIndex() + Text.DELIMITER + Text.DELIMITER); return; } if (name.equals(ControlExample.getResourceString("FontDialog"))) { FontDialog dialog = new FontDialog(shell, style); dialog.setText(ControlExample.getResourceString("Title")); FontData result = dialog.open(); textWidget.append(ControlExample.getResourceString("FontDialog") + Text.DELIMITER); textWidget.append( ControlExample.getResourceString("Result", new String[] {"" + result}) + Text.DELIMITER); textWidget.append("getFontList() =" + Text.DELIMITER); FontData[] fonts = dialog.getFontList(); if (fonts != null) { for (int i = 0; i < fonts.length; i++) { textWidget.append("\t" + fonts[i] + Text.DELIMITER); } } textWidget.append("getRGB() = " + dialog.getRGB() + Text.DELIMITER + Text.DELIMITER); return; } if (name.equals(ControlExample.getResourceString("PrintDialog"))) { PrintDialog dialog = new PrintDialog(shell, style); dialog.setText(ControlExample.getResourceString("Title")); PrinterData result = dialog.open(); textWidget.append(ControlExample.getResourceString("PrintDialog") + Text.DELIMITER); textWidget.append( ControlExample.getResourceString("Result", new String[] {"" + result}) + Text.DELIMITER); textWidget.append("getScope() = " + dialog.getScope() + Text.DELIMITER); textWidget.append("getStartPage() = " + dialog.getStartPage() + Text.DELIMITER); textWidget.append("getEndPage() = " + dialog.getEndPage() + Text.DELIMITER); textWidget.append( "getPrintToFile() = " + dialog.getPrintToFile() + Text.DELIMITER + Text.DELIMITER); return; } if (name.equals(ControlExample.getResourceString("MessageBox"))) { MessageBox dialog = new MessageBox(shell, style); dialog.setMessage(ControlExample.getResourceString("Example_string")); dialog.setText(ControlExample.getResourceString("Title")); int result = dialog.open(); textWidget.append(ControlExample.getResourceString("MessageBox") + Text.DELIMITER); /* * The resulting integer depends on the original * dialog style. Decode the result and display it. */ switch (result) { case SWT.OK: textWidget.append(ControlExample.getResourceString("Result", new String[] {"SWT.OK"})); break; case SWT.YES: textWidget.append(ControlExample.getResourceString("Result", new String[] {"SWT.YES"})); break; case SWT.NO: textWidget.append(ControlExample.getResourceString("Result", new String[] {"SWT.NO"})); break; case SWT.CANCEL: textWidget.append( ControlExample.getResourceString("Result", new String[] {"SWT.CANCEL"})); break; case SWT.ABORT: textWidget.append(ControlExample.getResourceString("Result", new String[] {"SWT.ABORT"})); break; case SWT.RETRY: textWidget.append(ControlExample.getResourceString("Result", new String[] {"SWT.RETRY"})); break; case SWT.IGNORE: textWidget.append( ControlExample.getResourceString("Result", new String[] {"SWT.IGNORE"})); break; default: textWidget.append(ControlExample.getResourceString("Result", new String[] {"" + result})); break; } textWidget.append(Text.DELIMITER + Text.DELIMITER); } }
private void updateFieldProgressMessageEnablement(boolean buttonEnabled) { boolean enable = (fAddMessageButton.getSelection() && buttonEnabled); for (Control messageControl : fMessageControls) { messageControl.setEnabled(enable); } }
private void updateFieldProgressBarEnablement(boolean buttonEnabled) { boolean enable = (fAddBarButton.getSelection() && buttonEnabled); for (Control barControl : fBarControls) { barControl.setEnabled(enable); } }
protected void updateJREWidgets() { fNamedJREsCombo.setEnabled(fNamedJREButton.getSelection()); fExecEnvsCombo.setEnabled(fExecEnvButton.getSelection()); }