List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_TO_ALL_ID
int NO_TO_ALL_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_TO_ALL_ID.
Click Source Link
From source file:net.sf.eclipsensis.wizard.NSISWizardContentsPage.java
License:Open Source License
/** * @param tv// w ww .j a v a 2 s. co m * @param sel */ private void deleteElements(final TreeViewer tv, ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) sel; if (!ssel.isEmpty()) { try { int buttonId = -1; for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) { INSISInstallElement element = (INSISInstallElement) iter.next(); if (element.hasChildren()) { if (buttonId == IDialogConstants.NO_TO_ALL_ID) { continue; } else if (buttonId != IDialogConstants.YES_TO_ALL_ID) { int index = new MessageDialog(getShell(), cDeleteConfirmTitle, EclipseNSISPlugin.getShellImage(), MessageFormat .format(cDeleteConfirmMessageFormat, new Object[] { element.getDisplayName() }), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, 0).open(); if (index >= 0) { buttonId = cDeleteConfirmButtonIds[index]; } else { return; } if (buttonId == IDialogConstants.NO_ID || buttonId == IDialogConstants.NO_TO_ALL_ID) { continue; } } } INSISInstallElement parent = element.getParent(); if (parent != null) { parent.removeChild(element); tv.refresh(parent, true); } } setPageComplete(validatePage(VALIDATE_ALL)); } catch (Exception ex) { delayedValidateAfterError(ex.getLocalizedMessage(), 2000); } finally { tv.refresh(false); } } } }
From source file:org.bonitasoft.studio.common.jface.MessageDialogWithPrompt.java
License:Open Source License
protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); boolean toggleState = getToggleState(); IPreferenceStore prefStore = getPrefStore(); String prefKey = getPrefKey(); if (buttonId != IDialogConstants.CANCEL_ID && toggleState && prefStore != null && prefKey != null) { switch (buttonId) { case IDialogConstants.YES_ID: case IDialogConstants.YES_TO_ALL_ID: case IDialogConstants.PROCEED_ID: case IDialogConstants.OK_ID: prefStore.setValue(prefKey, toggleState); break; case IDialogConstants.NO_ID: case IDialogConstants.NO_TO_ALL_ID: break; }//from w w w . j a v a 2s .com } }
From source file:org.ebayopensource.vjet.eclipse.internal.ui.dialogs.UnknownContentTypeDialog.java
License:Open Source License
protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); // overwritten so that value stored is boolean, not string if (buttonId != IDialogConstants.CANCEL_ID && getToggleState() && getPrefStore() != null && getPrefKey() != null) { switch (buttonId) { case IDialogConstants.YES_ID: case IDialogConstants.YES_TO_ALL_ID: case IDialogConstants.PROCEED_ID: case IDialogConstants.OK_ID: getPrefStore().setValue(getPrefKey(), false); break; case IDialogConstants.NO_ID: case IDialogConstants.NO_TO_ALL_ID: getPrefStore().setValue(getPrefKey(), true); break; }/*from w w w. j av a2 s.c o m*/ } }
From source file:org.eclipse.cdt.make.internal.ui.dnd.MakeTargetDndUtil.java
License:Open Source License
/** * Overwrite Make Target dialog./*from ww w . j ava2 s. c o m*/ * * @param name - name of make target to display to a user. * @param shell - shell where to display the dialog. * * @return user's answer. */ private static int overwriteMakeTargetDialog(String name, Shell shell) { if (lastUserAnswer == IDialogConstants.YES_TO_ALL_ID || lastUserAnswer == IDialogConstants.NO_TO_ALL_ID || lastUserAnswer == RENAME_TO_ALL_ID) { return lastUserAnswer; } String labels[] = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, MakeUIPlugin.getResourceString("MakeTargetDnD.button.rename"), //$NON-NLS-1$ IDialogConstants.CANCEL_LABEL, }; String title = MakeUIPlugin.getResourceString("MakeTargetDnD.title.overwriteTargetConfirm"); //$NON-NLS-1$ String question = MessageFormat.format( MakeUIPlugin.getResourceString("MakeTargetDnD.message.overwriteTargetConfirm"), //$NON-NLS-1$ new Object[] { name }); String toggleApplyToAll = MakeUIPlugin.getResourceString("MakeTargetDnD.toggle.applyToAll"); //$NON-NLS-1$ MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, question, MessageDialog.QUESTION, labels, 0, toggleApplyToAll, false); try { dialog.open(); lastUserAnswer = dialog.getReturnCode(); boolean toAll = dialog.getToggleState(); if (toAll && lastUserAnswer == IDialogConstants.YES_ID) { lastUserAnswer = IDialogConstants.YES_TO_ALL_ID; } else if (toAll && lastUserAnswer == IDialogConstants.NO_ID) { lastUserAnswer = IDialogConstants.NO_TO_ALL_ID; } else if (toAll && lastUserAnswer == RENAME_ID) { lastUserAnswer = RENAME_TO_ALL_ID; } } catch (SWTException e) { MakeUIPlugin.log(e); lastUserAnswer = IDialogConstants.CANCEL_ID; } if (lastUserAnswer == SWT.DEFAULT) { // A window close returns SWT.DEFAULT, which has to be // mapped to a cancel lastUserAnswer = IDialogConstants.CANCEL_ID; } return lastUserAnswer; }
From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java
License:Open Source License
/** * Attempt to find a standard JFace button id that matches the specified * button label. If no match can be found, use the default id provided. * /*from ww w .ja v a 2s . c o m*/ * Overridden to investigate the provided buttons. * * @param buttonLabel * the button label whose id is sought * @param defaultId * the id to use for the button if there is no standard id * @return the id for the specified button label */ // CHECKSTYLE:OFF private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) { // CHECKSTYLE:OON // Not pretty but does the job... if (IDialogConstants.OK_LABEL.equals(buttonLabel)) { return IDialogConstants.OK_ID; } if (IDialogConstants.YES_LABEL.equals(buttonLabel)) { return IDialogConstants.YES_ID; } if (IDialogConstants.NO_LABEL.equals(buttonLabel)) { return IDialogConstants.NO_ID; } if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) { return IDialogConstants.CANCEL_ID; } if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) { return IDialogConstants.YES_TO_ALL_ID; } if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) { return IDialogConstants.SKIP_ID; } if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) { return IDialogConstants.STOP_ID; } if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) { return IDialogConstants.ABORT_ID; } if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) { return IDialogConstants.RETRY_ID; } if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) { return IDialogConstants.IGNORE_ID; } if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) { return IDialogConstants.PROCEED_ID; } if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) { return IDialogConstants.OPEN_ID; } if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) { return IDialogConstants.CLOSE_ID; } if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) { return IDialogConstants.BACK_ID; } if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) { return IDialogConstants.NEXT_ID; } if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) { return IDialogConstants.FINISH_ID; } if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) { return IDialogConstants.HELP_ID; } if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) { return IDialogConstants.NO_TO_ALL_ID; } if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) { return IDialogConstants.DETAILS_ID; } if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) { return IDialogConstants.DETAILS_ID; } for (String providedButton : buttonsMap.keySet()) { if (providedButton.equals(buttonLabel)) { return buttonsMap.get(providedButton); } } // No XXX_LABEL in IDialogConstants for these. Unlikely // they would be used in a message dialog though. // public int SELECT_ALL_ID = 18; // public int DESELECT_ALL_ID = 19; // public int SELECT_TYPES_ID = 20; return defaultId; }