Search in sources :

Example 1 with TcgExtractor

use of com.rockwellcollins.atc.tcg.extensions.TcgExtractor in project AGREE by loonwerks.

the class TestCaseGeneratorMenuListener method addViewTestCaseMenu.

private void addViewTestCaseMenu(IMenuManager manager, AnalysisResult result) {
    final Counterexample cex = getCounterexample(result);
    TcgExtractorRegistry tcgReg = (TcgExtractorRegistry) ExtensionRegistry.getRegistry(ExtensionRegistry.TCG_EXTRACTOR_EXT_ID);
    List<TcgExtractor> extractors = tcgReg.getTcgExtractors();
    if (cex != null) {
        final String cexType = getCounterexampleType(result);
        final Layout layout = linker.getLayout(result.getParent());
        final Renaming renaming = linker.getRenaming(result.getParent());
        final Map<String, EObject> refMap = ((TcgRenaming) renaming).getTcgRefMap();
        final Counterexample translatedCex = AgreeMenuListener.translateCounterexampleArrayIndices(cex);
        MenuManager sub = new MenuManager("View " + cexType + "Test Case in");
        manager.add(sub);
        sub.add(new Action("Console") {

            @Override
            public void run() {
                viewCexConsole(translatedCex, layout, refMap, (TcgRenaming) renaming);
            }
        });
        sub.add(new Action("Eclipse") {

            @Override
            public void run() {
                viewCexEclipse(translatedCex, layout, refMap);
            }
        });
        sub.add(new Action("Spreadsheet") {

            @Override
            public void run() {
                viewCexSpreadsheet(translatedCex, layout);
            }
        });
        // send counterexamples to external plugins
        PropertyResult pr = (PropertyResult) result;
        EObject property = refMap.get(pr.getName());
        ComponentImplementation compImpl = linker.getComponent(result.getParent());
        for (TcgExtractor ex : extractors) {
            sub.add(new Action(ex.getDisplayText()) {

                @Override
                public void run() {
                    ex.receiveCex(compImpl, property, translatedCex, refMap);
                }
            });
        }
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) TcgExtractorRegistry(com.rockwellcollins.atc.tcg.extensions.TcgExtractorRegistry) TcgExtractor(com.rockwellcollins.atc.tcg.extensions.TcgExtractor) Counterexample(jkind.results.Counterexample) PropertyResult(jkind.api.results.PropertyResult) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming) Renaming(jkind.api.results.Renaming) Layout(jkind.results.layout.Layout) EObject(org.eclipse.emf.ecore.EObject) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)

Example 2 with TcgExtractor

use of com.rockwellcollins.atc.tcg.extensions.TcgExtractor in project AGREE by loonwerks.

the class TestSuiteMenuListener method addViewTestCaseMenu.

private void addViewTestCaseMenu(IMenuManager manager, TestCase testCase) {
    final Counterexample cex = testCase.getCex();
    TcgExtractorRegistry tcgReg = (TcgExtractorRegistry) ExtensionRegistry.getRegistry(ExtensionRegistry.TCG_EXTRACTOR_EXT_ID);
    List<TcgExtractor> extractors = tcgReg.getTcgExtractors();
    if (cex != null) {
        /*
			 * TODO: getCounterexampleType?
			 */
        // final String cexType = getCounterexampleType(result);
        final String cexType = "";
        final Layout layout = linker.getLayout(result);
        final Renaming renaming = linker.getRenaming(result);
        final Map<String, EObject> refMap = ((TcgRenaming) linker.getRenaming(result)).getTcgRefMap();
        final Counterexample translatedCex = AgreeMenuListener.translateCounterexampleArrayIndices(cex);
        MenuManager sub = new MenuManager("View " + cexType + "Test Case in");
        manager.add(sub);
        sub.add(new Action("Console") {

            @Override
            public void run() {
                viewCexConsole(translatedCex, layout, refMap, (TcgRenaming) renaming);
            }
        });
        sub.add(new Action("Eclipse") {

            @Override
            public void run() {
                viewCexEclipse(translatedCex, layout, refMap);
            }
        });
        sub.add(new Action("Spreadsheet") {

            @Override
            public void run() {
                viewCexSpreadsheet(translatedCex, layout);
            }
        });
        // send counterexamples to external plugins
        EObject property = refMap.get(testCase.getName());
        ComponentImplementation compImpl = linker.getComponent(result);
        for (TcgExtractor ex : extractors) {
            sub.add(new Action(ex.getDisplayText()) {

                @Override
                public void run() {
                    ex.receiveCex(compImpl, property, translatedCex, refMap);
                }
            });
        }
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) TcgExtractorRegistry(com.rockwellcollins.atc.tcg.extensions.TcgExtractorRegistry) TcgExtractor(com.rockwellcollins.atc.tcg.extensions.TcgExtractor) Counterexample(jkind.results.Counterexample) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming) Renaming(jkind.api.results.Renaming) Layout(jkind.results.layout.Layout) EObject(org.eclipse.emf.ecore.EObject) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) TcgRenaming(com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)

Aggregations

TcgExtractor (com.rockwellcollins.atc.tcg.extensions.TcgExtractor)2 TcgExtractorRegistry (com.rockwellcollins.atc.tcg.extensions.TcgExtractorRegistry)2 TcgRenaming (com.rockwellcollins.atc.tcg.obligations.ufc.TcgRenaming)2 Renaming (jkind.api.results.Renaming)2 Counterexample (jkind.results.Counterexample)2 Layout (jkind.results.layout.Layout)2 EObject (org.eclipse.emf.ecore.EObject)2 Action (org.eclipse.jface.action.Action)2 IAction (org.eclipse.jface.action.IAction)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2 MenuManager (org.eclipse.jface.action.MenuManager)2 ComponentImplementation (org.osate.aadl2.ComponentImplementation)2 PropertyResult (jkind.api.results.PropertyResult)1