@Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
      PsiElement element = descriptor.getStartElement();
      if (shouldUseParent) {
        element = element.getParent();
      }
      PsiCodeBlock block = ObjectUtils.tryCast(element, PsiCodeBlock.class);
      TextRange range = getRange(block);
      if (range == null) return;
      new MethodExtractor().doExtract(block.getContainingFile(), range.shiftRight(block.getTextRange().getStartOffset()));
    }
@Override
    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor)