List of usage examples for org.eclipse.jface.dialogs IDialogConstants YES_LABEL
String YES_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants YES_LABEL.
Click Source Link
From source file:net.refractions.udig.ui.ZoomingDialog.java
License:Open Source License
public static boolean openQuestionMessage(Rectangle start, Shell parentShell, String dialogTitle, String dialogMessage) {/*from w ww . j av a2s . c o m*/ int result = openMessageDialog(start, parentShell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); return result == IDialogConstants.YES_ID; }
From source file:net.rim.ejde.internal.ui.dialogs.DownloadDebugFilesDialog.java
License:Open Source License
public DownloadDebugFilesDialog(String title, String message) { super(ContextManager.getActiveWorkbenchShell(), title, null, message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); // yes is the default }
From source file:net.rim.ejde.internal.ui.preferences.WarningsPrefsPage.java
License:Open Source License
private void storePrefValues() { Map<String, Boolean> currentStatusTable = new HashMap<String, Boolean>(); boolean needBuild = false, givePrompt = ContextManager.getDefault().getPreferenceStore() .getBoolean(IConstants.PROMPT_FOR_BUILD_KEY); List<IMarker> problems = null; for (TreeItem item : _checkTree.getItems()) { Integer itemKey = VMUtils.convertPreferenceLabelToKey(item.getText()); currentStatusTable.put(item.getText(), Boolean.valueOf(item.getChecked())); boolean oldCheckedValue = WarningsPreferences.getWarnStatus(item.getText()); if (item.getChecked() && !oldCheckedValue) { if (problems == null) { try { problems = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot() .findMarkers(IRIMMarker.CODE_SIGN_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE)); } catch (CoreException e) { _log.error("Error Finding Workspace Markers", e); }/* w w w.ja v a 2 s . c o m*/ if (problems == null) { break; } } List<IMarker> retainedProblems = new ArrayList<IMarker>(); for (IMarker marker : problems) { try { Object key = marker.getAttribute(IRIMMarker.KEY); if (key != null && key.equals(itemKey)) { marker.delete(); } else { retainedProblems.add(marker); } } catch (CoreException e) { _log.error("Error Retrieving Key from marker", e); } } problems = retainedProblems; } else if (!item.getChecked() && oldCheckedValue) { needBuild = true; } } WarningsPreferences.setCodeSignWarnStatus(currentStatusTable); WarningsPreferences.setPromptForMissingDebugFiles(_promptForDebugFileButton.getSelection()); WarningsPreferences .setPromptForMissingDependenciesFiles(_promptForMissingDependenciesFileButton.getSelection()); if (needBuild && givePrompt) { MessageDialog dialog = new MessageDialog(getShell(), Messages.CodeSigningPrefsPage_MessageDialogTitle2, null, Messages.CodeSigningPrefsPage_MessageDialogMsg2, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 2); int res = dialog.open(); if (res == 0) { CoreUtility.getBuildJob(null).schedule(); } } }
From source file:net.rim.ejde.internal.util.FileUtils.java
License:Open Source License
public static IStatus canChange(final java.io.File osFile, final String dialogTitle, final String errorMessage, final boolean showResourcePath, final String questionMessage) { IStatus result = Status.CANCEL_STATUS; if ((osFile != null) && (osFile.exists())) { if (osFile.canWrite()) { result = Status.OK_STATUS;/* w w w . ja v a 2s .co m*/ } else { // prompt for making resource writable Display.getDefault().syncExec(new Runnable() { public void run() { StringBuffer buffer = new StringBuffer(); buffer.append(errorMessage); if (showResourcePath) { buffer.append(osFile.getAbsolutePath()); } buffer.append(questionMessage); String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; Shell shell = new Shell(); MessageDialog promptSaveDia = new MessageDialog(shell, dialogTitle, null, buffer.toString(), MessageDialog.WARNING, buttons, 0); int ret = promptSaveDia.open(); shell.dispose(); if (ret == Window.OK) { // make this resource writable setWritable(osFile); } } }); if (osFile.canWrite()) { result = Status.OK_STATUS; } } } return result; }
From source file:net.sf.eclipsensis.dialogs.NSISTaskTagsPreferencePage.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from w w w .j av a 2s.c o m*/ public boolean performOk() { if (super.performOk()) { Collection<NSISTaskTag> taskTags = (Collection<NSISTaskTag>) mTableViewer.getInput(); boolean caseSensitive = mCaseSensitiveButton.getSelection(); boolean different = (caseSensitive != NSISPreferences.getInstance().isCaseSensitiveTaskTags()); if (!different) { if (taskTags.size() == mOriginalTags.size()) { for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) { if (!mOriginalTags.contains(iter.next())) { different = true; break; } } } else { different = true; } } if (different) { if (taskTags.size() > 0) { boolean defaultFound = false; for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) { NSISTaskTag element = iter.next(); if (element.isDefault()) { defaultFound = true; break; } } if (!defaultFound) { if (taskTags.size() == 1) { NSISTaskTag taskTag = (NSISTaskTag) taskTags.toArray()[0]; taskTag.setDefault(true); mTableViewer.setChecked(taskTag, true); } else { Common.openError(getShell(), EclipseNSISPlugin.getResourceString("task.tag.dialog.missing.default"), //$NON-NLS-1$ EclipseNSISPlugin.getShellImage()); return false; } } } } boolean updateTaskTags = false; if (different) { NSISPreferences.getInstance().setTaskTags(taskTags); NSISPreferences.getInstance().setCaseSensitiveTaskTags(caseSensitive); MessageDialog dialog = new MessageDialog(getShell(), EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$ EclipseNSISPlugin.getShellImage(), EclipseNSISPlugin.getResourceString("task.tags.settings.changed"), MessageDialog.QUESTION, //$NON-NLS-1$ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.setBlockOnOpen(true); int rv = dialog.open(); if (rv == 2) { //Cancel return false; } else { updateTaskTags = (rv == 0); } NSISPreferences.getInstance().store(); } if (updateTaskTags) { new NSISTaskTagUpdater().updateTaskTags(); NSISEditorUtilities.updatePresentations(); mOriginalTags.clear(); mOriginalTags.addAll(taskTags); } return true; } return false; }
From source file:net.sf.eclipsensis.settings.NSISSettingsEditorGeneralPage.java
License:Open Source License
/** * @param parent//from w ww . j a va 2s . c o m */ protected void createProcessPriorityCombo(Composite parent) { Label l; mProcessPriority = createCombo(parent, EclipseNSISPlugin.getResourceString("process.priority.text"), //$NON-NLS-1$ EclipseNSISPlugin.getResourceString("process.priority.tooltip"), //$NON-NLS-1$ INSISSettingsConstants.PROCESS_PRIORITY_ARRAY, mSettings.getProcessPriority() + 1); mProcessPriorityIndex = mProcessPriority.getSelectionIndex(); l = new Label(parent, SWT.None); l.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); mProcessPriority.setData(LABELS, new Object[] { mProcessPriority.getData(LABEL), l }); mProcessPriority.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (isProcessPrioritySupported()) { if (isWarnProcessPriority()) { if (mProcessPriority.getSelectionIndex() > INSISSettingsConstants.PROCESS_PRIORITY_HIGH && mProcessPriorityIndex <= INSISSettingsConstants.PROCESS_PRIORITY_HIGH) { MessageDialogWithToggle dialog = new MessageDialogWithToggle( mProcessPriority.getShell(), EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$ EclipseNSISPlugin.getShellImage(), EclipseNSISPlugin.getResourceString("process.priority.question"), //$NON-NLS-1$ MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1, EclipseNSISPlugin.getResourceString("process.priority.toggle"), //$NON-NLS-1$ false); dialog.open(); setWarnProcessPriority(!dialog.getToggleState()); if (dialog.getReturnCode() == IDialogConstants.NO_ID) { mProcessPriority.select(mProcessPriorityIndex); return; } } } } mProcessPriorityIndex = mProcessPriority.getSelectionIndex(); } }); }
From source file:net.sf.eclipsensis.util.Common.java
License:Open Source License
public static boolean openQuestion(Shell parent, String title, String message, Image icon) { MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); return dialog.open() == 0; }
From source file:net.sf.eclipsensis.wizard.NSISWizardContentsPage.java
License:Open Source License
/** * @param tv/* w ww . j a va 2 s .c o 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:net.sf.jmoney.serializeddatastore.SessionManager.java
License:Open Source License
boolean requestSave(IWorkbenchWindow window) { String title = Messages.SessionManager_SaveTitle; String question = Messages.SessionManager_SaveQuestion; MessageDialog dialog = new MessageDialog(window.getShell(), title, null, // accept the default window icon question, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); // CANCEL is the // default//w w w . ja v a 2s.co m int answer = dialog.open(); switch (answer) { case 0: // YES saveSession(window); return true; case 1: // NO return true; case 2: // CANCEL return false; default: throw new RuntimeException("bad switch value"); //$NON-NLS-1$ } }
From source file:net.sf.versiontree.views.VersionTreeView.java
License:Open Source License
private boolean confirmOverwrite() { IFile file = getFile();/*from www. ja v a 2s. c om*/ if (file != null && file.exists()) { ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file); try { if (cvsFile.isModified(null)) { String title = VersionTreePlugin.getResourceString("VersionTreeView.CVS_Version_Tree_Name"); //$NON-NLS-1$ String msg = VersionTreePlugin.getResourceString("VersionTreeView.Overwrite_Changes_Question"); //$NON-NLS-1$ final MessageDialog dialog = new MessageDialog(getViewSite().getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0); final int[] result = new int[1]; getViewSite().getShell().getDisplay().syncExec(new Runnable() { public void run() { result[0] = dialog.open(); } }); if (result[0] != 0) { // cancel return false; } } } catch (CVSException e) { CVSUIPlugin.log(e.getStatus()); } } return true; }