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.caleydo.vis.lineup.ui.detail.JSCombineEditorDialog.java
License:Open Source License
private void testOrderPressed() { try {/*from ww w.jav a2 s. com*/ float[] as = parseArray(testOrderAUI.getText()); float[] bs = parseArray(testOrderBUI.getText()); if (!verifyCodeOrder() || !verifyCode()) return; w.getBuffer().setLength(0); // reset Bindings b = engine.createBindings(); b.put("a", new Wrapper(as, 0)); b.put("b", new Wrapper(bs, 0)); b.put("weights", parseArray(testWeightUI.getText())); b.put("mode", "multi"); Object output = script.eval(b); if (output instanceof Number) output = ((Number) output).intValue(); testOrderOutputUI.setText(Objects.toString(output)); String extra = w.toString(); if (extra.length() > 0) setMessage(extra, IMessageProvider.WARNING); else setMessage(DEFAULT_MESSAGE, IMessageProvider.INFORMATION); } catch (NumberFormatException e) { testOutputUI.setText("Invalid input: " + e.getMessage()); } catch (ScriptException e) { testOutputUI.setText("Error: " + e.getMessage()); } }
From source file:org.caleydo.vis.lineup.ui.mapping.JSEditorDialog.java
License:Open Source License
private void testPressed() { try {/*w w w . j ava2 s .c o m*/ double f = Double.parseDouble(testUI.getText()); if (!verifyCode()) return; w.getBuffer().setLength(0); // reset Bindings b = engine.createBindings(); b.put("v", f); model.addBindings(b); final Object r = script.eval(b); String output = Objects.toString(r); testOutputUI.setText(output); String extra = w.toString(); if (extra.length() > 0) setMessage(extra, IMessageProvider.WARNING); else setMessage(DEFAULT_MESSAGE, IMessageProvider.INFORMATION); } catch (NumberFormatException e) { testOutputUI.setText("Invalid input: " + e.getMessage()); } catch (ScriptException e) { testOutputUI.setText("Error: " + e.getMessage()); } }
From source file:org.camunda.bpm.modeler.ui.dialog.importer.ModelProblemsDialog.java
License:Open Source License
@Override public void create() { super.create(); // Set the title setTitle("One or more problems found while opening the BPMN 2.0 model"); // Set the message String summaryMessage = createSummaryMessage(exception, warnings); setMessage(summaryMessage, exception == null ? IMessageProvider.WARNING : IMessageProvider.ERROR); }
From source file:org.cfeclipse.cfml.editors.CFMLEditor.java
License:Open Source License
/** * Implementation copied from org.eclipse.ui.editors.text.TextEditor. */// w w w .j a v a 2s . com protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); String RESOURCE_BUNDLE = "org.eclipse.ui.editors.text.TextEditorMessages";//$NON-NLS-1$ ResourceBundle fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); 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 programmatically been closed while the dialog was open return; } // fix for RSE linked files if (provider.isDeleted(input) && original != null && original.exists()) { provider.aboutToChange(input); try { provider.saveDocument(progressMonitor, input, provider.getDocument(input), true); } catch (CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } return; } if (provider.isDeleted(input) && original != null) { String message = MessageFormat.format(fgResourceBundle.getString("Editor.warning.save.delete"), //$NON-NLS-1$ new Object[] { 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; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IFile file = workspace.getRoot().getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); boolean success = false; try { provider.aboutToChange(newInput); provider.saveDocument(progressMonitor, newInput, provider.getDocument(input), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { String title = fgResourceBundle.getString("Editor.error.save.title"); //$NON-NLS-1$ String msg = MessageFormat.format(fgResourceBundle.getString("Editor.error.save.message"), //$NON-NLS-1$ new Object[] { x.getMessage() }); if (status != null) { switch (status.getSeverity()) { case IStatus.INFO: MessageDialog.openInformation(shell, title, msg); break; case IStatus.WARNING: MessageDialog.openWarning(shell, title, msg); break; default: MessageDialog.openError(shell, title, msg); } } else { MessageDialog.openError(shell, title, msg); } } } finally { provider.changed(newInput); if (success) setInput(newInput); } if (progressMonitor != null) progressMonitor.setCanceled(!success); }
From source file:org.cloudfoundry.ide.eclipse.internal.server.ui.actions.RefreshApplicationEditorAction.java
License:Open Source License
@Override protected void display404Error(IStatus status) { IModule currentModule = getEditorPage().getMasterDetailsBlock().getCurrentModule(); if (currentModule != null) { getEditorPage().setMessage("Local module is not yet deployed. Cannot refresh with server.", IMessageProvider.WARNING); } else {//from w ww . j av a 2 s . c o m getEditorPage().setMessage("Status is not up to date with server. Refresh needed.", IMessageProvider.WARNING); } }
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.actions.RefreshApplicationEditorAction.java
License:Open Source License
@Override protected void display404Error(IStatus status) { IModule currentModule = getEditorPage().getMasterDetailsBlock().getCurrentModule(); if (currentModule != null) { getEditorPage().setMessage(Messages.RefreshApplicationEditorAction_WARNING_CANNOT_REFRESH, IMessageProvider.WARNING); } else {//from ww w .j a v a 2s . com getEditorPage().setMessage(Messages.RefreshApplicationEditorAction_MSG_REFRESH_NEEDED, IMessageProvider.WARNING); } }
From source file:org.codecover.eclipse.exportWizards.MainExportPage.java
License:Open Source License
private void handleErrors() { String fileError = checkFile(); if (getSelectedTestSessionContainer() == null) { setErrorMessage(ERROR_NO_TEST_SESSION_CONTAINER_SELECTED); setPageComplete(false);/*from www .j a v a 2 s . c o m*/ } else if (this.getSelectedTestCases().size() == 0) { setErrorMessage(ERROR_NO_TEST_CASES_SELECTED); setPageComplete(false); } else if (fileError != null) { setErrorMessage(fileError); setPageComplete(false); } else { setErrorMessage(null); setPageComplete(true); if (this.getSelectedType() == Types.TEST_SESSION_CONTAINER && this.containsNotFullySelectedTestSession()) { setMessage(WARNING_INCOMPLETE_TEST_SESSION_SELECTION, IMessageProvider.WARNING); } else { this.setMessage(DESCRIPTION, IMessageProvider.NONE); } } }
From source file:org.codecover.eclipse.views.controls.MergeWizardPage.java
License:Open Source License
/** * Checks the selected elements, and sets errors or warnings to be * displayed:/*from w ww.jav a 2 s. c o m*/ * <ul> * <li>Error if there are less than two test elements of the selected type * (test session or test case) selected.</li> * <li>Error if the selected type to merge is test case and there are test * cases of different test sessions selected.</li> * <li>Warning if there are test cases selected although test sessions * are the selected type to be merged or vice versa.</li> * </ul> * The name field is not checked. This is done by * {@link ElementNameFieldListener}. */ private void checkElements() { String error = null; // if test sessions are to be merged... if (this.bttTestSession.getSelection()) { if (this.selectedTestSessions.size() < 2) { error = ERROR_TEST_ELEMENTS_UNDER_2_SELECTED; } /* * check if test cases are selected although test sessions are * to be merged */ if (!this.selectedTestCases.isEmpty()) { this.setMessage(WARNING_TEST_CASES_SELECTED, IMessageProvider.WARNING); } else { this.setMessage(DESCRIPTION, IMessageProvider.NONE); } } else /* if test cases are to be merged... */ { if (this.selectedTestCases.size() < 2) { error = ERROR_TEST_ELEMENTS_UNDER_2_SELECTED; } else if (this.isTestCasesWithDifferentParentsSelected()) { error = ERROR_TEST_CASES_OF_DIFFERENT_TEST_SESSIONS; } /* * check if test sessions are selected although test cases are * to be merged */ if (!this.selectedTestSessions.isEmpty()) { this.setMessage(WARNING_TEST_SESSIONS_SELECTED, IMessageProvider.WARNING); } else { this.setMessage(DESCRIPTION, IMessageProvider.NONE); } } this.elementsError = error; }
From source file:org.csstudio.trends.databrowser2.ui.AddPVDialog.java
License:Open Source License
/** Update the internal variables according to the user input and * validate them.//from ww w . j a va 2 s .c o m * This method also updates the message shown in this dialog. * @return True if all the values input by the user are valid. Otherwise, false. */ private boolean updateAndValidate() { for (int i = 0; i < name.length; ++i) { // Valid name? name[i] = txt_name[i].getText().trim(); if (name[i].length() <= 0) { setMessage(Messages.EmptyNameError, IMessageProvider.ERROR); return false; } // Valid scan period? if (!formula && !btn_monitor[i].getSelection()) { if (btn_monitor[i].getSelection()) period[i] = 0.0; else { try { period[i] = Double.parseDouble(txt_period[i].getText().trim()); if (period[i] < 0) throw new Exception(); } catch (Throwable ex) { setMessage(Messages.InvalidScanPeriodError, IMessageProvider.ERROR); return false; } } } // update axis_index internally if (axis[i] == null || axis[i].getSelectionIndex() <= 0) axis_index[i] = -1; else // entry 0 is 'no axis' axis_index[i] = axis[i].getSelectionIndex() - 1; // Now that Model accepts multiple items with the same name, // there is no need to prohibit from adding a new item with the // existing name, but this dialog just warns that the model has // at least one item with the given name. if (existing_names.contains(name[i])) { setMessage(NLS.bind(Messages.DuplicateItemFmt, name), IMessageProvider.WARNING); return true; } } // All OK setMessage(formula ? Messages.AddFormulaMsg : Messages.AddPVMsg); return true; }
From source file:org.cubictest.ui.wizards.NewFileWithNameAndDescriptionPage.java
License:Open Source License
private void updateStatus(String message, int severity) { if (severity == STATUS_ERROR) { setErrorMessage(message);//from ww w . j av a 2 s. co m setMessage(null); } else { setErrorMessage(null); setMessage(message, IMessageProvider.WARNING); } setPageComplete(message == null); }