本文整理匯總了Java中com.intellij.psi.PsiComment.getTextRange方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiComment.getTextRange方法的具體用法?Java PsiComment.getTextRange怎麽用?Java PsiComment.getTextRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiComment
的用法示例。
在下文中一共展示了PsiComment.getTextRange方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processComment
import com.intellij.psi.PsiComment; //導入方法依賴的package包/類
/**
* Check if comment can be recognized as section start/end
* @return true for section comment, false otherwise
*/
public boolean processComment(@NotNull PsiComment comment) {
final TextRange range = comment.getTextRange();
final TextRange expandedRange = myDocument == null ? range : ArrangementUtil.expandToLineIfPossible(range, myDocument);
final TextRange sectionTextRange = new TextRange(expandedRange.getStartOffset(), expandedRange.getEndOffset());
final String commentText = comment.getText().trim();
final ArrangementSectionRule openSectionRule = isSectionStartComment(mySettings, commentText);
if (openSectionRule != null) {
mySectionEntryProducer.consume(new ArrangementSectionEntryTemplate(comment, START_SECTION, sectionTextRange, commentText));
myOpenedSections.push(openSectionRule);
return true;
}
if (!myOpenedSections.isEmpty()) {
final ArrangementSectionRule lastSection = myOpenedSections.peek();
if (lastSection.getEndComment() != null && StringUtil.equals(commentText, lastSection.getEndComment())) {
mySectionEntryProducer.consume(new ArrangementSectionEntryTemplate(comment, END_SECTION, sectionTextRange, commentText));
myOpenedSections.pop();
return true;
}
}
return false;
}