Java Code Examples for com.intellij.util.IncorrectOperationException

The following examples show how to use com.intellij.util.IncorrectOperationException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {

    PsiElement psiElement = descriptor.getPsiElement();
    if (DumbService.isDumb(project)) {
        showIsInDumpModeMessage(project, psiElement);
        return;
    }

    if (psiElement instanceof ClassReference) {
        ClassReference classReference = (ClassReference) psiElement;
        String fqn = classReference.getFQN();
        if (fqn != null) {
            String replacementFQN = LegacyClassesForIDEIndex.findReplacementClass(project, fqn);
            if (replacementFQN != null) {
                try {
                    classReference.replace(PhpPsiElementFactory.createClassReference(project, replacementFQN));
                } catch (IncorrectOperationException e) {
                    showErrorMessage(project, "Could not replace class reference", psiElement);
                }
            }
        }
    }
}
 
Example 2
Source Project: intellij-csv-validator   Source File: CsvIntentionHelper.java    License: Apache License 2.0 6 votes vote down vote up
public static void quoteValue(@NotNull Project project, @NotNull final PsiElement element) {
    try {
        Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
        List<Integer> quotePositions = new ArrayList<>();

        int quotePosition = getOpeningQuotePosition(element.getFirstChild(), element.getLastChild());
        if (quotePosition != -1) {
            quotePositions.add(quotePosition);
        }
        PsiElement endSeparatorElement = findQuotePositionsUntilSeparator(element, quotePositions);
        if (endSeparatorElement == null) {
            quotePositions.add(document.getTextLength());
        } else {
            quotePositions.add(endSeparatorElement.getTextOffset());
        }
        String text = addQuotes(document.getText(), quotePositions);
        document.setText(text);
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 3
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    try {
        PsiElement element = descriptor.getPsiElement();
        Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
        List<Integer> quotePositions = new ArrayList<>();

        int quotePosition = CsvIntentionHelper.getOpeningQuotePosition(element);
        if (quotePosition != -1) {
            quotePositions.add(quotePosition);
        }
        PsiElement endSeparatorElement = CsvIntentionHelper.findQuotePositionsUntilSeparator(element, quotePositions, true);
        if (endSeparatorElement == null) {
            quotePositions.add(document.getTextLength());
        } else {
            quotePositions.add(endSeparatorElement.getTextOffset());
        }
        String text = CsvIntentionHelper.addQuotes(document.getText(), quotePositions);
        document.setText(text);
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 4
Source Project: intellij-csv-validator   Source File: CsvIntentionHelper.java    License: Apache License 2.0 6 votes vote down vote up
public static void unquoteValue(@NotNull Project project, @NotNull final PsiElement element) {
    try {
        Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
        List<Integer> quotePositions = new ArrayList<>();

        if (CsvHelper.getElementType(element.getFirstChild()) == CsvTypes.QUOTE) {
            quotePositions.add(element.getFirstChild().getTextOffset());
        }
        if (CsvHelper.getElementType(element.getLastChild()) == CsvTypes.QUOTE) {
            quotePositions.add(element.getLastChild().getTextOffset());
        }
        String text = removeQuotes(document.getText(), quotePositions);
        document.setText(text);
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 5
Source Project: spring-javaformat   Source File: SpringReformatter.java    License: Apache License 2.0 6 votes vote down vote up
private void throwNotWritableException(PsiElement element) throws IncorrectOperationException {
	if (element instanceof PsiDirectory) {
		String url = ((PsiDirectory) element).getVirtualFile().getPresentableUrl();
		throw new IncorrectOperationException(PsiBundle.message("cannot.modify.a.read.only.directory", url));
	}
	PsiFile file = element.getContainingFile();
	if (file == null) {
		throw new IncorrectOperationException();
	}
	VirtualFile virtualFile = file.getVirtualFile();
	if (virtualFile == null) {
		throw new IncorrectOperationException();
	}
	throw new IncorrectOperationException(
			PsiBundle.message("cannot.modify.a.read.only.file", virtualFile.getPresentableUrl()));
}
 
Example 6
Source Project: litho   Source File: SpecLookupElement.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param qualifiedName the name of the class to create lookup
 * @param project to find the lookup annotation class
 * @param insertHandler adds custom actions to the insert handling
 * @throws IncorrectOperationException if the qualifiedName does not specify a valid type
 * @return new {@link LookupElement} or cached instance if it was created previously
 */
static LookupElement create(
    String qualifiedName, Project project, InsertHandler<LookupElement> insertHandler)
    throws IncorrectOperationException {
  if (CACHE.containsKey(qualifiedName)) {
    return CACHE.get(qualifiedName);
  }
  PsiClass typeCls = PsiSearchUtils.findClass(project, qualifiedName);
  if (typeCls != null) {
    SpecLookupElement lookupElement = new SpecLookupElement(typeCls, insertHandler);
    CACHE.put(qualifiedName, lookupElement);
    return lookupElement;
  }
  // This is a dummy class, we don't want to cache it.
  typeCls =
      JavaPsiFacade.getInstance(project)
          .getElementFactory()
          .createClass(LithoClassNames.shortName(qualifiedName));
  return new SpecLookupElement(typeCls, insertHandler);
}
 
Example 7
Source Project: intellij-spring-assistant   Source File: PsiCustomUtil.java    License: MIT License 6 votes vote down vote up
@Nullable
public static PsiType safeGetValidType(@NotNull Module module, @NotNull String fqn) {
  try {
    // Intellij expects inner classes to be referred via `.` instead of `$`
    PsiType type = JavaPsiFacade.getInstance(module.getProject()).getParserFacade()
        .createTypeFromText(fqn.replaceAll("\\$", "."), null);
    boolean typeValid = isValidType(type);
    if (typeValid) {
      if (type instanceof PsiClassType) {
        return PsiClassType.class.cast(type);
      } else if (type instanceof PsiArrayType) {
        return PsiArrayType.class.cast(type);
      }
    }
    return null;
  } catch (IncorrectOperationException e) {
    debug(() -> log.debug("Unable to find class fqn " + fqn));
    return null;
  }
}
 
Example 8
Source Project: reasonml-idea-plugin   Source File: PsiUpperSymbolImpl.java    License: MIT License 6 votes vote down vote up
@NotNull
@Override
public PsiElement setName(@NotNull String newName) throws IncorrectOperationException {
    PsiElement newNameIdentifier = ORCodeFactory.createModuleName(getProject(), newName);

    ASTNode newNameNode = newNameIdentifier == null ? null : newNameIdentifier.getFirstChild().getNode();
    if (newNameNode != null) {
        PsiElement nameIdentifier = getFirstChild();
        if (nameIdentifier == null) {
            getNode().addChild(newNameNode);
        } else {
            ASTNode oldNameNode = nameIdentifier.getNode();
            getNode().replaceChild(oldNameNode, newNameNode);
        }
    }

    return this;
}
 
Example 9
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement)
        throws IncorrectOperationException {
    CsvFile csvFile = (CsvFile) psiElement.getContainingFile();

    PsiElement element = CsvHelper.getParentFieldElement(psiElement);

    CsvColumnInfoMap<PsiElement> columnInfoMap = csvFile.getColumnInfoMap();
    CsvColumnInfo<PsiElement> leftColumnInfo = columnInfoMap.getColumnInfo(element);

    // column must be at least index 1 to be shifted left
    if (leftColumnInfo == null || leftColumnInfo.getColumnIndex() + 1 >= columnInfoMap.getColumnInfos().size()) {
        return;
    }

    CsvColumnInfo<PsiElement> rightColumnInfo = columnInfoMap.getColumnInfo(leftColumnInfo.getColumnIndex() + 1);

    changeLeftAndRightColumnOrder(project, csvFile, leftColumnInfo, rightColumnInfo);
}
 
Example 10
Source Project: reasonml-idea-plugin   Source File: PsiUpperSymbolReference.java    License: MIT License 6 votes vote down vote up
@Override
public PsiElement handleElementRename(@NotNull String newName) throws IncorrectOperationException {
    PsiElement newNameIdentifier = ORCodeFactory.createModuleName(myElement.getProject(), newName);

    ASTNode newNameNode = newNameIdentifier == null ? null : newNameIdentifier.getFirstChild().getNode();
    if (newNameNode != null) {
        PsiElement nameIdentifier = myElement.getFirstChild();
        if (nameIdentifier == null) {
            myElement.getNode().addChild(newNameNode);
        } else {
            ASTNode oldNameNode = nameIdentifier.getNode();
            myElement.getNode().replaceChild(oldNameNode, newNameNode);
        }
    }

    return myElement;
}
 
Example 11
Source Project: reasonml-idea-plugin   Source File: PsiLowerSymbolReference.java    License: MIT License 6 votes vote down vote up
@Override
public PsiElement handleElementRename(@NotNull String newName) throws IncorrectOperationException {
    PsiElement newNameIdentifier = ORCodeFactory.createLetName(myElement.getProject(), newName);

    ASTNode newNameNode = newNameIdentifier == null ? null : newNameIdentifier.getFirstChild().getNode();
    if (newNameNode != null) {
        PsiElement nameIdentifier = myElement.getFirstChild();
        if (nameIdentifier == null) {
            myElement.getNode().addChild(newNameNode);
        } else {
            ASTNode oldNameNode = nameIdentifier.getNode();
            myElement.getNode().replaceChild(oldNameNode, newNameNode);
        }
    }

    return myElement;
}
 
Example 12
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    try {
        PsiElement element = descriptor.getPsiElement();
        Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
        document.setText(document.getText() + "\"");
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 13
Source Project: markdown-image-kit   Source File: ImageUploadIntentionAction.java    License: MIT License 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project,
                   Editor editor,
                   @NotNull PsiElement element) throws IncorrectOperationException {

    MarkdownImage matchImageMark = getMarkdownImage(editor);
    if (matchImageMark == null) {
        return;
    }

    if (ImageLocationEnum.NETWORK.name().equals(matchImageMark.getLocation().name())) {
        return;
    }

    Map<Document, List<MarkdownImage>> waitingForMoveMap = new HashMap<Document, List<MarkdownImage>>(1) {
        {
            put(editor.getDocument(), new ArrayList<MarkdownImage>(1) {
                {
                    add(matchImageMark);
                }
            });
        }
    };

    EventData data = new EventData()
        .setProject(project)
        .setClientName(getName())
        .setClient(getClient())
        .setWaitingProcessMap(waitingForMoveMap);

    // 开启后台任务
    new ActionTask(project, MikBundle.message("mik.action.upload.process", getName()), ActionManager.buildUploadChain(data)).queue();
}
 
Example 14
Source Project: ok-gradle   Source File: GroovyDslParser.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public PsiElement convertToPsiElement(@NotNull Object literal) {
  ApplicationManager.getApplication().assertReadAccessAllowed();
  try {
    return GroovyDslUtil.createLiteral(myDslFile, literal);
  }
  catch (IncorrectOperationException e) {
    myDslFile.getContext().getNotificationForType(myDslFile, INVALID_EXPRESSION).addError(e);
    return null;
  }
}
 
Example 15
/**
 * Adds quotes to DotEnvValue element
 *
 * @param project    The project that contains the file being edited.
 * @param descriptor A problem found by this inspection.
 */
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
    try {
        DotEnvValue valueElement = (DotEnvValue) descriptor.getPsiElement();

        PsiElement newValueElement = DotEnvFactory.createFromText(project, DotEnvTypes.VALUE, "DUMMY=\"" + valueElement.getText() + "\"");

        valueElement.getNode().getTreeParent().replaceChild(valueElement.getNode(), newValueElement.getNode());
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 16
Source Project: json2java4idea   Source File: MethodNamePolicy.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String convert(@Nonnull String name, @Nonnull TypeName type) {
    final String variableName = DefaultNamePolicy.format(name, CaseFormat.UPPER_CAMEL);
    if (Strings.isNullOrEmpty(variableName)) {
        throw new IllegalArgumentException("Cannot convert '" + name + "' to a method name");
    }

    try {
        final PsiType psiType = typeConverter.apply(type);
        return GenerateMembersUtil.suggestGetterName(variableName, psiType, project);
    } catch (IncorrectOperationException e) {
        throw new IllegalArgumentException("Cannot convert '" + name + "' to a method name", e);
    }
}
 
Example 17
Source Project: intellij-csv-validator   Source File: CsvIntentionHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static void quoteAll(@NotNull Project project, @NotNull PsiFile psiFile) {
    try {
        Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
        List<Integer> quotePositions = new ArrayList<>();
        Collection<PsiElement> fields = getAllFields(psiFile);
        PsiElement separator;
        for (PsiElement field : fields) {
            if (field.getFirstChild() == null || CsvHelper.getElementType(field.getFirstChild()) != CsvTypes.QUOTE) {
                separator = CsvHelper.getPreviousSeparator(field);
                if (separator == null) {
                    quotePositions.add(field.getParent().getTextOffset());
                } else {
                    quotePositions.add(separator.getTextOffset() + separator.getTextLength());
                }
            }
            if (field.getLastChild() == null || CsvHelper.getElementType(field.getLastChild()) != CsvTypes.QUOTE) {
                separator = CsvHelper.getNextSeparator(field);
                if (separator == null) {
                    quotePositions.add(field.getParent().getTextOffset() + field.getParent().getTextLength());
                } else {
                    quotePositions.add(separator.getTextOffset());
                }
            }
        }
        String text = addQuotes(document.getText(), quotePositions);
        document.setText(text);
    } catch (IncorrectOperationException e) {
        LOG.error(e);
    }
}
 
Example 18
Source Project: px2rwd-intellij-plugin   Source File: PX2REMIntention.java    License: MIT License 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
    Optional.ofNullable(ActionPerformer.getActionPerformer(project, editor)).ifPresent(ap ->
            Optional.of(FormatTools.getFormatTools(ap.getConstValue())).ifPresent(formatTools ->
                    formatTools.formatLineCode(ap, ShortCutType.REM)
            )
    );
}
 
Example 19
Source Project: px2rwd-intellij-plugin   Source File: RollbackIntention.java    License: MIT License 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
    Optional.ofNullable(ActionPerformer.getActionPerformer(project, editor)).ifPresent(ap ->
            Optional.of(FormatTools.getFormatTools(ap.getConstValue())).ifPresent(formatTools ->
                    formatTools.rollbackStyle(ap, ap.getDocument().getLineNumber(ap.getCaretModel().getOffset()))
            )
    );
}
 
Example 20
Source Project: px2rwd-intellij-plugin   Source File: PX2VWIntention.java    License: MIT License 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
    Optional.ofNullable(ActionPerformer.getActionPerformer(project, editor)).ifPresent(ap ->
            Optional.of(FormatTools.getFormatTools(ap.getConstValue())).ifPresent(formatTools ->
                    formatTools.formatLineCode(ap, ShortCutType.VW)
            )
    );
}
 
Example 21
Source Project: bamboo-soy   Source File: SoyIdentifierMixin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
  if (getIdentifierWord() == null) {
    throw new IncorrectOperationException("IdentifierWord missing");
  }
  getIdentifierWord()
      .replace(SoyPsiElementFactory
          .createIdentifierFromText(getProject(), name));
  return this;
}
 
Example 22
Source Project: bamboo-soy   Source File: SoyIdentifierOwnerMixin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
  if (getNameIdentifier() == null) {
    throw new IncorrectOperationException("IdentifierWord missing");
  }
  getNameIdentifier().replace(SoyPsiElementFactory.createIdentifierFromText(getProject(), name));
  return this;
}
 
