List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:org.eclipse.gyrex.admin.ui.internal.widgets.NonBlockingMessageDialogs.java
License:Open Source License
public static void openInformation(final Shell parent, final String title, final String message, final DialogCallback callback) { open(MessageDialog.INFORMATION, parent, title, message, callback); }
From source file:org.eclipse.jdt.internal.debug.ui.actions.StepIntoSelectionHandler.java
License:Open Source License
/** * Called when stepping returned from the original frame without entering the desired method. */// w ww . j a v a 2 s . c om protected void missed() { cleanup(); Runnable r = new Runnable() { public void run() { String methodName = null; try { methodName = Signature.toString(getMethod().getSignature(), getMethod().getElementName(), getMethod().getParameterNames(), false, false); } catch (JavaModelException e) { methodName = getMethod().getElementName(); } new MessageDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), ActionMessages.StepIntoSelectionHandler_1, null, NLS.bind( ActionMessages.StepIntoSelectionHandler_Execution_did_not_enter____0____before_the_current_method_returned__1, new String[] { methodName }), MessageDialog.INFORMATION, new String[] { ActionMessages.StepIntoSelectionHandler_2 }, 0) .open(); } }; JDIDebugUIPlugin.getStandardDisplay().asyncExec(r); }
From source file:org.eclipse.jdt.internal.debug.ui.actions.TerminateEvaluationAction.java
License:Open Source License
public void run(IAction action) { if (fThread == null) { return;//from w ww .ja va2s. c om } DebugPlugin.getDefault().addDebugEventListener(this); Thread timerThread = new Thread(new Runnable() { public void run() { fTerminated = false; try { Thread.sleep(3000); } catch (InterruptedException e) { return; } if (!fTerminated) { fTerminated = true; final Display display = JDIDebugUIPlugin.getStandardDisplay(); display.asyncExec(new Runnable() { public void run() { MessageDialog dialog = new MessageDialog(display.getActiveShell(), ActionMessages.TerminateEvaluationActionTerminate_Evaluation_1, null, ActionMessages.TerminateEvaluationActionAttempts_to_terminate_an_evaluation_can_only_stop_a_series_of_statements__The_currently_executing_statement__such_as_a_method_invocation__cannot_be_interrupted__2, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.setBlockOnOpen(false); dialog.open(); } }); } } }); timerThread.setDaemon(true); timerThread.start(); try { fThread.terminateEvaluation(); } catch (DebugException exception) { JDIDebugUIPlugin.statusDialog(exception.getStatus()); } }
From source file:org.eclipse.jdt.internal.ui.wizards.NewElementWizard.java
License:Open Source License
protected void warnAboutTypeCommentDeprecation() { String key = IUIConstants.DIALOGSTORE_TYPECOMMENT_DEPRECATED; if (OptionalMessageDialog.isDialogEnabled(key)) { TemplateStore templates = JavaPlugin.getDefault().getTemplateStore(); boolean isOldWorkspace = templates.findTemplate("filecomment") != null //$NON-NLS-1$ && templates.findTemplate("typecomment") != null; //$NON-NLS-1$ if (!isOldWorkspace) { OptionalMessageDialog.setDialogEnabled(key, false); }//from w w w .java2 s.c om String title = NewWizardMessages.NewElementWizard_typecomment_deprecated_title; String message = NewWizardMessages.NewElementWizard_typecomment_deprecated_message; OptionalMessageDialog.open(key, getShell(), title, null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); } }
From source file:org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorDiagramTypeProvider.java
License:Open Source License
private boolean openPersistedDiagram(boolean hasToAdd) { final JpaProject proj = getTargetJPAProject(); IProject project = proj.getProject(); final Diagram diagram = getDiagram(); ModelIntegrationUtil.putProjectToDiagram(project, diagram); PersistenceUnit pu = JpaArtifactFactory.instance().getPersistenceUnit(proj); String diagramName = pu.getName(); IPath path = ModelIntegrationUtil.getDiagramsFolderPath(project).append(diagramName) .addFileExtension(ModelIntegrationUtil.DIAGRAM_FILE_EXTENSION); final IFile f = ResourcesPlugin.getWorkspace().getRoot().getFile(path); boolean readOnly = (f != null) && f.exists() && f.isReadOnly(); if (readOnly) { if (JPACheckSum.INSTANCE().isModelDifferentFromDiagram(diagram, proj) || hasToAdd) { String message = hasToAdd ? JPAEditorMessages.JPAEditorDiagramTypeProvider_JPADiagramReadOnlyHasToAddMsg : JPAEditorMessages.JPAEditorDiagramTypeProvider_JPADiagramReadOnlyMsg; MessageDialog dialog = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), JPAEditorMessages.JPAEditorDiagramTypeProvider_JPADiagramReadOnlyTitle, null, message, MessageDialog.INFORMATION, new String[] { JPAEditorMessages.BTN_OK, JPAEditorMessages.BTN_CANCEL }, 0) { @Override//ww w. j ava 2 s .co m protected int getShellStyle() { return SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation(); } }; if (dialog.open() == 1) { closeEditor(); return true; } IStatus stat = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { f }, null); if (!stat.isOK()) { message = NLS.bind(JPAEditorMessages.JPAEditorDiagramTypeProvider_cantMakeDiagramWritableMsg, stat.getMessage()); dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), JPAEditorMessages.JPAEditorDiagramTypeProvider_cantMakeDiagramWritableTitle, null, message, Window.CANCEL, new String[] { JPAEditorMessages.BTN_OK }, 0) { @Override protected int getShellStyle() { return SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | getDefaultOrientation(); } }; dialog.open(); closeEditor(); return true; } readOnly = false; } else { return readOnly; } } removeConnections(); final Hashtable<String, SizePosition> marks = new Hashtable<String, SizePosition>(); EntitiesCoordinatesXML xml = new EntitiesCoordinatesXML(project.getName()); xml.load(marks); xml.clean(); List<Shape> picts = diagram.getChildren(); Iterator<Shape> it = picts.iterator(); HashSet<Shape> toDelete = new HashSet<Shape>(); // collecting data from the saved pictograms while (it.hasNext()) { Shape pict = it.next(); toDelete.add(pict); } final Iterator<Shape> iter = toDelete.iterator(); TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(diagram); ted.getCommandStack().execute(new RecordingCommand(ted) { @Override protected void doExecute() { while (iter.hasNext()) Graphiti.getPeService().deletePictogramElement(iter.next()); Collection<Connection> cns = diagram.getConnections(); Iterator<Connection> itera = cns.iterator(); Set<Connection> toDel = new HashSet<Connection>(); while (itera.hasNext()) toDel.add(itera.next()); itera = toDel.iterator(); while (itera.hasNext()) Graphiti.getPeService().deletePictogramElement(itera.next()); Enumeration<String> itr = marks.keys(); // create new pictograms while (itr.hasMoreElements()) { String entityName = itr.nextElement(); PersistentType jpt = JpaArtifactFactory.instance().getContextPersistentType(proj, entityName); if (jpt != null) { if (getFeatureProvider().getPictogramElementForBusinessObject(jpt) != null) continue; SizePosition sp = marks.get(entityName); AddContext ctx = new AddEntityContext(sp.primaryCollapsed, sp.relationCollapsed, sp.basicCollapsed); ctx.setNewObject(jpt); ctx.setTargetContainer(getDiagram()); ctx.setWidth(sp.getWidth()); ctx.setHeight(sp.getHeight()); ctx.setX(sp.getX()); ctx.setY(sp.getY()); AddJPAEntityFeature ft = new AddJPAEntityFeature(getFeatureProvider(), false); ft.add(ctx); } } JpaArtifactFactory.instance().rearrangeIsARelations(getFeatureProvider()); } }); getDiagramEditor().saveWithoutEntities(new NullProgressMonitor()); // delete old pictograms return false; }
From source file:org.eclipse.jsch.ui.UserInfoPrompter.java
License:Open Source License
public void showMessage(String message) { prompt(MessageDialog.INFORMATION, Messages.UserInfoPrompter_1, message, new int[] { IDialogConstants.OK_ID }, 0); }
From source file:org.eclipse.jubula.client.ui.rcp.dialogs.NagDialog.java
License:Open Source License
/** * create a user info dialog// w w w .j a v a 2 s .co m * * @param msgText I18N text of the message * @param helpId references the specific help instance * @param parentShell the shell to be used as a parent */ private NagDialog(String msgText, String helpId, Shell parentShell) { super(parentShell, Messages.InfoNaggerDialogTitle, null, msgText, MessageDialog.INFORMATION, new String[] { IDialogConstants.HELP_LABEL, IDialogConstants.PROCEED_LABEL }, 0, Messages.InfoNaggerDialogToggleMsg, false); m_helpId = helpId; this.setShellStyle(SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL); // setBlockOnOpen has to be true for using NagDialog in // AUTConfigPropertiesDialog and NewProjectWizard this.setBlockOnOpen(true); }
From source file:org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil.java
License:Open Source License
/** * Open the message dialog.//ww w . j a v a 2 s . c o m * <p><b>Use createMessageDialog(JBException ex, Object[] params, String[] details) * instead, if you want to get an entry in error log.</b></p> * @param messageID the actual messageID * @param params Parameter of the message text or null, if not needed. * @param details use null, or overwrite in MessageIDs hardcoded details. * @param parent the parent shell to use for this message dialog * @return the dialog. */ public static Dialog createMessageDialog(final Integer messageID, final Object[] params, final String[] details, final Shell parent) { String title = StringConstants.EMPTY; String message = StringConstants.EMPTY; String[] labels = new String[] { JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY) }; int imageID = MessageDialog.INFORMATION; Message msg = MessageIDs.getMessageObject(messageID); String[] detail = lineFeed(msg.getDetails()); if (details != null) { detail = lineFeed(details); } switch (msg.getSeverity()) { case Message.ERROR: title = Messages.UtilsError; message = Messages.UtilsErrorOccurred; break; case Message.INFO: title = Messages.UtilsInfo1; message = Messages.UtilsInfo2; break; case Message.WARNING: title = Messages.UtilsWarning1; message = Messages.UtilsWarning2; break; case Message.QUESTION: title = Messages.UtilsRequest1; message = Messages.UtilsRequest2; labels = new String[] { JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY), JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY) }; imageID = MessageDialog.QUESTION; break; default: break; } IStatus[] status = new Status[detail.length]; for (int i = 0; i < detail.length; i++) { status[i] = new Status(msg.getSeverity(), Constants.PLUGIN_ID, IStatus.OK, detail[i], null); } if ((msg.getSeverity() == Message.INFO || msg.getSeverity() == Message.QUESTION)) { StringBuilder messageBuilder = new StringBuilder(message); messageBuilder.append(msg.getMessage(params)); messageBuilder.append(StringConstants.NEWLINE); for (IStatus s : status) { if (s.getMessage() != Message.NO_DETAILS) { messageBuilder.append(StringConstants.NEWLINE); messageBuilder.append(s.getMessage()); } } dlg = new MessageDialog(parent, title, null, messageBuilder.toString(), imageID, labels, 0); } else { dlg = new ErrorDialog(parent, title, message, new MultiStatus(Constants.PLUGIN_ID, IStatus.OK, status, msg.getMessage(params), null), IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); } dlg.create(); DialogUtils.setWidgetNameForModalDialog(dlg); dlg.open(); return dlg; }
From source file:org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard.java
License:Open Source License
/** * {@inheritDoc}/*from w w w. j a v a 2 s . c om*/ */ public IWizardPage getNextPage(final IWizardPage page) { if (page == fOverviewPage || page == fNoOverviewPage) { fCurrentRefactoring = 0; return getRefactoringPage(); } else if (page == fPreviewPage) { fCurrentRefactoring++; return getRefactoringPage(); } else if (page == fErrorPage) { final RefactoringStatus status = fErrorPage.getStatus(); final IWizardContainer wizard = getContainer(); if (status.hasFatalError()) { final IPreferenceStore store = RefactoringUIPlugin.getDefault().getPreferenceStore(); String message = null; String key = null; if (!RefactoringUIMessages.RefactoringHistoryPreviewPage_apply_error_title .equals(fErrorPage.getTitle())) { message = Messages.format(RefactoringUIMessages.RefactoringHistoryWizard_fatal_error_message, fErrorPage.getTitle()); key = PREFERENCE_DO_NOT_SHOW_SKIP; } else { message = RefactoringUIMessages.RefactoringHistoryWizard_error_applying_changes; key = PREFERENCE_DO_NOT_SHOW_APPLY_ERROR; } if (!store.getBoolean(key)) { final MessageDialogWithToggle dialog = new MessageDialogWithToggle(getShell(), wizard.getShell().getText(), null, message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, RefactoringUIMessages.RefactoringHistoryWizard_do_not_show_message, false); dialog.open(); store.setValue(key, dialog.getToggleState()); if (dialog.getReturnCode() == 1) return null; } fCurrentRefactoring++; return getRefactoringPage(); } final Refactoring refactoring = fErrorPage.getRefactoring(); if (refactoring != null) { final IRunnableWithProgress runnable = new IRunnableWithProgress() { public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Assert.isNotNull(monitor); try { fPreviewPage.setRefactoring(refactoring); final Change change = createChange(refactoring, monitor); getShell().getDisplay().syncExec(new Runnable() { public final void run() { fPreviewPage.setChange(change); } }); } catch (CoreException exception) { throw new InvocationTargetException(exception); } catch (OperationCanceledException exception) { throw new InterruptedException(exception.getLocalizedMessage()); } finally { monitor.done(); } } }; try { wizard.run(true, false, runnable); } catch (InvocationTargetException exception) { final Throwable throwable = exception.getTargetException(); if (throwable != null) { RefactoringUIPlugin.log(exception); fErrorPage.setStatus(RefactoringStatus.createFatalErrorStatus( RefactoringUIMessages.RefactoringWizard_unexpected_exception_1)); return fErrorPage; } } catch (InterruptedException exception) { return fErrorPage; } } else { fPreviewPage.setRefactoring(null); fPreviewPage.setChange(null); } final RefactoringDescriptorProxy descriptor = getRefactoringDescriptor(); if (descriptor != null) fPreviewPage.setTitle(descriptor, fCurrentRefactoring, fDescriptorProxies.length); else fPreviewPage.setTitle(RefactoringUIMessages.PreviewWizardPage_changes); fPreviewPage.setStatus(status); fPreviewPage.setNextPageDisabled(isLastRefactoring()); return fPreviewPage; } return super.getNextPage(page); }
From source file:org.eclipse.ltk.ui.refactoring.history.RefactoringHistoryWizard.java
License:Open Source License
/** * {@inheritDoc}// www .ja v a 2 s.c o m */ public boolean performCancel() { if (fExecutedRefactorings > 0 && !fCancelException) { final IPreferenceStore store = RefactoringUIPlugin.getDefault().getPreferenceStore(); if (!store.getBoolean(PREFERENCE_DO_NOT_WARN_UNDO_ON_CANCEL)) { final MessageFormat format = new MessageFormat( RefactoringUIMessages.RefactoringHistoryWizard_undo_message_pattern); final String message = RefactoringUIMessages.RefactoringHistoryWizard_undo_message_explanation; final String[] messages = { RefactoringUIMessages.RefactoringHistoryWizard_one_refactoring_undone + message, RefactoringUIMessages.RefactoringHistoryWizard_several_refactorings_undone + message }; final ChoiceFormat choice = new ChoiceFormat(new double[] { 1, Double.MAX_VALUE }, messages); format.setFormatByArgumentIndex(0, choice); final MessageDialogWithToggle dialog = new MessageDialogWithToggle(getShell(), getShell().getText(), null, format.format(new Object[] { new Integer(fExecutedRefactorings) }), MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, RefactoringUIMessages.RefactoringHistoryWizard_do_not_show_message, false); dialog.open(); store.setValue(PREFERENCE_DO_NOT_WARN_UNDO_ON_CANCEL, dialog.getToggleState()); if (dialog.getReturnCode() == 1) return false; } final IRunnableWithProgress runnable = new IRunnableWithProgress() { public final void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { for (int index = 0; index < fExecutedRefactorings; index++) { try { RefactoringCore.getUndoManager().performUndo(null, new SubProgressMonitor(monitor, 100)); if (fExecutedRefactorings > 0) fExecutedRefactorings--; } catch (CoreException exception) { throw new InvocationTargetException(exception); } } } }; try { getContainer().run(false, false, runnable); } catch (InvocationTargetException exception) { RefactoringUIPlugin.log(exception); fCancelException = true; fErrorPage.setStatus(RefactoringStatus .createFatalErrorStatus(RefactoringUIMessages.RefactoringHistoryWizard_internal_error)); fErrorPage.setNextPageDisabled(true); fErrorPage.setTitle(RefactoringUIMessages.RefactoringHistoryWizard_internal_error_title); fErrorPage .setDescription(RefactoringUIMessages.RefactoringHistoryWizard_internal_error_description); getContainer().showPage(fErrorPage); return false; } catch (InterruptedException exception) { // Does not happen } } return super.performCancel(); }