void (@NotNull final InsertionContext context, @NotNull LookupElementDecorator<LookupElement> item) { lookupElement.handleInsert(context); Object object = lookupElement.getObject(); if (object instanceof XmlTag && "maven-4.0.0.xsd".equals(((XmlTag)object).getContainingFile().getName())) { context.commitDocument(); CaretModel caretModel = context.getEditor().getCaretModel(); PsiElement psiElement = context.getFile().findElementAt(caretModel.getOffset()); XmlTag xmlTag = PsiTreeUtil.getParentOfType(psiElement, XmlTag.class); if (xmlTag != null) { DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(xmlTag); if (domElement instanceof MavenDomDependency || domElement instanceof MavenDomExclusion) { String s = "\n<groupId></groupId>\n<artifactId></artifactId>\n"; context.getDocument().insertString(caretModel.getOffset(), s); caretModel.moveToOffset(caretModel.getOffset() + s.length() - "</artifactId>\n".length()); context.commitDocument(); new ReformatCodeProcessor(context.getProject(), context.getFile(), xmlTag.getTextRange(), false).run(); MavenDependencyCompletionUtil.invokeCompletion(context, CompletionType.BASIC); } } } }