Example 23
Source Project: litho   Source File: OnEventGenerateAction.java    License: Apache License 2.0 5 votes vote down vote up
/** @return a list of objects to insert into generated code. */
@NotNull
@Override
protected List<? extends GenerationInfo> generateMemberPrototypes(
    PsiClass aClass, ClassMember[] members) throws IncorrectOperationException {
  final List<GenerationInfo> prototypes = new ArrayList<>();
  for (ClassMember member : members) {
    if (member instanceof PsiMethodMember) {
      PsiMethodMember methodMember = (PsiMethodMember) member;
      prototypes.add(new PsiGenerationInfo<>(methodMember.getElement()));
    }
  }
  return prototypes;
}
 
Example 24
Source Project: litho   Source File: OnEventCreateFix.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(Project project, Editor editor, PsiFile file)
    throws IncorrectOperationException {
  final AtomicReference<PsiMethod> eventMethodRef = new AtomicReference<>();
  final Runnable generateOnEvent =
      () ->
          OnEventGenerateAction.createHandler(
                  (context, eventProject) -> event, eventMethodRef::set)
              .invoke(project, editor, file);
  final Runnable updateArgumentList =
      () ->
          Optional.ofNullable(eventMethodRef.get())
              .map(
                  eventMethod ->
                      AddArgumentFix.createArgumentList(
                          methodCall,
                          clsName,
                          eventMethod.getName(),
                          JavaPsiFacade.getInstance(project).getElementFactory()))
              .ifPresent(argumentList -> methodCall.getArgumentList().replace(argumentList));
  final Runnable action =
      () -> {
        TransactionGuard.getInstance().submitTransactionAndWait(generateOnEvent);
        WriteCommandAction.runWriteCommandAction(project, updateArgumentList);
        ComponentGenerateUtils.updateLayoutComponent(layoutCls);
        LithoLoggerProvider.getEventLogger().log(EventLogger.EVENT_FIX_EVENT_HANDLER + ".new");
      };
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    action.run();
  } else {
    application.invokeLater(action);
  }
}
 
