void (final Project project, PsiFile psiFile, final XmlTagInjection template) { final Configuration configuration = InjectorUtils.getEditableInstance(project); final AbstractTagInjection originalInjection = (AbstractTagInjection)configuration.findExistingInjection(template); final XmlTagInjection newInjection = originalInjection == null? template : new XmlTagInjection().copyFrom(originalInjection); configuration.replaceInjectionsWithUndo( project, psiFile, Collections.singletonList(newInjection), ContainerUtil.createMaybeSingletonList(originalInjection), Collections.emptyList()); }