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:org.eclipse.ui.internal.views.markers.DeleteHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) { final MarkerSupportView view = getView(event); if (view == null) return this; final IMarker[] selected = getSelectedMarkers(event); // Verify./*from w ww .jav a 2s. c om*/ MessageDialog dialog = new MessageDialog(view.getSite().getShell(), MarkerMessages.deleteActionConfirmTitle, null, // icon MarkerMessages.deleteActionConfirmMessage, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (dialog.open() != 0) { return view; } WorkspaceJob deleteJob = new WorkspaceJob(IDEWorkbenchMessages.MarkerDeleteHandler_JobTitle) { //See Bug#250807 public IStatus runInWorkspace(IProgressMonitor monitor) { monitor.beginTask(IDEWorkbenchMessages.MarkerDeleteHandler_JobMessageLabel, 10 * selected.length); try { IUndoableOperation op = new DeleteMarkersOperation(selected, view.getDeleteOperationName(selected)); op.addContext(view.getUndoContext()); execute(op, MarkerMessages.deleteMarkers_errorMessage, monitor, WorkspaceUndoUtil.getUIInfoAdapter(view.getSite().getShell())); } finally { monitor.done(); } return Status.OK_STATUS; } }; deleteJob.setUser(true); deleteJob.schedule(); return this; }
From source file:org.eclipse.ui.internal.wizards.preferences.WizardPreferencesPage.java
License:Open Source License
/** * Displays a Yes/No question to the user with the specified message and * returns the user's response.// w w w . ja v a2s. com * * @param message * the question to ask * @return <code>true</code> for Yes, and <code>false</code> for No */ protected boolean queryYesNoQuestion(String message) { MessageDialog dialog = new MessageDialog(getContainer().getShell(), PreferencesMessages.Question, (Image) null, message, MessageDialog.NONE, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) { protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; // ensure yes is the default return dialog.open() == 0; }
From source file:org.eclipse.ui.internal.wizards.preferences.WizardPreferencesPage.java
License:Open Source License
/** * The <code>WizardDataTransfer</code> implementation of this * <code>IOverwriteQuery</code> method asks the user whether the existing * resource at the given path should be overwritten. * /* www . jav a2 s. c o m*/ * @param pathString * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, * <code>"ALL"</code>, or <code>"CANCEL"</code> */ public String queryOverwrite(String pathString) { Path path = new Path(pathString); String messageString; // Break the message up if there is a file name and a directory // and there are at least 2 segments. if (path.getFileExtension() == null || path.segmentCount() < 2) { messageString = NLS.bind(PreferencesMessages.WizardDataTransfer_existsQuestion, pathString); } else { messageString = NLS.bind(PreferencesMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(), path.removeLastSegments(1).toOSString()); } final MessageDialog dialog = new MessageDialog(getContainer().getShell(), PreferencesMessages.Question, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { protected int getShellStyle() { return super.getShellStyle() | SWT.SHEET; } }; String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; // run in syncExec because callback is from an operation, // which is probably not running in the UI thread. getControl().getDisplay().syncExec(new Runnable() { public void run() { dialog.open(); } }); return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()]; }
From source file:org.eclipse.ui.tests.dialogs.TextMessageDialogs.java
License:Open Source License
private MessageDialog getQuestionDialog(String title, String message) { return new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testDeleteProject() { String title = "Delete Project"; String msg = NLS.bind("Delete", (new Object[] { DUMMY_PROJECT, DUMMY_ABSOLUTE_PATH })); Dialog dialog = new MessageDialog(getShell(), title, null, // accept the default window icon msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/* ww w .j a va 2 s .com*/ DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testDeleteReadOnlyCheck() { Dialog dialog = new MessageDialog(getShell(), "Delete?", null, "This?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/*from ww w . ja va 2 s . c o m*/ DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testDropOverwrite() { Dialog dialog = new MessageDialog(getShell(), ResourceNavigatorMessages.DropAdapter_question, null, MessageFormat.format(ResourceNavigatorMessages.DropAdapter_overwriteQuery, new Object[] { DUMMY_RELATIVE_PATH }), MessageDialog.QUESTION,//from ww w. ja va 2 s .c o m new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testMoveReadOnlyCheck() { Dialog dialog = new MessageDialog(getShell(), "Move", null, "OK to move", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);/*from ww w .jav a 2s. c o m*/ DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testOverwritePerspective() { Dialog dialog = new MessageDialog(getShell(), WorkbenchMessages.SavePerspective_overwriteTitle, null, NLS.bind(WorkbenchMessages.SavePerspective_overwriteQuestion, (new Object[] { "Dummy Perspective" })), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);// ww w .jav a 2 s . c o m DialogCheck.assertDialog(dialog, this); }
From source file:org.eclipse.ui.tests.dialogs.UIMessageDialogs.java
License:Open Source License
public void testRefreshDeleteProject() { Dialog dialog = new MessageDialog(getShell(), "Refresh", null, NLS.bind("deleted location", (new Object[] { DUMMY_PROJECT, "c:\\dummypath\\" + DUMMY_PROJECT })), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); DialogCheck.assertDialogTexts(dialog, this); DialogCheck.assertDialog(dialog, this); }