public void run() { MessageDialog dialog = new MessageDialog(shell, "CAS target file already exists" , null, "The CAS target file already exists: \n" + pathString + "\n\nPlease choose an action.", MessageDialog.QUESTION, options, 0); dialog.open(); String codes[] = { YES, ALL, NO, CANCEL }; result = codes[dialog.getReturnCode()]; } });
@Override public void run() { MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); switch (dialog.getReturnCode()) { case -1 : //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= IDialogConstants.CANCEL_ID; break; default: result[0]= dialog.getReturnCode(); } }
@Override public void run() { MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); switch (dialog.getReturnCode()) { case -1 : //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= IDialogConstants.CANCEL_ID; break; default: result[0]= dialog.getReturnCode(); } }
/** the rc from the message dialog */ int rc = -1; @Override public boolean close() { MessageDialog messagedialog = new MessageDialog(getShell(), "Confirm Exit", null, "Are you sure you want to exit?", 4, new String[] { "Yes", "No" }, 1); messagedialog.setBlockOnOpen(true); messagedialog.open(); rc = messagedialog.getReturnCode(); /** int to hold the return code from the message dialog */ if (rc == 0) { return true; } else { return false; } }
@Override public void run() { int[] resultId= getResultIDs(); MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); if (dialog.getReturnCode() == -1) { //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= fAllowCancel ? IDialogConstants.CANCEL_ID : IDialogConstants.NO_ID; } else { result[0]= resultId[dialog.getReturnCode()]; } }
@Override public void run() { int[] resultId= getResultIDs(); MessageDialog dialog= new MessageDialog( fShell, fDialogTitle, null, question, MessageDialog.QUESTION, getButtonLabels(), 0); dialog.open(); if (dialog.getReturnCode() == -1) { //MessageDialog closed without choice => cancel | no //see also https://bugs.eclipse.org/bugs/show_bug.cgi?id=48400 result[0]= fAllowCancel ? IDialogConstants.CANCEL_ID : IDialogConstants.NO_ID; } else { result[0]= resultId[dialog.getReturnCode()]; } }
switch (dialog.getReturnCode()) { case 0://Yes return true; switch (dialog.getReturnCode()) { case 0:// Yes return true;
() -> dialog.open()); if (hasMultiple) { switch (dialog.getReturnCode()) { case 0:// Yes return true; switch (dialog.getReturnCode()) { case 0:// Yes return true;
int result = dialog.getReturnCode(); if (result == 0) { return IDialogConstants.YES_ID;
private boolean validateFile(File file) { if (file == null) return false; // Consider file valid if it doesn't exist for now. if (!file.exists()) return true; // The file exists. if (!file.canWrite()) { final String title= UIText.GitCreatePatchWizard_ReadOnlyTitle; final String msg= UIText.GitCreatePatchWizard_ReadOnlyMsg; final MessageDialog dialog= new MessageDialog(getShell(), title, null, msg, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open(); return false; } final String title = UIText.GitCreatePatchWizard_OverwriteTitle; final String msg = UIText.GitCreatePatchWizard_OverwriteMsg; final MessageDialog dialog = new MessageDialog(getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); if (dialog.getReturnCode() != 0) return false; return true; }
@Override public String queryOverwrite(String pathString) { if (alwaysOverwrite) { return ALL; } final String returnCode[] = { CANCEL }; final String msg = NLS.bind(ResourceNavigatorMessages.DropAdapter_overwriteQuery, pathString); final String[] options = { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; getDisplay().syncExec(() -> { MessageDialog dialog = new MessageDialog( getShell(), ResourceNavigatorMessages.DropAdapter_question, null, msg, MessageDialog.QUESTION, 0, options); dialog.open(); int returnVal = dialog.getReturnCode(); String[] returnCodes = { YES, ALL, NO, CANCEL }; returnCode[0] = returnVal < 0 ? CANCEL : returnCodes[returnVal]; }); if (returnCode[0] == ALL) { alwaysOverwrite = true; } return returnCode[0]; }
int result = dialog.getReturnCode(); if (result == 0) { return IDialogConstants.YES_ID;
return dialog.getReturnCode() < 0 ? CANCEL : response[dialog .getReturnCode()];
return dialog.getReturnCode() < 0 ? CANCEL : response[dialog .getReturnCode()];
if (dialog.getReturnCode() == 0) { // yes was chosen project.delete(true, true, null);
/** * Revert to last valid. * * @param msg the msg * @param msgDetails the msg details * @return true, if successful */ private boolean revertToLastValid(String msg, String msgDetails) { String[] buttonLabels = new String[2]; buttonLabels[0] = Messages.getString("MultiPageEditor.revertToLastValid"); //$NON-NLS-1$ buttonLabels[1] = Messages.getString("MultiPageEditor.EditExisting"); //$NON-NLS-1$ MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), msg, null, msgDetails, MessageDialog.WARNING, buttonLabels, 0); dialog.open(); // next line depends on return code for button 1 (which is 1) // and CANCEL code both being == 1 return dialog.getReturnCode() == 0; }
if (dialog.getReturnCode() == SWT.DEFAULT) { result[0] = resultId[dialog.getReturnCode()];
switch (dialog.getReturnCode()) { case 0: // overwrite if (oldWs != null)
dialog.open(); switch (dialog.getReturnCode()) { case -1 : //MessageDialog closed without choice => cancel | no
dialog.open(); switch (dialog.getReturnCode()) { case -1 : //MessageDialog closed without choice => cancel | no