List of usage examples for org.eclipse.jface.dialogs MessageDialog QUESTION
int QUESTION
To view the source code for org.eclipse.jface.dialogs MessageDialog QUESTION.
Click Source Link
From source file:org.bonitasoft.studio.designer.ui.contribution.CreateAndEditFormContributionItem.java
License:Open Source License
protected boolean openHideEmptyContractDialog() { if (!getEclipsePreferences().getBoolean(HIDE_EMPTY_CONTRACT_INFO_DIALOG, false)) { final MessageDialogWithPrompt messageDialog = MessageDialogWithPrompt.open(MessageDialog.QUESTION, Display.getDefault().getActiveShell(), Messages.hideEmptyContractDialogTitle, Messages.hideEmptyContractDialogMessage, Messages.hideEmptyContractDialogToggleMessage, false, getPreferenceStore(), HIDE_EMPTY_CONTRACT_INFO_DIALOG, SWT.NONE); setEmptyContractDialogAnswerPreference(messageDialog.getReturnCode()); return messageDialog.getReturnCode() == IDialogConstants.YES_ID; } else {/* ww w .j a v a 2s. c o m*/ return getEclipsePreferences().getBoolean(EMPTY_CONTRACT_INFO_DIALOG_ANSWER, false); } }
From source file:org.brainwy.liclipsetext.editor.languages.navigation.NotifyCtagsErrorDialog.java
License:Open Source License
public static void notifyError(Exception e) { Log.log(e);// w ww.jav a2 s . co m LiClipseTextEditorPlugin plugin = LiClipseTextEditorPlugin.getDefault(); if (plugin == null) { return; } final String errorMsg = e.getMessage(); final IPreferenceStore store = plugin.getPreferenceStore(); String val = store.getString(key); if (!DONT_ASK_AGAIN_PREFERENCE_VALUE.equals(val)) { RunInUiThread.async(new Runnable() { public void run() { String title = "Error running CTAGS"; String message = "Some error occurred running CTAGS.\n\n" + "Please make sure it's properly installed on your system and accessible through your\n" + "PATH environment variable (you may have to restart Eclipse after adding it to your PATH).\n\n" + "CTAGS is used for the outline or navigation, so, not having it may prevent some features\n" + "from working properly for some languages.\n\n" + "Error: " + errorMsg + "\n\nSee the error log for more details.\n" + ""; Shell shell = EditorUtils.getShell(); MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, new String[] { "Notify about error again", "Don't show this error again" }, 0); int open = dialog.open(); switch (open) { case 0: break; case 1: store.putValue(key, DONT_ASK_AGAIN_PREFERENCE_VALUE); break; } } }); } }
From source file:org.camunda.bpm.modeler.core.validation.Bpmn2ProjectValidator.java
License:Open Source License
public static boolean validateAfterSave(Resource resource, IProgressMonitor monitor) { boolean needValidation = false; IFile file = getFile(resource);/* ww w . j a va 2s . c om*/ IProject project = file.getProject(); if (project != null) { try { IProjectNature nature = project.getNature(Bpmn2Nature.NATURE_ID); if (nature == null) { Bpmn2Preferences preferences = Bpmn2Preferences.getInstance(project); if (preferences.getCheckProjectNature()) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String title = "Configure BPMN2 Project Nature"; String message = "The project '" + project.getName() + "' has not been configured with the BPMN2 Project Nature.\n\n" + "Adding the BPMN2 Project Nature will cause all BPMN2 files in this project " + "to be validated automatically whenever the project is built.\n\n" + "Do you want to add this Nature to the Project now?"; MessageDialogWithToggle result = MessageDialogWithToggle.open(MessageDialog.QUESTION, shell, title, message, "Don't ask me again", // toggle message false, // toggle state null, // pref store null, // pref key SWT.NONE); if (result.getReturnCode() == IDialogConstants.YES_ID) { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = Bpmn2Nature.NATURE_ID; description.setNatureIds(newNatures); project.setDescription(description, null); needValidation = true; } if (result.getToggleState()) { // don't ask again preferences.setCheckProjectNature(false); } } } else needValidation = true; } catch (CoreException e) { e.printStackTrace(); } } if (needValidation) { validate(file, monitor); return true; } return false; }
From source file:org.celllife.idart.gui.drugGroup.AddDrugGroup.java
License:Open Source License
/** * This method is called if the user clicks on a row in the drugs table. The * user is then asked if they want to delete the drug that they've selected. * //from www .j a va2 s . c om */ private void cmdRemoveDrug() { TableItem[] ti = tblDrugs.getSelection(); if (ti != null) { String drug = ti[0].getText(1); boolean questionResponse = showMessage(MessageDialog.QUESTION, MessageFormat.format(Messages.getString("adddruggroup.drug.remove"), drug), //$NON-NLS-1$ MessageFormat.format(Messages.getString("adddruggroup.comfirmation.drug.remove"), drug)); //$NON-NLS-1$ if (questionResponse) { // Delete from Regimen int index = tblDrugs.getSelectionIndex(); tblDrugs.remove(index); for (int i = index; i < tblDrugs.getItemCount(); i++) { TableItem oti = tblDrugs.getItem(i); int number = Integer.parseInt(oti.getText(0)); number--; oti.setText(0, String.valueOf(number)); //$NON-NLS-1$ } intDrugTableSize--; } } }
From source file:org.codecover.eclipse.views.controls.DeleteTestElementsConfirmDialog.java
License:Open Source License
/** * Constructs a dialog which asks the user to confirm a deletion of test * elements.// ww w . ja va2 s .c o m * * @param shell the parent shell * @param selection the test elements the user selected for deletion */ public DeleteTestElementsConfirmDialog(Shell shell, Object[] selection) { super(shell, TITLE, null, MSG, MessageDialog.QUESTION, // adapt YES_BUTTON_INDEX if you change the following! new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); this.selection = selection; this.setShellStyle(this.getShellStyle() | SWT.RESIZE); }
From source file:org.codecover.eclipse.views.controls.DeleteTSCsConfirmDialog.java
License:Open Source License
DeleteTSCsConfirmDialog(Shell shell, List<TSContainerInfo> selection) { super(shell, TITLE, null, MESSAGE, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1); this.selection = selection; this.setShellStyle(this.getShellStyle() | SWT.RESIZE); }
From source file:org.compiere.mfg_scm.eclipse.db.DbfProjectChangeListener.java
License:Apache License
public void resourceChanged(IResourceChangeEvent event) { if (event.getResource() instanceof IProject) { final DbfProject project = DbfProject.create((IProject) event.getResource()); if (project != null) { Display.getDefault().syncExec(new Runnable() { public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); String[] labels = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }; MessageDialog dialog = new MessageDialog(window.getShell(), WIZARD_PROJECT_REMOVE_TITLE, null, WIZARD_PROJECT_REMOVE_DESCRIPTION, MessageDialog.QUESTION, labels, 1); if (dialog.open() == MessageDialog.OK) { try { // } catch (Exception ex) { DbfLauncherPlugin.log(ex.getMessage()); }/*from ww w .j av a 2 s. com*/ } } }); } } }
From source file:org.cs3.pdt.editor.internal.editors.PLEditor.java
License:Open Source License
/** * @return/*from www . ja v a 2s. co m*/ * */ private boolean shouldAbortSaving() { if (isExternalInput()) { boolean showWarning = Boolean.parseBoolean( PDTPlugin.getDefault().getPreferenceValue(PDT.PREF_EXTERNAL_FILE_SAVE_WARNING, "true")); if (showWarning) { MessageDialog m = new MessageDialog(getEditorSite().getShell(), "External file", null, "The current file in the editor is not contained in the workspace. Are you sure you want to save this file?", MessageDialog.QUESTION, new String[] { "Yes", "Yes, always", "No" }, 0); int answer = m.open(); switch (answer) { case 1: PDTPlugin.getDefault().setPreferenceValue(PDT.PREF_EXTERNAL_FILE_SAVE_WARNING, "false"); case 0: break; case 2: case SWT.DEFAULT: default: return true; } } } return false; }
From source file:org.csstudio.dal.ui.internal.dnd.ChooseControlSystemPrefixDialog.java
License:Open Source License
public ChooseControlSystemPrefixDialog(Shell parentShell) { super(parentShell, "Control System Prefix", null, "Please choose the appropriate control system.", MessageDialog.QUESTION, new String[] { "Ok", "Cancel" }, 0); }
From source file:org.csstudio.iter.pydev.configurator.EarlyStartup.java
License:Open Source License
@Override public void earlyStartup() { Job job = new Job("Configure python executable") { @Override//from ww w .j a v a2s . c o m protected IStatus run(IProgressMonitor monitor) { removeUnWantedLog(); boolean confChanged = false; try { boolean changed = InterpreterUtils.createPythonInterpreter("default_python", monitor); confChanged |= changed; } catch (Exception e) { e.printStackTrace(); } try { boolean changed = InterpreterUtils.createJythonInterpreter("default_jython", monitor); confChanged |= changed; } catch (Exception e) { e.printStackTrace(); } try { boolean changed = updateOpiBuilderPythonPath(); confChanged |= changed; } catch (Exception e) { e.printStackTrace(); } if (confChanged) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { MessageDialog dialog = new MessageDialog(null, "Restart required", null, "Python Configuration has been updated automatically and requires a restart.", MessageDialog.QUESTION, new String[] { "Restart Now", "Restart Later" }, 0); int result = dialog.open(); if (result == 0) { PlatformUI.getWorkbench().restart(); } } }); } return Status.OK_STATUS; } }; job.schedule(); }