コード例 #1
0
 @NotNull
 /*package*/ static JetModifierListOwner addModifier(
     @NotNull PsiElement element,
     @NotNull JetKeywordToken modifier,
     @Nullable JetToken[] modifiersThatCanBeReplaced,
     @NotNull Project project,
     boolean toBeginning) {
   JetModifierListOwner newElement = (JetModifierListOwner) (element.copy());
   changeModifier(
       newElement,
       newElement.getModifierList(),
       newElement.getFirstChild(),
       modifiersThatCanBeReplaced,
       project,
       toBeginning,
       JetPsiFactory.createModifierList(project, modifier));
   return newElement;
 }
コード例 #2
0
 @NotNull
 /*package*/ static String getElementName(@NotNull JetModifierListOwner modifierListOwner) {
   String name = null;
   if (modifierListOwner instanceof PsiNameIdentifierOwner) {
     PsiElement nameIdentifier = ((PsiNameIdentifierOwner) modifierListOwner).getNameIdentifier();
     if (nameIdentifier != null) {
       name = nameIdentifier.getText();
     }
   } else if (modifierListOwner instanceof JetPropertyAccessor) {
     name = ((JetPropertyAccessor) modifierListOwner).getNamePlaceholder().getText();
   }
   if (name == null) {
     name = modifierListOwner.getText();
   }
   return "'" + name + "'";
 }