本文整理匯總了Java中com.intellij.javadoc.JavadocNavigationDelegate類的典型用法代碼示例。如果您正苦於以下問題:Java JavadocNavigationDelegate類的具體用法?Java JavadocNavigationDelegate怎麽用?Java JavadocNavigationDelegate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JavadocNavigationDelegate類屬於com.intellij.javadoc包,在下文中一共展示了JavadocNavigationDelegate類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: locateCaret
import com.intellij.javadoc.JavadocNavigationDelegate; //導入依賴的package包/類
private static void locateCaret(@NotNull PsiDocComment comment, @NotNull Editor editor, @NotNull PsiFile file) {
Document document = editor.getDocument();
int lineToNavigate = -1;
for (PsiDocTag tag : comment.getTags()) {
PsiElement nameElement = tag.getNameElement();
if (nameElement == null || !CARET_ANCHOR_TAGS.contains(nameElement.getText())) {
continue;
}
boolean good = false;
PsiElement[] dataElements = tag.getDataElements();
if (dataElements != null) {
PsiDocTagValue valueElement = tag.getValueElement();
for (PsiElement element : dataElements) {
if (element == valueElement) {
continue;
}
if (!StringUtil.isEmptyOrSpaces(element.getText())) {
good = true;
break;
}
}
}
if (!good) {
int offset = tag.getTextRange().getEndOffset();
CharSequence text = document.getCharsSequence();
int i = CharArrayUtil.shiftBackward(text, offset - 1, " \t*");
if (i > 0 && text.charAt(i) == '\n') {
offset = i - 1;
}
lineToNavigate = document.getLineNumber(offset);
break;
}
}
if (lineToNavigate >= 0) {
editor.getCaretModel().moveToOffset(document.getLineEndOffset(lineToNavigate));
JavadocNavigationDelegate.navigateToLineEnd(editor, file);
}
}
示例2: locateCaret
import com.intellij.javadoc.JavadocNavigationDelegate; //導入依賴的package包/類
private static void locateCaret(@NotNull PsiDocComment comment, @NotNull Editor editor, @NotNull PsiFile file)
{
Document document = editor.getDocument();
int lineToNavigate = -1;
for(PsiDocTag tag : comment.getTags())
{
PsiElement nameElement = tag.getNameElement();
if(nameElement == null || !CARET_ANCHOR_TAGS.contains(nameElement.getText()))
{
continue;
}
boolean good = false;
PsiElement[] dataElements = tag.getDataElements();
if(dataElements != null)
{
PsiDocTagValue valueElement = tag.getValueElement();
for(PsiElement element : dataElements)
{
if(element == valueElement)
{
continue;
}
if(!StringUtil.isEmptyOrSpaces(element.getText()))
{
good = true;
break;
}
}
}
if(!good)
{
int offset = tag.getTextRange().getEndOffset();
CharSequence text = document.getCharsSequence();
int i = CharArrayUtil.shiftBackward(text, offset - 1, " \t*");
if(i > 0 && text.charAt(i) == '\n')
{
offset = i - 1;
}
lineToNavigate = document.getLineNumber(offset);
break;
}
}
if(lineToNavigate >= 0)
{
editor.getCaretModel().moveToOffset(document.getLineEndOffset(lineToNavigate));
JavadocNavigationDelegate.navigateToLineEnd(editor, file);
}
}