private void setFileMarkers ( IFile file , ParseResult result ) throws CoreException { if ( file != null ) { FileUtility . deleteMarker ( file , IMarker . PROBLEM , ICoreConstants . PLUGIN_ID ) ; if ( result . hasParseErrors ( ) ) { file . deleteMarkers ( IMarker . PROBLEM , true , IResource . DEPTH_INFINITE ) ; int previousErrorNumber = - 1 ; for ( VDMError error : result . getErrors ( ) ) { if ( previousErrorNumber == error . number ) { // this check is // done to avoid // error fall // through continue ; } else { previousErrorNumber = error . number ; } FileUtility . addMarker ( file , error . toProblemString ( ) , error . location , IMarker . SEVERITY_ERROR , ICoreConstants . PLUGIN_ID , - 1 ) ; } } IVdmProject vdmProject = ( IVdmProject ) project . getAdapter ( IVdmProject . class ) ; if ( result . getWarnings ( ) . size ( ) > 0 && vdmProject != null && vdmProject . hasSuppressWarnings ( ) ) { for ( VDMWarning warning : result . getWarnings ( ) ) { FileUtility . addMarker ( file , warning . toProblemString ( ) , warning . location , IMarker . SEVERITY_WARNING , ICoreConstants . PLUGIN_ID , - 1 ) ; } } } }
Adds markers to a file based on the result . if errors occurred the problem markers are first cleared .