Search in sources :

Example 1 with QueuingAnalysisErrorReporter

use of org.osate.aadl2.modelsupport.errorreporting.QueuingAnalysisErrorReporter in project AGREE by loonwerks.

the class VerifyHandler method getSysInstance.

protected SystemInstance getSysInstance(ComponentImplementation ci, EphemeralImplementationUtil implUtil) {
    try {
        AnalysisErrorReporterManager errorManager = new AnalysisErrorReporterManager(QueuingAnalysisErrorReporter.factory);
        SystemInstance result = implUtil.generateEphemeralCompInstanceFromImplementation(ci);
        QueuingAnalysisErrorReporter errorReporter = (QueuingAnalysisErrorReporter) errorManager.getReporter(result.eResource());
        StringBuilder stringBuilder = new StringBuilder();
        List<Message> instantiationMarkers = errorReporter.getErrors();
        if (!instantiationMarkers.isEmpty()) {
            instantiationMarkers.stream().forEach(marker -> {
                stringBuilder.append(marker.message);
            });
            throw new AgreeException(stringBuilder.toString());
        }
        return result;
    } catch (Exception e) {
        Dialog.showError("Model Instantiate", "Error while re-instantiating the model: " + e.getMessage());
        throw new AgreeException("Error Instantiating model");
    }
}
Also used : Message(org.osate.aadl2.modelsupport.errorreporting.QueuingAnalysisErrorReporter.Message) SystemInstance(org.osate.aadl2.instance.SystemInstance) QueuingAnalysisErrorReporter(org.osate.aadl2.modelsupport.errorreporting.QueuingAnalysisErrorReporter) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) AnalysisErrorReporterManager(org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager) PartInitException(org.eclipse.ui.PartInitException) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) JKindException(jkind.JKindException)

Aggregations

AgreeException (com.rockwellcollins.atc.agree.analysis.AgreeException)1 JKindException (jkind.JKindException)1 PartInitException (org.eclipse.ui.PartInitException)1 SystemInstance (org.osate.aadl2.instance.SystemInstance)1 AnalysisErrorReporterManager (org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager)1 QueuingAnalysisErrorReporter (org.osate.aadl2.modelsupport.errorreporting.QueuingAnalysisErrorReporter)1 Message (org.osate.aadl2.modelsupport.errorreporting.QueuingAnalysisErrorReporter.Message)1