List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_LABEL
String NO_LABEL
To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_LABEL.
Click Source Link
From source file:com.motorola.studio.android.common.utilities.EclipseUtils.java
License:Apache License
/** * Show a question message using the given title and message * //from w ww . j a v a 2 s. c om * @param title * of the dialog * @param message * to be displayed in the dialog. */ public static int showQuestionWithCancelDialog(final String title, final String message) { class IntWrapper { public int diagReturn = 0; } final IntWrapper intWrapper = new IntWrapper(); Display.getDefault().syncExec(new Runnable() { public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow(); Shell shell = ww.getShell(); MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); int diagResults = dialog.open(); switch (diagResults) { case 0: intWrapper.diagReturn = SWT.YES; break; case 1: intWrapper.diagReturn = SWT.NO; break; case 2: default: intWrapper.diagReturn = SWT.CANCEL; break; } } }); return intWrapper.diagReturn; }
From source file:com.motorola.studio.android.common.utilities.EclipseUtils.java
License:Apache License
/** * Show a question message using the given title and message * // ww w . j a v a 2 s. c o m * @param title * of the dialog * @param message * to be displayed in the dialog. */ public static int showQuestionYesAllCancelDialog(final String title, final String message) { class IntWrapper { public int diagReturn = 0; } final IntWrapper intWrapper = new IntWrapper(); Display.getDefault().syncExec(new Runnable() { public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow(); Shell shell = ww.getShell(); MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL }, 0); int diagResults = dialog.open(); switch (diagResults) { case 0: intWrapper.diagReturn = IDialogConstants.YES_ID; break; case 1: intWrapper.diagReturn = IDialogConstants.YES_TO_ALL_ID; break; case 2: default: intWrapper.diagReturn = IDialogConstants.NO_ID; break; } } }); return intWrapper.diagReturn; }
From source file:com.mountainminds.eclemma.internal.ui.launching.NoInstrumentedClassesHandler.java
License:Open Source License
public Object handleStatus(IStatus status, final Object source) throws CoreException { final Shell parent = EclEmmaUIPlugin.getInstance().getShell(); String title = UIMessages.NoInstrumentedClassesError_title; String message = UIMessages.NoInstrumentedClassesError_message; MessageDialog d = new MessageDialog(parent, title, null, message, MessageDialog.ERROR, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (d.open() == 0) { parent.getDisplay().asyncExec(new Runnable() { public void run() { DebugUITools.openLaunchConfigurationDialogOnGroup(parent, new StructuredSelection(source), EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); }//from w w w . j av a 2 s.co m }); } return Boolean.FALSE; }
From source file:com.mulgasoft.emacsplus.preferences.EmacsPlusPreferencePage.java
License:Open Source License
/** * Pop up a message dialog to request the restart of the workbench *///from w w w .jav a2s.c om private void requestRestart(String rePreference) { String reMessage = EmacsPlusActivator.getString("EmacsPlusPref_RestartMessage"); //$NON-NLS-1$ IProduct product = Platform.getProduct(); String productName = product != null && product.getName() != null ? product.getName() : EmacsPlusActivator.getString("EmacsPlusPref_DefaultProduct"); //$NON-NLS-1$ final String msg = String.format(reMessage, productName, rePreference); final String reTitle = EmacsPlusActivator.getString("EmacsPlusPref_RestartTitle"); //$NON-NLS-1$ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { if (PlatformUI.getWorkbench().isClosing()) return; // yes == 0, no == 1 MessageDialog dialog = new MessageDialog(getDefaultShell(), reTitle, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (dialog.open() != Window.CANCEL) { if (dialog.getReturnCode() == 0) { // restart workbench PlatformUI.getWorkbench().restart(); } } } }); }
From source file:com.netxforge.screens.editing.base.dialogs.MessageDialogWithResult.java
License:Open Source License
public static String[] getButtonLabels(int kind) { String[] dialogButtonLabels;/*from w w w.java2s. c om*/ switch (kind) { case ERROR: case INFORMATION: case WARNING: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL }; break; } case CONFIRM: { dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; break; } case QUESTION: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }; break; } case QUESTION_WITH_CANCEL: { dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; break; } default: { throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$ } } return dialogButtonLabels; }
From source file:com.nokia.carbide.cpp.internal.pi.button.ui.BupProfileEditDialog.java
License:Open Source License
public void cancelPressed() { if (cachedMap.haveUncommitedChanges()) { MessageDialog dialog = new MessageDialog(getShell(), Messages.getString("BupProfileEditDialog.uncommittedChanges"), //$NON-NLS-1$ null,// w ww . j a va 2s . co m Messages.getString("BupProfileEditDialog.saveChanges") + profileForThisEdit.getProfileId() //$NON-NLS-1$ + "?", //$NON-NLS-1$ MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); // default yes switch (dialog.open()) { case 0: // yes cachedMap.commitChanges(); // fall thru to no case 1: // no super.cancelPressed(); cleanUp(); case 2: // cancel default: return; } } super.cancelPressed(); cleanUp(); }
From source file:com.nokia.carbide.cpp.internal.project.ui.dialogs.UpdateProjectFilesQueryDialog.java
License:Open Source License
/** * Create contents of the button bar/* www. j av a 2 s .c o m*/ * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.NO_LABEL, false); }
From source file:com.nokia.carbide.cpp.uiq.ui.vieweditor.CommandsPage.java
License:Open Source License
/** * This code was taken from the EventCommands class. It has the validations in case the code * doesn't exist./*from w w w . ja v a 2 s . c o m*/ * @param binding * @param isNewBinding */ private void navigateToHandlerCode(IEventBinding binding, boolean isNewBinding) { IEventDescriptor eventDescriptor = binding.getEventDescriptor(); IStatus status = eventDescriptor.gotoHandlerCode(binding, isNewBinding); if (status != null) { if (!isNewBinding) { // Hmm, an error. It could be the data model was not saved. // It may just be a problem in the component's sourcegen, hence // the fallthrough to the descriptive error later. MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("CommandsPage.Error"), null, //$NON-NLS-1$ Messages.getString("CommandsPage.NoEventHandlerFound"), //$NON-NLS-1$ MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, //$NON-NLS-1$ //$NON-NLS-2$ 0); int result = dialog.open(); if (result == MessageDialog.OK) { if (ViewEditorUtils.saveDataModel(editor)) { status = eventDescriptor.gotoHandlerCode(binding, isNewBinding); } } } if (status != null) { Logging.log(UIDesignerPlugin.getDefault(), status); Logging.showErrorDialog(Messages.getString("CommandsPage.CouldNotNavigate"), null, status); //$NON-NLS-1$ } } }
From source file:com.nokia.carbide.templatewizard.processes.CopyFiles.java
License:Open Source License
private void handleExistingFiles(List<FileInfo> infos, final List<IFile> existingFiles, List<FileInfo> fileInfosToCopy) { boolean overwrite = true; String autoOverwrite = projectParameter.getAttributeValue(OVERWRITE_ATTRIBUTE); if (autoOverwrite == null && !WorkbenchUtils.isJUnitRunning()) { // should ask final int[] result = { IDialogConstants.CANCEL_ID }; Display.getDefault().syncExec(new Runnable() { public void run() { Shell shell = WorkbenchUtils.getActiveShell(); String title = Messages.getString("CopyFiles.FilesExistTitle"); //$NON-NLS-1$ String message = Messages.getString("CopyFiles.OverwriteFilesQuestion"); //$NON-NLS-1$ FilesListDialog dialog = new FilesListDialog(shell, existingFiles, title, message); dialog.setAltButtonLabels(IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL); result[0] = dialog.open(); }//from www .j a va 2 s .c o m }); overwrite = result[0] == IDialogConstants.OK_ID; } else if (autoOverwrite != null) { overwrite = Boolean.parseBoolean(autoOverwrite); } if (!overwrite) { fileInfosToCopy.clear(); for (FileInfo fileInfo : infos) { if (!FileUtils.exists(fileInfo.targetFile)) fileInfosToCopy.add(fileInfo); } } }
From source file:com.nokia.s60ct.gui.views.CleanDialog.java
License:Open Source License
public CleanDialog(Shell parentShell, String folder) { super(parentShell, "Clean output folder", null, "Do you want to clean the output directory?\n\n\"" + folder + "\"", QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); }