Java 类com.intellij.psi.ExternallyDefinedPsiElement 实例源码

项目:tools-idea    文件:ProblemsHolder.java   
public void registerProblem(@NotNull ProblemDescriptor problemDescriptor) {
  PsiElement element = problemDescriptor.getPsiElement();
  if (element != null && !isInPsiFile(element)) {
    ExternallyDefinedPsiElement external = PsiTreeUtil.getParentOfType(element, ExternallyDefinedPsiElement.class, false);
    if (external != null) {
      PsiElement newTarget = external.getProblemTarget();
      if (newTarget != null) {
        redirectProblem(problemDescriptor, newTarget);
        return;
      }
    }

    PsiFile containingFile = element.getContainingFile();
    PsiElement context = InjectedLanguageManager.getInstance(containingFile.getProject()).getInjectionHost(containingFile);
    PsiElement myContext = InjectedLanguageManager.getInstance(myFile.getProject()).getInjectionHost(myFile);
    LOG.error("Reported element " + element + " is not from the file '" + myFile + "' the inspection was invoked for. Message: '" + problemDescriptor.getDescriptionTemplate()+"'.\n" +
              "Element' containing file: "+ containingFile +"; context: "+(context == null ? null : context.getContainingFile())+"\n"
              +"Inspection invoked for file: "+ myFile +"; context: "+(myContext == null ? null : myContext.getContainingFile())+"\n"
              );
  }

  myProblems.add(problemDescriptor);
}
项目:consulo-java    文件:ClassInnerStuffCache.java   
@NotNull
private Map<String, PsiField> getFieldsMap()
{
    PsiField[] fields = getFields();
    if(fields.length == 0)
    {
        return Collections.emptyMap();
    }

    Map<String, PsiField> cachedFields = new THashMap<String, PsiField>();
    for(PsiField field : fields)
    {
        String name = field.getName();
        if(!(field instanceof ExternallyDefinedPsiElement) || !cachedFields.containsKey(name))
        {
            cachedFields.put(name, field);
        }
    }
    return cachedFields;
}
项目:consulo-java    文件:ClassInnerStuffCache.java   
@NotNull
private Map<String, PsiClass> getInnerClassesMap()
{
    PsiClass[] classes = getInnerClasses();
    if(classes.length == 0)
    {
        return Collections.emptyMap();
    }

    Map<String, PsiClass> cachedInners = new THashMap<String, PsiClass>();
    for(PsiClass psiClass : classes)
    {
        String name = psiClass.getName();
        if(!(psiClass instanceof ExternallyDefinedPsiElement) || !cachedInners.containsKey(name))
        {
            cachedInners.put(name, psiClass);
        }
    }
    return cachedInners;
}
项目:intellij-ce-playground    文件:ProblemsHolder.java   
public void registerProblem(@NotNull ProblemDescriptor problemDescriptor) {
  PsiElement element = problemDescriptor.getPsiElement();
  if (element != null && !isInPsiFile(element)) {
    ExternallyDefinedPsiElement external = PsiTreeUtil.getParentOfType(element, ExternallyDefinedPsiElement.class, false);
    if (external != null) {
      PsiElement newTarget = external.getProblemTarget();
      if (newTarget != null) {
        redirectProblem(problemDescriptor, newTarget);
        return;
      }
    }
  }

  myProblems.add(problemDescriptor);
}
项目:tools-idea    文件:ClassInnerStuffCache.java   
@Nullable
private Map<String, PsiField> getFieldsMap() {
  final PsiField[] fields = getFields();
  if (fields.length == 0) return null;

  final Map<String, PsiField> cachedFields = new THashMap<String, PsiField>();
  for (final PsiField field : fields) {
    final String name = field.getName();
    if (!(field instanceof ExternallyDefinedPsiElement) || !cachedFields.containsKey(name)) {
      cachedFields.put(name, field);
    }
  }
  return cachedFields;
}
项目:tools-idea    文件:ClassInnerStuffCache.java   
@Nullable
private Map<String, PsiClass> getInnerClassesMap() {
  final PsiClass[] classes = getInnerClasses();
  if (classes.length == 0) return null;

  final Map<String, PsiClass> cachedInners = new THashMap<String, PsiClass>();
  for (final PsiClass psiClass : classes) {
    final String name = psiClass.getName();
    if (!(psiClass instanceof ExternallyDefinedPsiElement) || !cachedInners.containsKey(name)) {
      cachedInners.put(name, psiClass);
    }
  }
  return cachedInners;
}
项目:consulo    文件:ProblemsHolder.java   
public void registerProblem(@Nonnull ProblemDescriptor problemDescriptor) {
  PsiElement element = problemDescriptor.getPsiElement();
  if (element != null && !isInPsiFile(element)) {
    ExternallyDefinedPsiElement external = PsiTreeUtil.getParentOfType(element, ExternallyDefinedPsiElement.class, false);
    if (external != null) {
      PsiElement newTarget = external.getProblemTarget();
      if (newTarget != null) {
        redirectProblem(problemDescriptor, newTarget);
        return;
      }
    }
  }

  myProblems.add(problemDescriptor);
}