use of org.eclipse.emf.common.util.BasicDiagnostic in project xtext-eclipse by eclipse.
the class DiagnosticTreeIterableTest method testIteratorIsNotConsumed.
@Test
public void testIteratorIsNotConsumed() {
BasicDiagnostic root = new BasicDiagnostic();
root.add(new BasicDiagnostic());
AssertableDiagnostics diagnostics = new AssertableDiagnostics(root);
Iterable<Diagnostic> allDiagnostics = diagnostics.getAllDiagnostics();
Iterator<Diagnostic> first = allDiagnostics.iterator();
while (first.hasNext()) {
first.next();
}
Assert.assertTrue(allDiagnostics.iterator().hasNext());
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project xtext-eclipse by eclipse.
the class ValidatorTester method validator.
public T validator() {
State s = validator.setMessageAcceptor(validator).getState();
if (s.chain == null)
s.chain = new BasicDiagnostic();
validatorCalled = true;
return validator;
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project iobserve-analysis by research-iobserve.
the class cloudprofileEditor method updateProblemIndication.
/**
* Updates the problems indication with the information described in the specified diagnostic.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void updateProblemIndication() {
if (updateProblemIndication) {
BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.iobserve.planning.cloudprofile.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
if (childDiagnostic.getSeverity() != Diagnostic.OK) {
diagnostic.add(childDiagnostic);
}
}
int lastEditorPage = getPageCount() - 1;
if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
if (diagnostic.getSeverity() != Diagnostic.OK) {
setActivePage(lastEditorPage);
}
} else if (diagnostic.getSeverity() != Diagnostic.OK) {
ProblemEditorPart problemEditorPart = new ProblemEditorPart();
problemEditorPart.setDiagnostic(diagnostic);
problemEditorPart.setMarkerHelper(markerHelper);
try {
addPage(++lastEditorPage, problemEditorPart, getEditorInput());
setPageText(lastEditorPage, problemEditorPart.getPartName());
setActivePage(lastEditorPage);
showTabs();
} catch (PartInitException exception) {
CloudProfileEditorPlugin.INSTANCE.log(exception);
}
}
if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
markerHelper.deleteMarkers(editingDomain.getResourceSet());
if (diagnostic.getSeverity() != Diagnostic.OK) {
try {
markerHelper.createMarkers(diagnostic);
} catch (CoreException exception) {
CloudProfileEditorPlugin.INSTANCE.log(exception);
}
}
}
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project iobserve-analysis by research-iobserve.
the class systemadaptationEditor method updateProblemIndication.
/**
* Updates the problems indication with the information described in the specified diagnostic.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void updateProblemIndication() {
if (updateProblemIndication) {
BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "planning.systemadaptation.editor", 0, null, new Object[] { editingDomain.getResourceSet() });
for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
if (childDiagnostic.getSeverity() != Diagnostic.OK) {
diagnostic.add(childDiagnostic);
}
}
int lastEditorPage = getPageCount() - 1;
if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
if (diagnostic.getSeverity() != Diagnostic.OK) {
setActivePage(lastEditorPage);
}
} else if (diagnostic.getSeverity() != Diagnostic.OK) {
ProblemEditorPart problemEditorPart = new ProblemEditorPart();
problemEditorPart.setDiagnostic(diagnostic);
problemEditorPart.setMarkerHelper(markerHelper);
try {
addPage(++lastEditorPage, problemEditorPart, getEditorInput());
setPageText(lastEditorPage, problemEditorPart.getPartName());
setActivePage(lastEditorPage);
showTabs();
} catch (PartInitException exception) {
systemadaptationEditorPlugin.INSTANCE.log(exception);
}
}
if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
markerHelper.deleteMarkers(editingDomain.getResourceSet());
if (diagnostic.getSeverity() != Diagnostic.OK) {
try {
markerHelper.createMarkers(diagnostic);
} catch (CoreException exception) {
systemadaptationEditorPlugin.INSTANCE.log(exception);
}
}
}
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project mylyn.docs by eclipse.
the class Publication method validateMetadata.
/**
* Validates the data model contents.
*
* @return a list of EMF diagnostics
*/
public List<Diagnostic> validateMetadata() {
EValidator.Registry.INSTANCE.put(OPFPackage.eINSTANCE, new OPFValidator());
BasicDiagnostic diagnostics = new BasicDiagnostic();
for (EObject eo : opfPackage.eContents()) {
Map<Object, Object> context = new HashMap<Object, Object>();
Diagnostician.INSTANCE.validate(eo, diagnostics, context);
}
return diagnostics.getChildren();
}
Aggregations