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; }
@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; }
/** {@inheritDoc} */ @Override public void endVisit(BlockComment node) { logger.warn("Method endVisitBlockComment for " + node + " for " + node + " not implemented!"); super.endVisit(node); }
/** {@inheritDoc} */ @Override public boolean visit(BlockComment node) { logger.warn("Method visitBlockComment for " + node + " for " + node + " not implemented!"); return super.visit(node); }
@Override public boolean visit(final BlockComment node) { return false; }
@Override public boolean visit(final BlockComment node) { // not instrumentable, contains no instrumentable nodes return false; }
@Override public boolean visit(BlockComment node) { if (node.subtreeMatch(fMatcher, fNodeToMatch)) return matches(node); return super.visit(node); }
@Override public void endVisit(BlockComment node) { endVisitNode(node); }
@Override public boolean visit(BlockComment node) { return visitNode(node); }
@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); } } }
@Override public boolean visit(BlockComment node) { return visit((Comment)node); }
@Override public void endVisit(BlockComment node) { endVisit((Comment)node); }
@Override public boolean visit(BlockComment node) { this.fBuffer.append("/* */");//$NON-NLS-1$ return false; }
public boolean visit(BlockComment node) { printIndent(); this.buffer.append("/* */");//$NON-NLS-1$ return false; }
@Override public boolean visit(final BlockComment node) { return this.internalVisit(node); }