コード例 #1
0
ファイル: JavaStubElementType.java プロジェクト: jexp/idea2
  public boolean isCompiled(StubT stub) {
    StubElement parent = stub;
    while (!(parent instanceof PsiFileStub)) {
      parent = parent.getParentStub();
    }

    return ((PsiJavaFileStub) parent).isCompiled();
  }
コード例 #2
0
  protected final PsiElement getParentByStub() {
    final StubElement<?> stub = getStub();
    if (stub != null) {
      return stub.getParentStub().getPsi();
    }

    return SharedImplUtil.getParent(getNode());
  }
コード例 #3
0
 private static void recordClassOrObjectByPackage(
     StubElement<? extends JetClassOrObject> stub, IndexSink sink) {
   StubElement parentStub = stub.getParentStub();
   if (parentStub instanceof PsiJetFileStub) {
     PsiJetFileStub jetFileStub = (PsiJetFileStub) parentStub;
     String packageName = jetFileStub.getPackageName();
     if (packageName != null) {
       sink.occurrence(JetClassByPackageIndex.getInstance().getKey(), packageName);
     }
   }
 }
コード例 #4
0
  public static boolean isGroovyStaticMemberStub(StubElement<?> stub) {
    StubElement<?> modifierOwner = stub instanceof GrMethodStub ? stub : stub.getParentStub();
    StubElement<GrModifierList> type =
        modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIERS);
    if (!(type instanceof GrModifierListStub)) {
      return false;
    }
    int mask = ((GrModifierListStub) type).getModifiersFlags();
    if (GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.PRIVATE, mask)) {
      return false;
    }
    if (GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.STATIC, mask)) {
      return true;
    }

    StubElement parent = modifierOwner.getParentStub();
    StubElement classStub = parent == null ? null : parent.getParentStub();
    if (classStub instanceof GrTypeDefinitionStub
        && (((GrTypeDefinitionStub) classStub).isAnnotationType()
            || ((GrTypeDefinitionStub) classStub).isInterface())) {
      return true;
    }
    return false;
  }
コード例 #5
0
  @Override
  @NotNull
  public PsiFile getContainingFile() {
    StubElement stub = myStub;
    if (stub != null) {
      while (!(stub instanceof PsiFileStub)) {
        stub = stub.getParentStub();
      }
      PsiFile psi = (PsiFile) stub.getPsi();
      if (psi == null) {
        throw new PsiInvalidElementAccessException(this, "no psi for file stub " + stub, null);
      }
      return psi;
    }

    PsiFile file = super.getContainingFile();
    if (file == null) {
      throw new PsiInvalidElementAccessException(this);
    }

    return file;
  }