use of com.intellij.psi.javadoc.PsiDocComment in project intellij-community by JetBrains.
the class EndOfLineCommentPredicate method satisfiedBy.
@Override
public boolean satisfiedBy(PsiElement element) {
if (!(element instanceof PsiComment)) {
return false;
}
if (element instanceof PsiDocComment) {
return false;
}
final PsiComment comment = (PsiComment) element;
final IElementType type = comment.getTokenType();
return GroovyTokenTypes.mSL_COMMENT.equals(type);
}
use of com.intellij.psi.javadoc.PsiDocComment in project intellij-community by JetBrains.
the class GroovyMoveClassToInnerHandler method moveClass.
@Override
public PsiClass moveClass(@NotNull PsiClass aClass, @NotNull PsiClass targetClass) {
if (!(aClass instanceof GrTypeDefinition))
return null;
GroovyChangeContextUtil.encodeContextInfo(aClass);
PsiDocComment doc = aClass.getDocComment();
PsiElement brace = targetClass.getRBrace();
PsiClass newClass = (PsiClass) targetClass.addBefore(aClass, brace);
PsiElement sibling = newClass.getPrevSibling();
GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(targetClass.getProject());
if (!org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil.isNewLine(sibling)) {
targetClass.addBefore(factory.createLineTerminator("\n "), newClass);
} else if (doc != null) {
LOG.assertTrue(sibling != null);
sibling.replace(factory.createLineTerminator(sibling.getText() + " "));
}
if (doc != null) {
targetClass.addBefore(doc, newClass);
targetClass.addBefore(factory.createLineTerminator("\n"), newClass);
}
if (targetClass.isInterface()) {
PsiUtil.setModifierProperty(newClass, PsiModifier.PUBLIC, true);
} else {
PsiUtil.setModifierProperty(newClass, PsiModifier.STATIC, true);
}
GroovyChangeContextUtil.decodeContextInfo(newClass, null, null);
return newClass;
}
use of com.intellij.psi.javadoc.PsiDocComment in project intellij-community by JetBrains.
the class GenerationUtil method writeDocComment.
static void writeDocComment(StringBuilder buffer, PsiMember member, boolean addLineFeed) {
if (member instanceof PsiDocCommentOwner) {
final PsiDocComment comment = ((PsiDocCommentOwner) member).getDocComment();
if (comment != null) {
final String text = comment.getText();
buffer.append(text);
if (addLineFeed)
buffer.append('\n');
}
}
}
use of com.intellij.psi.javadoc.PsiDocComment in project android by JetBrains.
the class InferSupportAnnotations method isHidden.
private static boolean isHidden(@NotNull PsiDocCommentOwner owner) {
if (FILTER_HIDDEN) {
while (owner != null) {
PsiDocComment docComment = owner.getDocComment();
if (docComment != null) {
// We cna't just look for a PsiDocTag with name "hide" from docComment.getTags()
// because that method only works for "@hide", not "{@hide}" which is used in a bunch
// of places; we'd need to search for PsiInlineDocTags too
String text = docComment.getText();
return text.contains("@hide");
}
owner = PsiTreeUtil.getParentOfType(owner, PsiDocCommentOwner.class, true);
}
}
return false;
}
Aggregations