@Nullable
 @Override
 public Object getData(@NonNls String dataId) {
   if (ExternalSystemDataKeys.RECENT_TASKS_LIST.is(dataId)) {
     return myRecentTasksList;
   } else if (ExternalSystemDataKeys.ALL_TASKS_MODEL.is(dataId)) {
     return myAllTasksModel;
   } else if (ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID.is(dataId)) {
     return myExternalSystemId;
   } else if (ExternalSystemDataKeys.NOTIFICATION_GROUP.is(dataId)) {
     return myNotificationGroup;
   } else if (ExternalSystemDataKeys.SELECTED_TASK.is(dataId)) {
     return mySelectedTaskProvider == null ? null : mySelectedTaskProvider.produce();
   } else if (ExternalSystemDataKeys.SELECTED_PROJECT.is(dataId)) {
     if (mySelectedTaskProvider != myAllTasksTree) {
       return null;
     } else {
       Object component = myAllTasksTree.getLastSelectedPathComponent();
       if (component instanceof ExternalSystemNode) {
         Object element = ((ExternalSystemNode) component).getDescriptor().getElement();
         return element instanceof ExternalProjectPojo ? element : null;
       }
     }
   } else if (Location.DATA_KEY.is(dataId)) {
     Location location = buildLocation();
     return location == null ? super.getData(dataId) : location;
   }
   return null;
 }
  @Nullable
  public static List<String> findTestDataFiles(@NotNull DataContext context) {
    final PsiMethod method = findTargetMethod(context);
    if (method == null) {
      return null;
    }
    final String name = method.getName();

    if (name.startsWith("test")) {
      String testDataPath =
          TestDataLineMarkerProvider.getTestDataBasePath(method.getContainingClass());
      final TestDataReferenceCollector collector =
          new TestDataReferenceCollector(testDataPath, name.substring(4));
      return collector.collectTestDataReferences(method);
    }

    final Location<?> location = Location.DATA_KEY.getData(context);
    if (location instanceof PsiMemberParameterizedLocation) {
      PsiClass containingClass = ((PsiMemberParameterizedLocation) location).getContainingClass();
      if (containingClass == null) {
        containingClass =
            PsiTreeUtil.getParentOfType(location.getPsiElement(), PsiClass.class, false);
      }
      if (containingClass != null) {
        final PsiAnnotation annotation =
            AnnotationUtil.findAnnotationInHierarchy(
                containingClass, Collections.singleton(JUnitUtil.RUN_WITH));
        if (annotation != null) {
          final PsiAnnotationMemberValue memberValue = annotation.findAttributeValue("value");
          if (memberValue instanceof PsiClassObjectAccessExpression) {
            final PsiTypeElement operand =
                ((PsiClassObjectAccessExpression) memberValue).getOperand();
            if (operand.getType().equalsToText(Parameterized.class.getName())) {
              final String testDataPath =
                  TestDataLineMarkerProvider.getTestDataBasePath(containingClass);
              final String paramSetName =
                  ((PsiMemberParameterizedLocation) location).getParamSetName();
              final String baseFileName =
                  StringUtil.trimEnd(StringUtil.trimStart(paramSetName, "["), "]");
              final ProjectFileIndex fileIndex =
                  ProjectRootManager.getInstance(containingClass.getProject()).getFileIndex();
              return TestDataGuessByExistingFilesUtil.suggestTestDataFiles(
                  fileIndex, baseFileName, testDataPath, containingClass);
            }
          }
        }
      }
    }

    return null;
  }
  @Nullable
  private static PsiMethod findTargetMethod(@NotNull DataContext context) {
    final Editor editor = CommonDataKeys.EDITOR.getData(context);
    final PsiFile file = CommonDataKeys.PSI_FILE.getData(context);
    if (file != null && editor != null) {
      PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
      return PsiTreeUtil.getParentOfType(element, PsiMethod.class);
    }

    final Location<?> location = Location.DATA_KEY.getData(context);
    if (location != null) {
      final PsiElement element = location.getPsiElement();
      if (element instanceof PsiMethod) {
        return (PsiMethod) element;
      }
    }
    return null;
  }
 private ConfigurationContext(final DataContext dataContext) {
   myRuntimeConfiguration = RunConfiguration.DATA_KEY.getData(dataContext);
   myContextComponent = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
   myModule = LangDataKeys.MODULE.getData(dataContext);
   @SuppressWarnings({"unchecked"})
   final Location<PsiElement> location =
       (Location<PsiElement>) Location.DATA_KEY.getData(dataContext);
   if (location != null) {
     myLocation = location;
     return;
   }
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   if (project == null) {
     myLocation = null;
     return;
   }
   final PsiElement element = getSelectedPsiElement(dataContext, project);
   if (element == null) {
     myLocation = null;
     return;
   }
   myLocation = new PsiLocation<>(project, myModule, element);
 }