ConflictResolutionPolicy (TemplateResource template) { final DuplicationPolicy dupPolicy = config.getReplaceDialogInitialOption(); if (dupPolicy == DuplicationPolicy.ASK) { PsiMethod targetMethod = getMethodPrototype(Collections.emptyList(), Collections.emptyMap(), template); PsiMethod existingMethod = targetMethod != null ? clazz.findMethodBySignature(targetMethod, false) : null; if (existingMethod != null) { return MethodExistsDialog.showDialog(targetMethod.getName()); } } else if (dupPolicy == DuplicationPolicy.REPLACE) { return ReplacePolicy.getInstance(); } // If there is no conflict, duplicate policy will do the trick return DuplicatePolicy.getInstance(); }