Class ErrorParserManager

    • Field Detail

      • PREF_ERROR_PARSER

        @Deprecated
        public static final String PREF_ERROR_PARSER
        Deprecated.
        since CDT 4.0.
        The list of error parsers stored in .project for 3.X projects as key/value pair with key="org.eclipse.cdt.core.errorOutputParser"
        See Also:
        Constant Field Values
      • ERROR_PARSER_DELIMITER

        public static final char ERROR_PARSER_DELIMITER
        Delimiter for error parsers presented in one string.
        Since:
        5.2
        See Also:
        Constant Field Values
    • Constructor Detail

      • ErrorParserManager

        public ErrorParserManager​(ACBuilder builder)
        Constructor.
        Parameters:
        builder - - project builder.
      • ErrorParserManager

        public ErrorParserManager​(org.eclipse.core.resources.IProject project,
                                  IMarkerGenerator markerGenerator)
        Constructor.
        Parameters:
        project - - project being built.
        markerGenerator - - marker generator able to create markers.
      • ErrorParserManager

        public ErrorParserManager​(org.eclipse.core.resources.IProject project,
                                  IMarkerGenerator markerGenerator,
                                  String[] parsersIDs)
        Constructor.
        Parameters:
        project - - project being built.
        markerGenerator - - marker generator able to create markers.
        parsersIDs - - array of error parsers' IDs.
      • ErrorParserManager

        @Deprecated
        public ErrorParserManager​(org.eclipse.core.resources.IProject project,
                                  org.eclipse.core.runtime.IPath workingDirectory,
                                  IMarkerGenerator markerGenerator,
                                  String[] parsersIDs)
        Constructor.
        Parameters:
        project - - project being built.
        workingDirectory - - IPath location of the working directory of where the build is performed.
        markerGenerator - - marker generator able to create markers.
        parsersIDs - - array of error parsers' IDs.
      • ErrorParserManager

        public ErrorParserManager​(org.eclipse.core.resources.IProject project,
                                  URI baseDirectoryURI,
                                  IMarkerGenerator markerGenerator,
                                  String[] parsersIDs)
        URI based constructor.
        Parameters:
        project - - project being built.
        baseDirectoryURI - - absolute location URI of working directory of where the build is performed.
        markerGenerator - - marker generator able to create markers.
        parsersIDs - - array of error parsers' IDs.
        Since:
        5.1
    • Method Detail

      • getProject

        public org.eclipse.core.resources.IProject getProject()
        Returns:
        current project.
      • getWorkingDirectory

        @Deprecated
        public org.eclipse.core.runtime.IPath getWorkingDirectory()
        Deprecated.
        Returns:
        current working directory location where build is being performed.
      • getWorkingDirectoryURI

        public URI getWorkingDirectoryURI()
        Description copied from interface: IWorkingDirectoryTracker
        Returns current working directory for the current build command as determined from build output.
        Specified by:
        getWorkingDirectoryURI in interface IWorkingDirectoryTracker
        Returns:
        the current URI location where the build is being performed
        Since:
        5.1
      • popDirectoryURI

        public URI popDirectoryURI()
        pushDirectoryURI(URI) and popDirectoryURI() are used to change working directory from where file name is searched (see findFileInWorkspace(IPath)). The intention is to handle make output of commands "pushd" and "popd".
        Returns:
        previous build directory location corresponding 'popd' command.
        Since:
        5.1
      • getDirectoryLevel

        public int getDirectoryLevel()
        Returns:
        number of directories in the stack.
      • collectFiles

        @Deprecated
        protected void collectFiles​(org.eclipse.core.resources.IProject parent,
                                    List<org.eclipse.core.resources.IResource> result)
        Deprecated.
        This function used to populate member fFilesInProject which is not necessary anymore. Now ResourceLookup is used for search and not collection of files kept by ErrorParserManager.
        Parameters:
        parent - - project.
        result - - resulting collection of files.
      • processLine

        public boolean processLine​(String line)
        Parses one line of output and generates error or warning markers.
        Specified by:
        processLine in interface IConsoleParser
        Returns:
        true if line was successfully processed; skip other console parsers

        false - try other console parsers

        Since:
        5.4
      • getLineCounter

        public int getLineCounter()
        Returns:
        counter counting processed lines of output
        Since:
        5.2
      • findFileName

        public org.eclipse.core.resources.IFile findFileName​(String partialLoc)
        Returns the file with the given (partial) location if that file can be uniquely identified. Otherwise returns null.

        The passed in String 'partialLoc' is treated as a partial filesystem location for the resource. Resolution is attempted with the following precedence:
        If partialLoc is an absolute fs location:
        - Resolve it to an IFile in the Project
        - Resolve it to an IFile in the Workspace
        If partialLoc is a relative path:
        - Resolve it relative to the Current Working Directory
        - Resolve just the segments provided
        Parameters:
        partialLoc - - file name could be plain file name, absolute path or partial path
        Returns:
        - file in the workspace or null.
      • findFileInWorkspace

        protected org.eclipse.core.resources.IFile findFileInWorkspace​(org.eclipse.core.runtime.IPath path)
        Find exact match in the workspace. If path is not absolute search is done in working directory.
        Parameters:
        path - - file path.
        Returns:
        - file in the workspace or null if such a file doesn't exist
      • findFileInWorkspace

        protected org.eclipse.core.resources.IFile findFileInWorkspace​(URI uri)
        Find exact match in the workspace. If path is not absolute search is done in the current working directory.
        Parameters:
        uri - - absolute or relative URI to resolve.
        Returns:
        - file in the workspace or null if such a file doesn't exist
        Since:
        5.1
      • isConflictingName

        @Deprecated
        public boolean isConflictingName​(String fileName)
        Deprecated.
        Parameters:
        fileName - - file name.
        Returns:
        true if the project contains more than one file with the given name.
      • findFilePath

        @Deprecated
        public org.eclipse.core.resources.IFile findFilePath​(String filePath)
        Deprecated.
        Called by the error parsers to find an IFile for a given external filesystem 'location'
        Parameters:
        filePath - - file path.
        Returns:
        IFile representing the external location, or null if one couldn't be found.
      • generateMarker

        public void generateMarker​(org.eclipse.core.resources.IResource file,
                                   int lineNumber,
                                   String desc,
                                   int severity,
                                   String varName)
        Add marker to the list of error markers.
        Parameters:
        file - - resource to add the new marker.
        lineNumber - - line number of the error.
        desc - - description of the error.
        severity - - severity of the error.
        varName - - variable name.
      • addProblemMarker

        public void addProblemMarker​(ProblemMarkerInfo problemMarkerInfo)
        Add the given marker to the list of error markers.
        Parameters:
        problemMarkerInfo - - The marker to be added.
        Since:
        5.4
      • getPreviousLine

        public String getPreviousLine()
        Called by the error parsers.
        Returns:
        the previous line, save in the working buffer.
      • setOutputStream

        public void setOutputStream​(OutputStream os)
        Method setOutputStream. Note: you have to close this stream explicitly don't rely on ErrorParserManager.close().
        Parameters:
        os - - output stream
      • getOutputStream

        public OutputStream getOutputStream()
        Method getOutputStream. Note: you have to close this stream explicitly don't rely on ErrorParserManager.close().
        Returns:
        OutputStream
      • reportProblems

        @Deprecated
        public boolean reportProblems()
        Deprecated.
        as of 5.2. This method is no longer reporting problems. The problem markers are generated after processing each line.
        Returns:
        true if detected a problem indicating that build failed. The semantics of the return code is inconsistent. As far as build is concerned there is no difference between errors IMarkerGenerator.SEVERITY_ERROR_RESOURCE and IMarkerGenerator.SEVERITY_ERROR_BUILD
      • getScratchBuffer

        @Deprecated
        public String getScratchBuffer()
        Deprecated.
        Use IErrorParser2 interface to handle multiline messages rather than scratch buffer.
        Returns:
        scratch buffer.
      • appendToScratchBuffer

        @Deprecated
        public void appendToScratchBuffer​(String line)
        Deprecated.
        Use IErrorParser2 interface to handle multiline messages rather than scratch buffer.
        Parameters:
        line - - input line.
      • clearScratchBuffer

        @Deprecated
        public void clearScratchBuffer()
        Deprecated.
        Use IErrorParser2 interface to handle multiline messages rather than scratch buffer.
      • getUserDefinedErrorParserIds

        public static String[] getUserDefinedErrorParserIds()
        Returns:
        default error parsers IDs to be used if error parser list is empty.
        Since:
        5.3
      • setUserDefinedErrorParsers

        public static void setUserDefinedErrorParsers​(IErrorParserNamed[] errorParsers)
                                               throws org.eclipse.core.runtime.CoreException
        Set and store in workspace area user defined error parsers.
        Parameters:
        errorParsers - - array of user defined error parsers
        Throws:
        org.eclipse.core.runtime.CoreException - in case of problems
        Since:
        5.2
      • getErrorParserAvailableIds

        public static String[] getErrorParserAvailableIds()
        Returns:
        available error parsers IDs which include contributed through extension + user defined ones from workspace
        Since:
        5.2
      • getErrorParserAvailableIdsInContext

        public static String[] getErrorParserAvailableIdsInContext​(String context)
        Parameters:
        context - - indicates the context in which an error parser can be used.
        Returns:
        available error parsers ID, which include contributed through extension and user- defined ones from workspace, that can be used in the given context.
        Since:
        5.4
      • getErrorParserExtensionIds

        public static String[] getErrorParserExtensionIds()
        Returns:
        IDs of error parsers contributed through error parser extension point.
        Since:
        5.2
      • setDefaultErrorParserIds

        public static void setDefaultErrorParserIds​(String[] ids)
                                             throws org.osgi.service.prefs.BackingStoreException
        Set and store default error parsers IDs to be used if error parser list is empty.
        Parameters:
        ids - - default error parsers IDs
        Throws:
        org.osgi.service.prefs.BackingStoreException - in case of problem with storing
        Since:
        5.2
      • getDefaultErrorParserIds

        public static String[] getDefaultErrorParserIds()
        Returns:
        default error parsers IDs to be used if error parser list is empty.
        Since:
        5.2
      • getErrorParserCopy

        public static IErrorParserNamed getErrorParserCopy​(String id)
        Parameters:
        id - - ID of error parser
        Returns:
        cloned copy of error parser or null. Note that ErrorParserNamedWrapper returns shallow copy with the same instance of underlying error parser.
        Since:
        5.2
      • getErrorParserExtensionCopy

        public static IErrorParserNamed getErrorParserExtensionCopy​(String id)
        Parameters:
        id - - ID of error parser
        Returns:
        cloned copy of error parser as defined by its extension point or null.
        Since:
        5.3
      • toDelimitedString

        public static String toDelimitedString​(String[] ids)
        Parameters:
        ids - - array of error parser IDs
        Returns:
        error parser IDs delimited with error parser delimiter ";"
        Since:
        5.2
      • shutdown

        public void shutdown()
        Description copied from interface: IConsoleParser
        Called to let the parser know that the end of the error stream has been reached. Can be used by the parser to flush its internal buffers.
        Specified by:
        shutdown in interface IConsoleParser
        Since:
        5.4
      • getErrorCount

        public int getErrorCount()
        Since:
        6.5
      • getWarningCount

        public int getWarningCount()
        Since:
        6.5
      • deferDeDuplication

        public void deferDeDuplication()
        Flag the marker generator to defer the de-duplication of error markers until deDuplicate() is called
        Since:
        6.3
      • deDuplicate

        public void deDuplicate()
        De-duplicate error markers on resource that have had error markers added since deferDeDuplication() was called.
        Since:
        6.3