void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { RncNameImpl myReference = (RncNameImpl)descriptor.getPsiElement(); final String prefix = myReference.getPrefix(); final PsiFileFactory factory = PsiFileFactory.getInstance(myReference.getProject()); final RncFile psiFile = (RncFile)factory.createFileFromText("dummy.rnc", RncFileType.getInstance(), StringUtil.toLowerCase(myReference.getKind().name()) + " " + prefix + " = \"###\""); final RncFile rncFile = (RncFile)myReference.getContainingFile(); final RncDecl[] declarations = rncFile.getDeclarations(); final RncDecl decl = psiFile.getDeclarations()[0]; final RncDecl e; if (declarations.length > 0) { e = (RncDecl)rncFile.addAfter(decl, declarations[declarations.length - 1]); } else { final RncGrammar rncGrammar = rncFile.getGrammar(); if (rncGrammar != null) { e = (RncDecl)rncFile.addBefore(decl, rncGrammar); } else { e = (RncDecl)rncFile.add(decl); } } final ASTNode blockNode = e.getParent().getNode(); assert blockNode != null; final ASTNode newNode = e.getNode(); assert newNode != null; CodeStyleManager.getInstance(e.getManager().getProject()).reformatNewlyAddedElement(blockNode, newNode); final PsiElement literal = e.getLastChild(); assert literal != null; final ASTNode literalNode = literal.getNode(); assert literalNode != null; assert literalNode.getElementType() == RncTokenTypes.LITERAL; final int offset = literal.getTextRange().getStartOffset(); literal.delete(); VirtualFile virtualFile = myReference.getElement().getContainingFile().getVirtualFile(); if (virtualFile != null) { Editor editor = FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, virtualFile, offset), true); if (editor != null) { RncDecl rncDecl = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(e); final TemplateManager manager = TemplateManager.getInstance(project); final Template t = manager.createTemplate("", ""); t.addTextSegment(" \""); Expression expression = new ConstantNode(""); t.addVariable("uri", expression, expression, true); t.addTextSegment("\""); t.addEndVariable(); editor.getCaretModel().moveToOffset(rncDecl.getTextRange().getEndOffset()); manager.startTemplate(editor, t); } } }