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.eclipse.osee.framework.ui.skynet.util.RebaselineInProgressHandler.java
License:Open Source License
public static void handleRebaselineInProgress(Branch branch) throws OseeCoreException { MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE, null, DIALOG, MessageDialog.QUESTION, CHOICES, 0); int result = dialog.open(); if (result == 2) { // Cancel return;/* w w w .ja v a2 s .c o m*/ } else if (result == 0) { openMergeViewForCurrentUpdate(branch); } else { cancelCurrentUpdate(branch, false); } }
From source file:org.eclipse.osee.framework.ui.skynet.widgets.dialog.CheckBoxDialog.java
License:Open Source License
public CheckBoxDialog(String dialogTitle, String dialogMessage, String checkBoxMessage) { this(Displays.getActiveShell(), dialogTitle, null, dialogMessage, checkBoxMessage, MessageDialog.QUESTION, 0);/* w ww . jav a 2s. c om*/ }
From source file:org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog.java
License:Open Source License
public EntryDialog(String dialogTitle, String dialogMessage) { this(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); }
From source file:org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialogWithBranchSelect.java
License:Open Source License
public EntryDialogWithBranchSelect(String dialogTitle, String dialogMessage) { super(Displays.getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); }
From source file:org.eclipse.pde.internal.ui.editor.plugin.OverviewPage.java
License:Open Source License
private void activateExtensionPages(String activePageId) { MessageDialog mdiag = new MessageDialog(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_extensionPageMessageTitle, null, PDEUIMessages.OverviewPage_extensionPageMessageBody, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (mdiag.open() != Window.OK) return;//from ww w . jav a2 s .co m try { ManifestEditor manifestEditor = (ManifestEditor) getEditor(); manifestEditor.addExtensionTabs(); manifestEditor.setShowExtensions(true); manifestEditor.setActivePage(activePageId); } catch (PartInitException e) { } catch (BackingStoreException e) { } }
From source file:org.eclipse.pde.internal.ui.editor.product.IntroSection.java
License:Open Source License
private void handleNewIntro() { boolean needNewProduct = false; if (!productDefined()) { needNewProduct = true;/*from ww w . j ava 2s . com*/ MessageDialog mdiag = new MessageDialog(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.IntroSection_undefinedProductId, null, PDEUIMessages.IntroSection_undefinedProductIdMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); if (mdiag.open() != Window.OK) return; } ProductIntroWizard wizard = new ProductIntroWizard(getProduct(), needNewProduct); WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); dialog.create(); if (dialog.open() == Window.OK) { String id = wizard.getIntroId(); fIntroCombo.add(id, 0); fIntroCombo.setText(id); getIntroInfo().setId(id); addDependenciesAndPlugins(); } }
From source file:org.eclipse.pde.internal.ui.launcher.LauncherUtilsStatusHandler.java
License:Open Source License
/** * Creates a message dialog using a syncExec in case we are launching in the background. * Dialog will be a question dialog with Yes, No and Cancel buttons. * @param message Message to use in the dialog * @return int representing the button clicked (-1 or 2 for cancel, 0 for yes, 1 for no). *///from w w w. j a va 2s.c om private static Integer generateDialog(final String message) { final int[] result = new int[1]; getDisplay().syncExec(new Runnable() { public void run() { String title = PDEUIMessages.LauncherUtils_title; MessageDialog dialog = new MessageDialog(getActiveShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); result[0] = dialog.open(); } }); return new Integer(result[0]); }
From source file:org.eclipse.php.internal.ui.compare.ContentMergeViewer.java
License:Open Source License
/** * This method is called from the <code>Viewer</code> method * <code>inputChanged</code> to save any unsaved changes of the old input. * <p>/* ww w . j a v a 2s .c o m*/ * The <code>ContentMergeViewer</code> implementation of this method calls * <code>saveContent(...)</code>. If confirmation has been turned on with * <code>setConfirmSave(true)</code>, a confirmation alert is posted before * saving. * </p> * Clients can override this method and are free to decide whether they want * to call the inherited method. * * @param newInput * the new input of this viewer, or <code>null</code> if there is * no new input * @param oldInput * the old input element, or <code>null</code> if there was * previously no input * @return <code>true</code> if saving was successful, or if the user didn't * want to save (by pressing 'NO' in the confirmation dialog). * @since 2.0 */ protected boolean doSave(Object newInput, Object oldInput) { // before setting the new input we have to save the old if (isLeftDirty() || isRightDirty()) { if (Utilities.RUNNING_TESTS) { if (Utilities.TESTING_FLUSH_ON_COMPARE_INPUT_CHANGE) { flushContent(oldInput, null); } } else if (fConfirmSave) { // post alert Shell shell = fComposite.getShell(); MessageDialog dialog = new MessageDialog(shell, Utilities.getString(getResourceBundle(), "saveDialog.title"), //$NON-NLS-1$ null, // accept the default window icon Utilities.getString(getResourceBundle(), "saveDialog.message"), //$NON-NLS-1$ MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, }, 0); // default // button // index switch (dialog.open()) { // open returns index of pressed button case 0: flushContent(oldInput, null); break; case 1: setLeftDirty(false); setRightDirty(false); break; case 2: throw new ViewerSwitchingCancelled(); } } else flushContent(oldInput, null); return true; } return false; }
From source file:org.eclipse.php.internal.ui.dialogs.saveFiles.SaveAsDialog.java
License:Open Source License
protected void okPressed() { IPath path = resourceGroup.getContainerFullPath().append(resourceGroup.getResource()); // If the user does not supply a file extension and if the save // as dialog was provided a default file name append the extension // of the default filename to the new name if (path.getFileExtension() == null) { if (originalFile != null && originalFile.getFileExtension() != null) { path = path.addFileExtension(originalFile.getFileExtension()); } else if (originalName != null) { int pos = originalName.lastIndexOf('.'); if (++pos > 0 && pos < originalName.length()) { path = path.addFileExtension(originalName.substring(pos)); }//from w w w . j a v a 2 s . c o m } } // If the path already exists then confirm overwrite. IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file.exists()) { String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; String question = PHPUIMessages.SaveAsDialog_6 + file.getFullPath().toString() + PHPUIMessages.SaveAsDialog_7; MessageDialog d = new MessageDialog(getShell(), PHPUIMessages.SaveAsDialog_saveFileMessage, null, question, MessageDialog.QUESTION, buttons, 0); int overwrite = d.open(); switch (overwrite) { case 0: // Yes break; case 1: // No return; case 2: // Cancel default: cancelPressed(); return; } } // Store path and close. result = path; close(); }
From source file:org.eclipse.php.internal.ui.preferences.includepath.VariableBlock.java
License:Open Source License
public boolean performOk() { ArrayList removedVariables = new ArrayList(); ArrayList changedVariables = new ArrayList(); // removedVariables.addAll(Arrays.asList(PHPProjectOptions.getIncludePathVariableNames())); // remove all unchanged List changedElements = fVariablesList.getElements(); List unchangedElements = fVariablesList.getElements(); for (int i = changedElements.size() - 1; i >= 0; i--) { IPVariableElement curr = (IPVariableElement) changedElements.get(i); if (curr.isReserved()) { changedElements.remove(curr); } else {/*from w ww .java2 s. com*/ IPath path = curr.getPath(); IPath prevPath = null; // PHPProjectOptions.getIncludePathVariable(curr.getName()); if (prevPath != null && prevPath.equals(path)) { changedElements.remove(curr); } else { changedVariables.add(curr.getName()); unchangedElements.remove(curr); } } removedVariables.remove(curr.getName()); } int steps = changedElements.size() + removedVariables.size(); if (steps > 0) { boolean needsBuild = false; if (fAskToBuild && doesChangeRequireFullBuild(removedVariables, changedVariables)) { String title = PHPUIMessages.VariableBlock_needsbuild_title; String message = PHPUIMessages.VariableBlock_needsbuild_message; MessageDialog buildDialog = new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); int res = buildDialog.open(); if (res != 0 && res != 1) { return false; } needsBuild = (res == 0); } final VariableBlockRunnable runnable = new VariableBlockRunnable(removedVariables, changedElements, unchangedElements, needsBuild); Job buildJob = new Job(PHPUIMessages.VariableBlock_job_description) { protected IStatus run(IProgressMonitor monitor) { try { runnable.setVariables(monitor); } catch (CoreException e) { return e.getStatus(); } catch (OperationCanceledException e) { return Status.CANCEL_STATUS; } finally { monitor.done(); } return Status.OK_STATUS; } }; buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); buildJob.setUser(true); buildJob.schedule(); return true; } // ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell()); // try { // dialog.run(true, true, runnable); // } catch (InvocationTargetException e) { // ExceptionHandler.handle(e, getShell(), PHPUIMessages.getString("VariableBlock.operation_errror.title"), PHPUIMessages.getString("VariableBlock.operation_errror.message")); // return false; // } catch (InterruptedException e) { // return false; // } // } return true; }