Package com.intellij.psi

Examples of com.intellij.psi.PsiFile


        Project project = ActionUtil.getProject(e);
        Editor editor = e.getData(PlatformDataKeys.EDITOR);
        if (project == null || editor == null) {
            return false;
        } else {
            PsiFile psiFile = PsiUtil.getPsiFile(project, editor.getDocument());
            return psiFile instanceof DBLanguageFile;
        }
    }
View Full Code Here


    for (VirtualFile virtualFile : myFilesToScan) {
      synchronized (fileToEventClasses) {
        getEventClasses(virtualFile).clear();
      }
      PsiFile psiFile = PsiManager.getInstance(myProject).findFile(virtualFile);
      if (psiFile == null) throw new IllegalStateException("huh? " + virtualFile);
      if (psiFile.getFileType() instanceof JavaFileType) {

        final long startTime = System.currentTimeMillis();
        psiFile.accept(new PsiRecursiveElementVisitor() {
          @Override public void visitElement(PsiElement element) {
            if (element instanceof PsiMethod
                && SubscriberMetadata.isAnnotatedWithSubscriber((PsiMethod) element)) {
              maybeAddSubscriberMethod((PsiMethod) element);
            } else {
View Full Code Here

        DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject);
        for (String eventClass : eventClasses) {
          PsiClass eventPsiClass = javaPsiFacade.findClass(eventClass,
                GlobalSearchScope.allScope(myProject));
          if (eventPsiClass == null) continue;
          PsiFile psiFile = eventPsiClass.getContainingFile();
          if (psiFile == null) continue;
          codeAnalyzer.restart(psiFile);
        }
      }
    });
View Full Code Here

  private void maybeAddSubscriberMethod(PsiMethod element) {
    PsiTypeElement methodParameter = OttoLineMarkerProvider.getMethodParameter(element);
    if (methodParameter != null) {
      String canonicalText = methodParameter.getType().getCanonicalText();
      PsiFile containingFile = methodParameter.getContainingFile();
      if (containingFile != null) {
        VirtualFile virtualFile = containingFile.getVirtualFile();
        if (virtualFile != null) {
          synchronized (fileToEventClasses) {
            Set<String> eventClasses = getEventClasses(virtualFile);
            eventClasses.add(canonicalText);
          }
View Full Code Here

      maybeInvalidate(event);
    }
  }

  private void maybeInvalidate(PsiTreeChangeEvent event) {
    PsiFile file = event.getFile();
    if (file == null) {
      return;
    }

    VirtualFile virtualFile = file.getVirtualFile();
    synchronized (filesToScan) {
      filesToScan.add(virtualFile);
    }
  }
View Full Code Here

    }
    else {
      VirtualFile virtualFile = usage instanceof UsageInFile ? ((UsageInFile)usage).getFile() : null;
      if (virtualFile != null) {
        Project project = myUsageView.getProject();
        PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
        if (psiFile != null && psiFile.isValid()) {
          final Color color = FileColorManager.getInstance(project).getRendererBackground(psiFile);
          if (color != null) fileBgColor = color;
        }
      }
    }
View Full Code Here

            presentation.setEnabled(false);
            return;
        }

        Document document = editor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
        if (psiFile == null || !(psiFile instanceof HaskellFile)) {
            presentation.setEnabled(false);
            return;
        }

        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || virtualFile instanceof LightVirtualFile) {
            presentation.setEnabled(false);
            return;
        }
        String filePath = virtualFile.getPath();
View Full Code Here

            return;
        Project project = editor.getProject();
        if (project == null)
            return;
        Document document = editor.getDocument();
        PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
        if (psiFile == null || !(psiFile instanceof HaskellFile))
            return;
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null)
            return;
        String filePath = virtualFile.getPath();
        if (filePath == null)
            return;
View Full Code Here

        if (m == null)
            return null;
        Editor editor = e.getData(DataKeys.EDITOR);
        if (editor == null || editor.getProject() == null)
            return null;
        PsiFile psiFile = PsiDocumentManager.getInstance(editor.getProject()).getPsiFile(editor.getDocument());
        if (psiFile == null || !(psiFile instanceof HaskellFile))
            return null;
        VirtualFile virtualFile = psiFile.getVirtualFile();
        if (virtualFile == null || virtualFile instanceof LightVirtualFile)
            return null;
        return virtualFile.getPath();
    }
View Full Code Here

        } else {
          final PsiClass psiClass = IdeaUtilImpl.findJavaPsiClass(_project, node.getSourcePath());
          LOGGER.debug("BugTreeHelper#getSelectedFile(" + _project + ", " + node.getSourcePath() + ')');
          if (psiClass != null) {
            LOGGER.debug("Found: psiClass (" + psiClass.getName() + ')');
            final PsiFile psiFile = IdeaUtilImpl.getPsiFile(psiClass);
            if (psiFile != null) {
              LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - found - psiFile: " + psiFile.getName());
              node.setPsiFile(psiFile);
            } else {
              LOGGER.debug("BugTreeHelper - IdeaUtilImpl.getPsiFile(psiClass) - NOT found - psiClass: " + psiClass);
            }
            return psiFile;
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.