Examples of FileAnalyzer


Examples of org.opensolaris.opengrok.analysis.FileAnalyzer

     * @param file The file to add
     * @param path The path to the file (from source root)
     * @throws java.io.IOException if an error occurs
     */
    private void addFile(File file, String path) throws IOException {
        FileAnalyzer fa;
        try (InputStream in = new BufferedInputStream(new FileInputStream(file))) {
            fa = AnalyzerGuru.getAnalyzer(in, path);
        }

        for (IndexChangedListener listener : listeners) {
            listener.fileAdd(path, fa.getClass().getSimpleName());
        }
        fa.setCtags(ctags);
        fa.setProject(Project.getProject(path));

        Document doc = new Document();
        try (Writer xrefOut = getXrefWriter(fa, path)) {
            analyzerGuru.populateDocument(doc, file, path, fa, xrefOut);
        } catch (Exception e) {
            log.log(Level.INFO,
                    "Skipped file ''{0}'' because the analyzer didn''t "
                    + "understand it.",
                    path);
            log.log(Level.FINE,
                    "Exception from analyzer " + fa.getClass().getName(), e);
            cleanupResources(doc);
            return;
        }

        try {
            writer.addDocument(doc, fa);
        } catch (Throwable t) {
            cleanupResources(doc);
            throw t;
        }

        setDirty();
        for (IndexChangedListener listener : listeners) {
            listener.fileAdded(path, fa.getClass().getSimpleName());
        }
    }
View Full Code Here

Examples of org.opensolaris.opengrok.analysis.FileAnalyzer

    }

    @Override
    protected FileAnalyzer newAnalyzer() {
        // just use a FileAnalyzer since it won't analyze or xref the file
        return new FileAnalyzer(this);
    }
View Full Code Here

Examples of org.opensolaris.opengrok.analysis.FileAnalyzer

    }

    @Override
    protected FileAnalyzer newAnalyzer() {
        // just use a FileAnalyzer since it won't analyze or xref the file
        return new FileAnalyzer(this);
    }
View Full Code Here

Examples of org.watermint.sourcecolon.org.opensolaris.opengrok.analysis.FileAnalyzer

    }

    @Override
    protected FileAnalyzer newAnalyzer() {
        // just use a FileAnalyzer since it won't analyze or xref the file
        return new FileAnalyzer(this);
    }
View Full Code Here

Examples of org.watermint.sourcecolon.org.opensolaris.opengrok.analysis.FileAnalyzer

    }

    @Override
    protected FileAnalyzer newAnalyzer() {
        // just use a FileAnalyzer since it won't analyze or xref the file
        return new FileAnalyzer(this);
    }
View Full Code Here

Examples of org.watermint.sourcecolon.org.opensolaris.opengrok.analysis.FileAnalyzer

     * @param path The path to the file (from source root)
     * @throws java.io.IOException if an error occurs
     */
    private void addFile(File file, String path) throws IOException {
        try (InputStream in = new BufferedInputStream(new FileInputStream(file))) {
            FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, path);
            for (IndexChangedListener listener : listeners) {
                listener.fileAdd(path, fa.getClass().getSimpleName());
            }
            fa.setCtags(ctags);
            fa.setProject(Project.getProject(path));

            Document d;
            try {
                d = analyzerGuru.getDocument(file, in, path, fa);
            } catch (Exception e) {
                log.log(Level.INFO, "Skipped file ''{0}'' because the analyzer didn''t " + "understand it.", path);
                log.log(Level.FINE, "Exception from analyzer:", e);
                return;
            }

            writer.addDocument(d, fa);
            Genre g = fa.getFactory().getGenre();
            if (xrefDir != null && (g == Genre.PLAIN || g == Genre.XREFABLE)) {
                File xrefFile = new File(xrefDir, path);
                // If mkdirs() returns false, the failure is most likely
                // because the file already exists. But to check for the
                // file first and only add it if it doesn't exists would
                // only increase the file IO...
                if (!xrefFile.getParentFile().mkdirs()) {
                    assert xrefFile.getParentFile().exists();
                }
                fa.writeXref(xrefDir, path);
            }
            for (IndexChangedListener listener : listeners) {
                listener.fileAdded(path, fa.getClass().getSimpleName());
            }
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.