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:org.eclipse.osee.framework.ui.skynet.commandHandlers.DeleteArtifactHandler.java
License:Open Source License
@Override public Object executeWithException(ExecutionEvent event, IStructuredSelection selection) throws OseeCoreException { if (!artifacts.isEmpty()) { MessageDialog dialog = new MessageDialog(Displays.getActiveShell(), "Confirm Artifact Deletion", null, " Are you sure you want to delete this artifact and all of the default hierarchy children?", MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1);/* www. ja va 2 s . c om*/ if (dialog.open() == 0) { Artifact[] artifactsArray = artifacts.toArray(new Artifact[artifacts.size()]); SkynetTransaction transaction = TransactionManager.createTransaction(artifactsArray[0].getBranch(), "Delete artifact handler"); ArtifactPersistenceManager.deleteArtifact(transaction, false, artifactsArray); transaction.execute(); } } return null; }
From source file:org.eclipse.osee.framework.ui.skynet.handler.RemoveTrackChangesHandler.java
License:Open Source License
@Override public Object handleStatus(IStatus status, Object source) { final MutableBoolean isOkToRemove = new MutableBoolean(false); final String message = (String) source; final Pair<MutableBoolean, Integer> answer = new Pair<MutableBoolean, Integer>(isOkToRemove, NO); if (RenderingUtil.arePopupsAllowed()) { Displays.pendInDisplayThread(new Runnable() { @Override/*from w w w .jav a 2s . c om*/ public void run() { MoreChangesHandlingDialog dialog = new MoreChangesHandlingDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Confirm Removal Of Track Changes ", null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL }, 0); dialog.updateStyle(); boolean doesUserConfirm = dialog.open() == YES || dialog.open() == YES_TO_ALL; isOkToRemove.setValue(doesUserConfirm); answer.setSecond(dialog.open()); } }); } else { // For Test Purposes isOkToRemove.setValue(true); OseeLog.log(Activator.class, Level.INFO, "Test - accept track change removal."); } return answer; }
From source file:org.eclipse.papyrus.customization.properties.ui.CustomizationDialog.java
License:Open Source License
protected void deleteAction() { RemoveContextAction action = new RemoveContextAction(); IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection(); if (selection.isEmpty()) { return;//from w w w . j a v a 2 s . c om } Object element = selection.getFirstElement(); if (element instanceof Context) { Context sourceContext = (Context) element; if (ConfigurationManager.instance.isPlugin(sourceContext)) { Activator.log.warn(Messages.CustomizationDialog_cannotDeletePluginContext); //Plugin context cannot be deleted return; } MessageDialog dialog = new MessageDialog(getShell(), Messages.CustomizationDialog_deleteContext, null, Messages.CustomizationDialog_deleteContextConfirmation1 + sourceContext.getName() + Messages.CustomizationDialog_deleteContextConfirmation2, MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2); int result = dialog.open(); if (result == 0) { //0 is "Yes" (It is *not* the same 0 as Window.OK) action.removeContext(sourceContext); availableContextsViewer.setInput(ConfigurationManager.instance.getContexts()); } } }
From source file:org.eclipse.papyrus.modelexplorer.actions.GenericTransformAction.java
License:Open Source License
/** * Transform the element and update referencing diagrams. * /*w ww . j a v a2 s . com*/ * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { GenericTransformer transformer = new GenericTransformer(element); MultiStatus messages = transformer.isTransformationPossible(targetEClass); if (messages != null && messages.getChildren().length == 0) { String message = String.format(WARNING_MESSAGE, this.element.eClass().getName(), targetEClass.getName()); InformationDialog dialog = new InformationDialog(Display.getDefault().getActiveShell(), WARNING_TITLE, message, Activator.getDefault().getPreferenceStore(), INavigatorPreferenceConstants.PREF_NAVIGATOR_TRANSFORM_INTO_SHOW_POPUP, SWT.YES | SWT.NO, MessageDialog.INFORMATION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }); int result = dialog.open(); if (result == SWT.YES || result == Window.OK) { transformer.transform(targetEClass); } } else { ErrorDialog errorDialog = new ErrorDialog(Display.getDefault().getActiveShell(), ERROR_TITLE, ERROR_MESSAGE, messages, IStatus.WARNING); errorDialog.open(); } }
From source file:org.eclipse.pde.emfforms.editor.EmfFormEditor.java
License:Open Source License
/** * @param monitor//from w w w . j av a 2 s . co m */ protected void internalDoValidate(IProgressMonitor monitor) { VALIDATE_ON_SAVE validateOnSave = getEditorConfig().getValidateOnSave(); // result of the Validation Diagnostic diagnostic = Diagnostic.OK_INSTANCE; // if the validation is asked by the user if (validateOnSave != VALIDATE_ON_SAVE.NO_VALIDATION) diagnostic = _validator.validate(getCurrentEObject()); if (diagnostic.getSeverity() != Diagnostic.OK) { switch (validateOnSave) { case VALIDATE_AND_WARN: int dialogResult = new DiagnosticDialog(getSite().getShell(), Messages.EmfFormEditor_DiaDialog_InvalidModel_Title, null, diagnostic, Diagnostic.ERROR | Diagnostic.WARNING) { @Override protected Control createMessageArea(Composite composite) { message = Messages.EmfFormEditor_ValidationWarn_Msg; return super.createMessageArea(composite); } @Override protected void createButtonsForButtonBar(Composite parent) { // create OK and Details buttons createButton(parent, IDialogConstants.OK_ID, IDialogConstants.YES_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.NO_LABEL, true); createDetailsButton(parent); } }.open(); if (dialogResult != Window.OK) { if (monitor != null) monitor.setCanceled(true); throw new OperationCanceledException(); } break; case VALIDATE_AND_ABORT: new DiagnosticDialog(getSite().getShell(), Messages.EmfFormEditor_DiaDialog_InvalidModel_Title, null, diagnostic, Diagnostic.ERROR | Diagnostic.WARNING) { @Override protected Control createMessageArea(Composite composite) { message = Messages.EmfFormEditor_ValidationError_Msg; return super.createMessageArea(composite); } }.open(); monitor.setCanceled(true); throw new OperationCanceledException(); default: // fall through } } }
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 w ww.ja v a 2 s. com 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 w ww. j a v a 2 s . c o m*/ 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 ww w. j a v a 2 s. c o m 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.pde.internal.ui.launcher.LaunchTerminationStatusHandler.java
License:Open Source License
private void handleOtherReasonsFoundInLog(final ILaunch launch) { Display.getDefault().asyncExec(new Runnable() { public void run() { try { File log = LaunchListener.getMostRecentLogFile(launch.getLaunchConfiguration()); if (log != null && log.exists()) { MessageDialog dialog = new MessageDialog(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.Launcher_error_title, null, // accept the default window icon PDEUIMessages.Launcher_error_code13, MessageDialog.ERROR, new String[] { PDEUIMessages.Launcher_error_displayInLogView, PDEUIMessages.Launcher_error_displayInSystemEditor, IDialogConstants.NO_LABEL }, OPEN_IN_ERROR_LOG_VIEW); int dialog_value = dialog.open(); if (dialog_value == OPEN_IN_ERROR_LOG_VIEW) { IWorkbenchPage page = PDEPlugin.getActivePage(); if (page != null) { LogView errlog = (LogView) page.showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ errlog.handleImportPath(log.getAbsolutePath()); errlog.sortByDateDescending(); }/*from ww w. j ava 2 s. c o m*/ } else if (dialog_value == OPEN_IN_SYSTEM_EDITOR) { openInEditor(log); } } } catch (CoreException e) { } } }); }
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>//from w w w .j a v a2 s .com * 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; }