List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.
Click Source Link
From source file:org.eclipse.emf.editor.ModelCheckor.java
License:Open Source License
private List<MessageData> checkValidation(EObject root) { List<MessageData> messages = new ArrayList<MessageData>(); Issues issues = facade.check(root);// ww w . j av a2 s. c o m for (MWEDiagnostic issue : issues.getErrors()) { messages.add(createMessageFromIssue(issue, IMessageProvider.ERROR)); } for (MWEDiagnostic issue : issues.getWarnings()) { messages.add(createMessageFromIssue(issue, IMessageProvider.WARNING)); } return messages; }
From source file:org.eclipse.emf.editor.ModelCheckor.java
License:Open Source License
private List<MessageData> ecoreValidation(EObject rootObject) { int status = IMessageProvider.INFORMATION; Diagnostic diagnostic = Diagnostician.INSTANCE.validate(rootObject); switch (diagnostic.getSeverity()) { case Diagnostic.ERROR: status = IMessageProvider.ERROR; break;//from w ww .j a va 2s.co m case Diagnostic.WARNING: status = IMessageProvider.WARNING; break; case Diagnostic.INFO: status = IMessageProvider.INFORMATION; default: break; } return createMessagesFromDiagnostic(rootObject, diagnostic, status); }
From source file:org.eclipse.emf.example.databinding.project.ui.rcp.views.ProjectFormAreaPart.java
License:Open Source License
private int convertType(int severity) { switch (severity) { case IStatus.OK: return IMessageProvider.NONE; case IStatus.CANCEL: return IMessageProvider.NONE; case IStatus.INFO: return IMessageProvider.INFORMATION; case IStatus.WARNING: return IMessageProvider.WARNING; case IStatus.ERROR: return IMessageProvider.ERROR; default:/*from ww w. j a va 2 s. c o m*/ return IMessageProvider.NONE; } }
From source file:org.eclipse.emf.henshin.diagram.part.HenshinDiagramEditor.java
License:Open Source License
/** * @generated//from w w w. j a v a 2 s . c o m */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.HenshinDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.HenshinDiagramEditor_SaveAsErrorTitle, Messages.HenshinDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.HenshinDiagramEditor_SaveErrorTitle, Messages.HenshinDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:org.eclipse.emf.henshin.interpreter.ui.wizard.HenshinWizard.java
License:Open Source License
@Override public boolean canFinish() { if (transformOperation.getInputUri() == null || transformOperation.getOutputUri() == null || transformOperation.getUnit() == null) { return false; }/*from w w w . j a va2s . c om*/ IFile file = getFile(transformOperation.getOutputUri().toString()); page.setMessage(null); if (file != null && file.exists()) { page.setMessage("Warning: Output file exists already and will be overridden.", IMessageProvider.WARNING); } return true; }
From source file:org.eclipse.epf.diagram.ad.part.ActivityDiagramEditor.java
License:Open Source License
/** * @generated//from www .j a va2 s. c om */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind("The original file ''{0}'' has been deleted.", original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, "Problem During Save As...", "Save could not be completed. Target file is already open in another editor."); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, "Save Problems", "Could not save file.", x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:org.eclipse.epp.internal.mpc.ui.util.Util.java
License:Open Source License
/** * Compute the message type of the given status. * /*from w w w . j a v a 2 s . co m*/ * @see IMessageProvider */ public static int computeMessageType(IStatus status) { int messageType; switch (status.getSeverity()) { case IStatus.OK: case IStatus.INFO: messageType = IMessageProvider.INFORMATION; break; case IStatus.WARNING: messageType = IMessageProvider.WARNING; break; default: messageType = IMessageProvider.ERROR; break; } return messageType; }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.ResolutionStatusPage.java
License:Open Source License
/** * Update the status area of the wizard to report the results of the operation. * /*from w ww. jav a 2s . c o m*/ * @param newRoot the root that describes the root IUs involved in creating the plan. * This can be <code>null</code> if the root should not be updated. * * @param op the ProfileChangeOperation that describes the operation */ public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) { IStatus currentStatus = getProvisioningWizard().getCurrentStatus(); updateCaches(newRoot, op); int messageType = IMessageProvider.NONE; boolean pageComplete = op != null; if (currentStatus != null && !currentStatus.isOK()) { messageType = IMessageProvider.INFORMATION; int severity = currentStatus.getSeverity(); if (severity == IStatus.ERROR) { messageType = IMessageProvider.ERROR; pageComplete = false; // Log errors for later support ProvUI.reportStatus(currentStatus, StatusManager.LOG); } else if (severity == IStatus.WARNING) { messageType = IMessageProvider.WARNING; // Log warnings for later support ProvUI.reportStatus(currentStatus, StatusManager.LOG); } else if (severity == IStatus.CANCEL) { pageComplete = shouldCompleteOnCancel(); } } setPageComplete(pageComplete); if (!isCreated()) return; setMessage(getMessageText(currentStatus), messageType); setDetailText(op); }
From source file:org.eclipse.equinox.internal.security.ui.storage.ChallengeResponseDialog.java
License:Open Source License
protected void validateOK() { boolean valid = true; for (int i = 0; i < size; i++) { if (questions[i] == null) continue; String question = questions[i].getText(); if (question == null || question.length() == 0) { valid = false;//from w w w . j a v a 2s . c o m break; } if (answers[i] == null) continue; String answer = answers[i].getText(); if (answer == null || answer.length() == 0) { valid = false; break; } } if (valid) setMessage(SecUIMessages.passwordMsg, IMessageProvider.NONE); else setMessage(SecUIMessages.passwordErrMsg, IMessageProvider.WARNING); okButton.setEnabled(valid); }
From source file:org.eclipse.equinox.internal.security.ui.storage.PasswordRecoveryDialog.java
License:Open Source License
protected void validateOK() { boolean valid = true; for (int i = 0; i < questionsText.length; i++) { if (answers[i] == null) continue; String question = answers[i].getText(); if (question == null || question.length() == 0) { valid = false;//from w ww. j a v a2 s . co m break; } } if (valid) setMessage(SecUIMessages.pswRecoveryMsg, IMessageProvider.INFORMATION); else setMessage(SecUIMessages.pswRecoveryWarning, IMessageProvider.WARNING); okButton.setEnabled(valid); }