public void actionPerformed(AnActionEvent event) {
   final Project project = event.getData(PlatformDataKeys.PROJECT);
   if (project == null) {
     return;
   }
   VirtualFile[] result = event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
   for (VirtualFile virtualFile : result) {
     PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
     psiFile.acceptChildren(new GeneratorPsiVisitor(project, psiFile));
   }
 }
 @NotNull
 @Override
 public List<AbstractStepDefinition> getStepDefinitions(@NotNull PsiFile psiFile) {
   final List<AbstractStepDefinition> newDefs = new ArrayList<AbstractStepDefinition>();
   psiFile.acceptChildren(
       new JavaRecursiveElementVisitor() {
         @Override
         public void visitMethod(PsiMethod method) {
           super.visitMethod(method);
           if (CucumberJavaUtil.isStepDefinition(method)) {
             newDefs.add(new JavaStepDefinition(method));
           }
         }
       });
   return newDefs;
 }
  private Set<VirtualFile> calcCodeReferenceDependencies(
      VirtualFile vfile, final Set<VirtualFile> moduleFiles) {
    final PsiFile psi = PsiManager.getInstance(myProject).findFile(vfile);
    if (!(psi instanceof GroovyFile)) return Collections.emptySet();

    final Set<VirtualFile> deps = new THashSet<VirtualFile>();
    psi.acceptChildren(
        new PsiElementVisitor() {
          @Override
          public void visitElement(PsiElement element) {
            if (element instanceof GrCodeReferenceElement) {
              GrCodeReferenceElement referenceElement = (GrCodeReferenceElement) element;
              try {
                final PsiElement target = referenceElement.resolve();
                if (target instanceof GrTypeDefinition || target instanceof GroovyScriptClass) {
                  final VirtualFile targetFile =
                      target.getContainingFile().getViewProvider().getVirtualFile();
                  if (moduleFiles.contains(targetFile)) {
                    deps.add(targetFile);
                  }
                }
              } catch (ProcessCanceledException ignored) {
              } catch (Exception e) {
                LOG.error(e);
                // prevent our PSI errors from failing the entire compilation
              } catch (AssertionError e) {
                LOG.error(e);
                // prevent our PSI errors from failing the entire compilation
              }
            }

            element.acceptChildren(this);
          }
        });
    return deps;
  }