コード例 #1
0
 @Override
 public void invoke(@NotNull Project project, Editor editor, @NotNull KtFile file)
     throws IncorrectOperationException {
   KtPsiFactory factory = new KtPsiFactory(annotationClass.getProject());
   KtModifierList list = annotationClass.getModifierList();
   PsiElement added;
   if (list == null) {
     KtModifierList newModifierList = factory.createModifierList(KtTokens.ANNOTATION_KEYWORD);
     added =
         annotationClass.addBefore(newModifierList, annotationClass.getClassOrInterfaceKeyword());
   } else {
     PsiElement entry = factory.createModifier(KtTokens.ANNOTATION_KEYWORD);
     added = list.addBefore(entry, list.getFirstChild());
   }
   annotationClass.addAfter(factory.createWhiteSpace(), added);
 }
コード例 #2
0
 @NotNull
 @Override
 public String getText() {
   return KotlinBundle.message("make.class.annotation.class", annotationClass.getName());
 }