Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.SourceLineAnnotation


        int lineNbr = findChildSourceLine(type, innerName, bug);
        // should be always first line, if not found
        lineNbr = lineNbr <= 0 ? 1 : lineNbr;
        String sourceFileStr = getSourceFileHint(type, qualifiedClassName);
        if (sourceFileStr != null && sourceFileStr.length() > 0) {
            bug.addSourceLine(new SourceLineAnnotation(qualifiedClassName, sourceFileStr, lineNbr, lineNbr, 0, 0));
        }
    }
View Full Code Here


            if (index >= 0) {
                BugAnnotation theAnnotation = bug.getAnnotationsForMessage(false).get(index);
                findLocation: try {

                    if (theAnnotation instanceof SourceLineAnnotation) {
                        SourceLineAnnotation sla = (SourceLineAnnotation) theAnnotation;
                        int line = sla.getStartLine();
                        EditorUtil.goToLine(activeEditor, line);
                        return;

                    } else if (theAnnotation instanceof MethodAnnotation) {
                        MethodAnnotation ma = (MethodAnnotation) theAnnotation;
                        String className = ma.getClassName();
                        IJavaProject project = getIProject();
                        IType type = project.findType(className);
                        if (type == null) {
                            break findLocation;
                        }
                        IMethod m = getIMethod(type, ma);
                        if (m != null) {
                            JavaUI.openInEditor(m, true, true);

                        } else {
                            activeEditor = JavaUI.openInEditor(type, true, true);
                            SourceLineAnnotation sla = ma.getSourceLines();
                            EditorUtil.goToLine(activeEditor, sla.getStartLine());
                        }

                        return;

                    } else if (theAnnotation instanceof FieldAnnotation) {
                        FieldAnnotation fa = (FieldAnnotation) theAnnotation;
                        String className = fa.getClassName();
                        IJavaProject project = getIProject();
                        IType type = project.findType(className);
                        if (type == null) {
                            break findLocation;
                        }

                        IField f = type.getField(fa.getFieldName());
                        if (f != null) {
                            JavaUI.openInEditor(f, true, true);
                        } else {
                            activeEditor = JavaUI.openInEditor(type, true, true);
                            SourceLineAnnotation sla = fa.getSourceLines();
                            EditorUtil.goToLine(activeEditor, sla.getStartLine());
                        }
                        return;
                    } else if (theAnnotation instanceof TypeAnnotation) {
                        TypeAnnotation fa = (TypeAnnotation) theAnnotation;
                        String className = ClassName.fromFieldSignature(fa.getTypeDescriptor());
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.SourceLineAnnotation

Copyright © 2018 www.massapicom. 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.