private static @Nullable PsiElement findElementToAdd(final PsiFile psiFile) {
    if (psiFile.getFileType().equals(GuiFormFileType.INSTANCE)) {
      return psiFile;
    }
    else if (psiFile.getFileType().equals(JavaFileType.INSTANCE)) {
      final PsiClass psiClass = PsiTreeUtil.getChildOfType(psiFile, PsiClass.class);
      Project project = psiFile.getProject();
      final PsiClass componentClass =
        JavaPsiFacade.getInstance(project).findClass(JComponent.class.getName(), ProjectScope.getAllScope(project));
      if (psiClass != null && componentClass != null && psiClass.isInheritor(componentClass, true) && psiClass.getQualifiedName() != null) {
        return psiClass;
      }
    }
    return null;
  }
private static @Nullable PsiElement findElementToAdd(final PsiFile psiFile)