Example 25
Source Project: litho   Source File: AddArgumentFix.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(Project project, Editor editor, PsiFile file)
    throws IncorrectOperationException {
  originalCall.getArgumentList().replace(newArgumentList);
  int offset = originalCall.getArgumentList().getLastChild().getTextOffset() - 1;
  // Move cursor before the ')'.
  editor.getCaretModel().moveToOffset(offset);
  LithoLoggerProvider.getEventLogger().log(EventLogger.EVENT_FIX_EVENT_HANDLER);
}
 
Example 26
Source Project: NutzCodeInsight   Source File: GenerateSqlXmlIntention.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile psiFile) throws IncorrectOperationException {
    PsiDirectory psiDirectory = psiFile.getContainingDirectory();
    WriteCommandAction.runWriteCommandAction(project, () -> {
        try {
            Properties properties = new Properties();
            properties.setProperty("CLASSNAME", clazz);
            PsiElement element = TemplateFileUtil.createFromTemplate(SqlTplFileTemplateGroupFactory.NUTZ_SQL_TPL_XML, templateFileName, properties, psiDirectory);
            NavigationUtil.activateFileWithPsiElement(element, true);
        } catch (Exception e) {
            HintManager.getInstance().showErrorHint(editor, "Failed: " + e.getLocalizedMessage());
        }
    });
}
 
