private void disableFormattingExclusively(int openingTagIndex, int closingTagIndex) { Token openingTag = this.ctm.get(openingTagIndex); int noFormatStart = openingTag.originalEnd + 1; int noFormatEnd = this.ctm.get(closingTagIndex - 1).originalEnd; if (noFormatStart <= noFormatEnd) { Token noFormatToken = new Token(noFormatStart, noFormatEnd, TokenNameCOMMENT_JAVADOC); int commentStart = findCommentLineIndent(openingTagIndex); List<Token> lines = commentToLines(noFormatToken, commentStart); List<Token> tokensToReplace = this.commentStructure.subList(openingTagIndex + 1, closingTagIndex); tokensToReplace.clear(); tokensToReplace.addAll(lines); } else { this.commentStructure.subList(openingTagIndex + 1, closingTagIndex).clear(); Token closingTag = this.ctm.get(closingTagIndex); if (this.ctm.countLineBreaksBetween(openingTag, closingTag) == 0) { openingTag.clearLineBreaksAfter(); closingTag.clearLineBreaksBefore(); } } }
private void disableFormattingExclusively(int openingTagIndex, int closingTagIndex) { Token openingTag = this.ctm.get(openingTagIndex); int noFormatStart = openingTag.originalEnd + 1; int noFormatEnd = this.ctm.get(closingTagIndex - 1).originalEnd; if (noFormatStart <= noFormatEnd) { Token noFormatToken = new Token(noFormatStart, noFormatEnd, TokenNameCOMMENT_JAVADOC); int commentStart = findCommentLineIndent(openingTagIndex); List<Token> lines = commentToLines(noFormatToken, commentStart); List<Token> tokensToReplace = this.commentStructure.subList(openingTagIndex + 1, closingTagIndex); tokensToReplace.clear(); tokensToReplace.addAll(lines); } else { this.commentStructure.subList(openingTagIndex + 1, closingTagIndex).clear(); Token closingTag = this.ctm.get(closingTagIndex); if (this.ctm.countLineBreaksBetween(openingTag, closingTag) == 0) { openingTag.clearLineBreaksAfter(); closingTag.clearLineBreaksBefore(); } } }
private void disableFormattingExclusively(int openingTagIndex, int closingTagIndex) { Token openingTag = this.ctm.get(openingTagIndex); int noFormatStart = openingTag.originalEnd + 1; int noFormatEnd = this.ctm.get(closingTagIndex - 1).originalEnd; if (noFormatStart <= noFormatEnd) { Token noFormatToken = new Token(noFormatStart, noFormatEnd, TokenNameCOMMENT_JAVADOC); int commentStart = findCommentLineIndent(openingTagIndex); List<Token> lines = commentToLines(noFormatToken, commentStart); List<Token> tokensToReplace = this.commentStructure.subList(openingTagIndex + 1, closingTagIndex); tokensToReplace.clear(); tokensToReplace.addAll(lines); } else { this.commentStructure.subList(openingTagIndex + 1, closingTagIndex).clear(); Token closingTag = this.ctm.get(closingTagIndex); if (this.ctm.countLineBreaksBetween(openingTag, closingTag) == 0) { openingTag.clearLineBreaksAfter(); closingTag.clearLineBreaksBefore(); } } }
private void disableFormatting(int startIndex, int endIndex) { Token startToken = this.ctm.get(startIndex), endToken = this.ctm.get(endIndex); Token noFormatToken = new Token(startToken.originalStart, endToken.originalEnd, TokenNameCOMMENT_JAVADOC); List<Token> tokensToReplace = this.commentStructure.subList(startIndex, endIndex + 1); if (this.ctm.countLineBreaksBetween(startToken, endToken) == 0) { tokensToReplace.clear(); tokensToReplace.add(noFormatToken); } else { int commentStart = findCommentLineIndent(startIndex); tokensToReplace.clear(); tokensToReplace.addAll(commentToLines(noFormatToken, commentStart)); } Token first = tokensToReplace.get(0), last = tokensToReplace.get(tokensToReplace.size() - 1); if (startToken.isSpaceBefore()) first.spaceBefore(); first.putLineBreaksBefore(startToken.getLineBreaksBefore()); first.setWrapPolicy(startToken.getWrapPolicy()); if (endToken.isSpaceAfter()) last.spaceAfter(); last.putLineBreaksAfter(endToken.getLineBreaksAfter()); for (Token token : tokensToReplace) if (token.tokenType == TokenNameCOMMENT_JAVADOC) token.setIndent(startToken.getIndent()); }
private void disableFormatting(int startIndex, int endIndex) { Token startToken = this.ctm.get(startIndex), endToken = this.ctm.get(endIndex); Token noFormatToken = new Token(startToken.originalStart, endToken.originalEnd, TokenNameCOMMENT_JAVADOC); List<Token> tokensToReplace = this.commentStructure.subList(startIndex, endIndex + 1); if (this.ctm.countLineBreaksBetween(startToken, endToken) == 0) { tokensToReplace.clear(); tokensToReplace.add(noFormatToken); } else { int commentStart = findCommentLineIndent(startIndex); tokensToReplace.clear(); tokensToReplace.addAll(commentToLines(noFormatToken, commentStart)); } Token first = tokensToReplace.get(0), last = tokensToReplace.get(tokensToReplace.size() - 1); if (startToken.isSpaceBefore()) first.spaceBefore(); first.putLineBreaksBefore(startToken.getLineBreaksBefore()); first.setWrapPolicy(startToken.getWrapPolicy()); if (endToken.isSpaceAfter()) last.spaceAfter(); last.putLineBreaksAfter(endToken.getLineBreaksAfter()); for (Token token : tokensToReplace) if (token.tokenType == TokenNameCOMMENT_JAVADOC) token.setIndent(startToken.getIndent()); }
private void disableFormatting(int startIndex, int endIndex) { Token startToken = this.ctm.get(startIndex), endToken = this.ctm.get(endIndex); Token noFormatToken = new Token(startToken.originalStart, endToken.originalEnd, TokenNameCOMMENT_JAVADOC); List<Token> tokensToReplace = this.commentStructure.subList(startIndex, endIndex + 1); if (this.ctm.countLineBreaksBetween(startToken, endToken) == 0) { tokensToReplace.clear(); tokensToReplace.add(noFormatToken); } else { int commentStart = findCommentLineIndent(startIndex); tokensToReplace.clear(); tokensToReplace.addAll(commentToLines(noFormatToken, commentStart)); } Token first = tokensToReplace.get(0), last = tokensToReplace.get(tokensToReplace.size() - 1); if (startToken.isSpaceBefore()) first.spaceBefore(); first.putLineBreaksBefore(startToken.getLineBreaksBefore()); first.setWrapPolicy(startToken.getWrapPolicy()); if (endToken.isSpaceAfter()) last.spaceAfter(); last.putLineBreaksAfter(endToken.getLineBreaksAfter()); for (Token token : tokensToReplace) if (token.tokenType == TokenNameCOMMENT_JAVADOC) token.setIndent(startToken.getIndent()); }