use of org.eclipse.emf.common.util.BasicDiagnostic in project iobserve-analysis by research-iobserve.
the class systemadaptationEditor method analyzeResourceProblems.
/**
* Returns a diagnostic describing the errors and warnings listed in the resource
* and the specified exception (if any).
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
boolean hasErrors = !resource.getErrors().isEmpty();
if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic = new BasicDiagnostic(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "planning.systemadaptation.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object) resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
} else if (exception != null) {
return new BasicDiagnostic(Diagnostic.ERROR, "planning.systemadaptation.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
} else {
return Diagnostic.OK_INSTANCE;
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project iobserve-analysis by research-iobserve.
the class cloudprofileEditor method analyzeResourceProblems.
/**
* Returns a diagnostic describing the errors and warnings listed in the resource
* and the specified exception (if any).
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
boolean hasErrors = !resource.getErrors().isEmpty();
if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic = new BasicDiagnostic(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.iobserve.planning.cloudprofile.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object) resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
} else if (exception != null) {
return new BasicDiagnostic(Diagnostic.ERROR, "org.iobserve.planning.cloudprofile.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
} else {
return Diagnostic.OK_INSTANCE;
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project statecharts by Yakindu.
the class AbstractSTextValidationTest method setup.
@Before
public void setup() {
factory = SGraphFactory.eINSTANCE;
resource = new StextResource(URI.createURI(""));
injector.injectMembers(resource);
statechart = factory.createStatechart();
resource.getContents().add(statechart);
diagnostics = new BasicDiagnostic();
tester = new ValidatorTester<STextJavaValidator>(validator, injector);
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project statecharts by Yakindu.
the class SGraphJavaValidationTest method initialEntryWithMultipleOutgoingTransition.
/**
* An entry should not have more than one outgoing transition
*/
@Test
public void initialEntryWithMultipleOutgoingTransition() {
prepareStateTest();
Entry entry = factory.createEntry();
region.getVertices().add(entry);
createTransition(entry, state);
createTransition(entry, state);
assertEquals(EntryKind.INITIAL, entry.getKind());
assertFalse(validator.validate(entry, diagnostics, new HashMap<Object, Object>()));
assertError(diagnostics, ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
entry.setKind(EntryKind.SHALLOW_HISTORY);
diagnostics = new BasicDiagnostic();
assertFalse(validator.validate(entry, diagnostics, new HashMap<Object, Object>()));
assertError(diagnostics, ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
entry.setKind(EntryKind.DEEP_HISTORY);
diagnostics = new BasicDiagnostic();
assertFalse(validator.validate(entry, diagnostics, new HashMap<Object, Object>()));
assertError(diagnostics, ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project statecharts by Yakindu.
the class SGraphJavaValidationTest method assertWarning.
protected void assertWarning(BasicDiagnostic diag, String message) {
Diagnostic d = issueByName(diag, message);
assertNotNull("Issue '" + message + "' does not exist.", issueByName(diag, message));
assertEquals("Issue '" + message + "' is no warning.", Diagnostic.WARNING, d.getSeverity());
}
Aggregations