void (@NotNull final InsertionContext context, @NotNull LookupElement item) { /*if (TemplateManager.getInstance(context.getProject()).getActiveTemplate(context.getEditor()) != null) { return; // Don't brake the template. }*/ Object object = item.getObject(); if (!(object instanceof MavenRepositoryArtifactInfo completionItem)) { return; } PsiFile contextFile = context.getFile(); if (!(contextFile instanceof XmlFile xmlFile)) return; PsiElement element = xmlFile.findElementAt(context.getStartOffset()); XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); if (tag == null) { return; } context.commitDocument(); MavenDomShortArtifactCoordinates domCoordinates = getDomCoordinatesFromCurrentTag(context, tag); if (domCoordinates == null) { return; } setDependency(context, completionItem, (XmlFile)contextFile, domCoordinates); logMavenDependencyInsertion(context, item, completionItem); }