Example 27
Source Project: ok-gradle   Source File: GroovyDslUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * This method is used in order to add elements to the back of a map,
 * it is derived from {@link ASTDelegatePsiElement#addInternal(ASTNode, ASTNode, ASTNode, Boolean)}.
 */
private static PsiElement realAddBefore(@NotNull GrListOrMap element, @NotNull PsiElement newElement, @NotNull PsiElement anchor) {
  CheckUtil.checkWritable(element);
  TreeElement elementCopy = ChangeUtil.copyToElement(newElement);
  ASTNode anchorNode = getAnchorNode(element, anchor.getNode(), true);
  ASTNode newNode = CodeEditUtil.addChildren(element.getNode(), elementCopy, elementCopy, anchorNode);
  if (newNode == null) {
    throw new IncorrectOperationException("Element cannot be added");
  }
  if (newNode instanceof TreeElement) {
    return ChangeUtil.decodeInformation((TreeElement)newNode).getPsi();
  }
  return newNode.getPsi();
}
 
Example 28
Source Project: ok-gradle   Source File: GroovyDslUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a literal from a context and value.
 *
 * @param context      context used to create GrPsiElementFactory
 * @param unsavedValue the value for the new expression
 * @return created PsiElement
 * @throws IncorrectOperationException if creation of the expression fails
 */
@Nullable
static PsiElement createLiteral(@NotNull GradleDslElement context, @NotNull Object unsavedValue) throws IncorrectOperationException {
  CharSequence unsavedValueText = null;
  if (unsavedValue instanceof String) {
    String stringValue = (String)unsavedValue;
    if (isQuotedString(stringValue)) {
      // We need to escape the string without the quotes and then add them back.
      String unquotedString = removeQuotes(stringValue);
      unsavedValueText = addQuotes(escapeString(unquotedString, true), true);
    }
    else {
      unsavedValueText = addQuotes(escapeString((String)unsavedValue, false), false);
    }
  }
  else if (unsavedValue instanceof Integer || unsavedValue instanceof Boolean || unsavedValue instanceof BigDecimal) {
    unsavedValueText = unsavedValue.toString();
  }
  else if (unsavedValue instanceof RawText) {
    unsavedValueText = ((RawText)unsavedValue).getText();
  }

  if (unsavedValueText == null) {
    return null;
  }

  GroovyPsiElementFactory factory = getPsiElementFactory(context);
  if (factory == null) {
    return null;
  }

  return factory.createExpressionFromText(unsavedValueText);
}
 
Example 29
Source Project: reasonml-idea-plugin   Source File: AbstractBaseIntention.java    License: MIT License 5 votes vote down vote up
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) throws IncorrectOperationException {
    if (!FileModificationService.getInstance().prepareFileForWrite(file)) {
        return;
    }

    PsiDocumentManager.getInstance(project).commitAllDocuments();
    T parentAtCaret = getParentAtCaret(editor, file);
    if (parentAtCaret != null) {
        ApplicationManager.getApplication().runWriteAction(() -> runInvoke(project, parentAtCaret));
    }
}
 
Example 30
Source Project: bamboo-soy   Source File: NamespaceDeclarationElement.java    License: Apache License 2.0 4 votes vote down vote up
@Override
default PsiElement setName(@NotNull String s) throws IncorrectOperationException {
  return null;
}