Java 类org.eclipse.jdt.core.dom.BlockComment 实例源码

项目:clocom    文件:CommentVisitor.java   
public boolean visit(BlockComment node) {
    int startLineNumber = compilationUnit.getLineNumber(node.getStartPosition());
    int endLineNumber = compilationUnit.getLineNumber(node.getStartPosition() + node.getLength());

    //System.out.println("dd "  + startLineNumber + " " + endLineNumber);
    //System.out.println("ee "  + startLine + " " + endLine + "\n");

    if ((startLineNumber >= startLine && endLineNumber <= endLine) || 
            startLine - 1 == endLineNumber) {
        // Build the comment char by char
        StringBuilder comment = new StringBuilder();
        for (int i = node.getStartPosition(); i < node.getStartPosition() + node.getLength(); i++) {
            comment.append(source[i]);
        }

        if (comment.capacity() > 0) {
            String str = comment.toString().replaceAll("\\n\\s+", "\n ");

            if (str != null) {
                CommentMap cMap = new CommentMap(str, startLineNumber, endLineNumber, 2);
                cMapList.add(cMap);
            }
        }
    }
    return true;
}
项目:j2d    文件:J2dVisitor.java   
@Override
public boolean visit(BlockComment node) {
    //System.out.println("Found: " + node.getClass());
    //println("");
    //println(node.getStartPosition() + " " + node.getLength());
    String comment = new String(Arrays.copyOfRange(sourceCode,
                                        node.getStartPosition(),
                                        node.getStartPosition() + node.getLength()));
    print(comment);
    return false;
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public void endVisit(BlockComment node) {
    logger.warn("Method endVisitBlockComment for " + node + " for " + node + " not implemented!");
    super.endVisit(node);
}
项目:evosuite    文件:LoggingVisitor.java   
/** {@inheritDoc} */
@Override
public boolean visit(BlockComment node) {
    logger.warn("Method visitBlockComment for " + node + " for " + node + " not implemented!");
    return super.visit(node);
}
项目:Beagle    文件:NotRecursingAstVisitor.java   
@Override
public boolean visit(final BlockComment node) {
    return false;
}
项目:Beagle    文件:InstrumentableAstNodeLister.java   
@Override
public boolean visit(final BlockComment node) {
    // not instrumentable, contains no instrumentable nodes
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(BlockComment node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public void endVisit(BlockComment node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion    文件:GenericVisitor.java   
@Override
public boolean visit(BlockComment node) {
    return visitNode(node);
}
项目:codemodify    文件:NonJavaDocRemover.java   
@Override
public void modifyCompilationUnit(CompilationUnit astRoot,
        IProgressMonitor monitor) throws JavaModelException, CoreException,
        BadLocationException {
    final ICompilationUnit adapter = (ICompilationUnit) astRoot
            .getJavaElement().getAdapter(IOpenable.class);
    modifiedDocument = false;
    if (adapter != null) {
        document = new Document(adapter.getSource());
        List<Comment> commentList = astRoot.getCommentList();
        offset = 0;
        for (Comment comment : commentList) {
            comment.accept(new ASTVisitor() {
                @Override
                public boolean visit(BlockComment node) {
                    int startPosition = node.getStartPosition();
                    int endPosition = startPosition + node.getLength();

                    try {
                        int lineOfOffset = document
                                .getLineOfOffset(startPosition - offset);
                        startPosition = document
                                .getLineOffset(lineOfOffset);
                        int replaceLength = endPosition - startPosition
                                + LINE_DELIMITER_LENGTH - offset;
                        if (startPosition > -1
                                && document
                                .get()
                                        .substring(
                                                startPosition,
                                                startPosition
                                                        + replaceLength)
                                .contains(NON_JAVADOC_COMMENT)) {
                            int replaceStart = startPosition
                                    - LINE_DELIMITER_LENGTH;
                            document.replace(replaceStart, replaceLength,
                                    EMPTY_STRING);
                            offset = endPosition - startPosition
                                    + LINE_DELIMITER_LENGTH;
                            modifiedDocument = true;
                        }
                    } catch (BadLocationException e) {
                        e.printStackTrace();
                    }

                    return super.visit(node);
                }
            });
        }
        if (modifiedDocument) {
            adapter.getBuffer().setContents(document.get());
            adapter.save(monitor, true);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AstMatchingNodeFinder.java   
@Override
public boolean visit(BlockComment node) {
    if (node.subtreeMatch(fMatcher, fNodeToMatch))
        return matches(node);
    return super.visit(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public boolean visit(BlockComment node) {
    return visit((Comment)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:HierarchicalASTVisitor.java   
@Override
public void endVisit(BlockComment node) {
    endVisit((Comment)node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ASTFlattener.java   
@Override
public boolean visit(BlockComment node) {
    this.fBuffer.append("/* */");//$NON-NLS-1$
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public boolean visit(BlockComment node) {
    return visitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenericVisitor.java   
@Override
public void endVisit(BlockComment node) {
    endVisitNode(node);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NaiveASTFlattener.java   
public boolean visit(BlockComment node) {
    printIndent();
    this.buffer.append("/* */");//$NON-NLS-1$
    return false;
}
项目:eclipse-i18ntools    文件:ASTNodeFinder.java   
@Override
public boolean visit(final BlockComment node) {
    return this.internalVisit(node);
}