Search in sources :

Example 6 with NoModelException

use of org.absmodels.abs.plugin.internal.NoModelException in project abstools by abstools.

the class AbsNature method typeCheckModel.

/**
 * takes the properties from the project preference store for location type checking and location type precision. Typeckecks
 * the current model in the current model builder.
 * Note that your model must be sufficiently "complete" and not have any semantic errors .
 * @param monitor
 * @throws CoreException {@link IResource#deleteMarkers(String, boolean, int)} does not handle exceptions thrown by
 * #createMarker(SemanticError) and #createMarker(TypecheckInternalException)
 */
void typeCheckModel(IProgressMonitor monitor) throws CoreException {
    getProject().deleteMarkers(TYPECHECK_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
    getProject().deleteMarkers(LOCATION_TYPE_INFERENCE_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
    boolean dolocationtypecheck = getProjectPreferenceStore().getBoolean(LOCATION_TYPECHECK);
    String defaultlocationtype = getProjectPreferenceStore().getString(DEFAULT_LOCATION_TYPE);
    String defaultlocationtypeprecision = getProjectPreferenceStore().getString(LOCATION_TYPE_PRECISION);
    boolean checkProducts = getProjectPreferenceStore().getBoolean(PRODUCT_TYPECHECK);
    try {
        addPackagesForTypeChecking();
        final SemanticConditionList typeerrors = modelbuilder.typeCheckModel(monitor, dolocationtypecheck, defaultlocationtype, defaultlocationtypeprecision, checkProducts);
        createMarkers(typeerrors);
        if (dolocationtypecheck) {
            createLocationTypeInferenceMarker();
        }
    } catch (NoModelException e) {
        // ignore
        return;
    } catch (TypecheckInternalException e) {
        /* Internal error caught. Log, and turn into an error marker */
        Activator.logException(e);
        createMarker(e);
        return;
    }
}
Also used : NoModelException(org.absmodels.abs.plugin.internal.NoModelException) SemanticConditionList(abs.frontend.analyser.SemanticConditionList) TypecheckInternalException(org.absmodels.abs.plugin.internal.TypecheckInternalException)

Aggregations

NoModelException (org.absmodels.abs.plugin.internal.NoModelException)6 WrongProgramArgumentException (abs.common.WrongProgramArgumentException)2 CompilationUnit (abs.frontend.ast.CompilationUnit)2 Model (abs.frontend.ast.Model)2 DeltaModellingException (abs.frontend.delta.DeltaModellingException)2 Main (abs.frontend.parser.Main)2 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 AbsNature (org.absmodels.abs.plugin.builder.AbsNature)2 PackageAbsFile (org.absmodels.abs.plugin.editor.outline.PackageAbsFile)2 TypecheckInternalException (org.absmodels.abs.plugin.internal.TypecheckInternalException)2 JavaCode (abs.backend.java.codegeneration.JavaCode)1 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)1 PackageEntry (org.absmodels.abs.plugin.editor.outline.PackageEntry)1 AbsJobException (org.absmodels.abs.plugin.exceptions.AbsJobException)1 UtilityFunctions.getAbsNature (org.absmodels.abs.plugin.util.UtilityFunctions.getAbsNature)1