当前位置: 首页>>代码示例>>Java>>正文


Java StubBasedPsiElementBase类代码示例

本文整理汇总了Java中com.intellij.extapi.psi.StubBasedPsiElementBase的典型用法代码示例。如果您正苦于以下问题:Java StubBasedPsiElementBase类的具体用法?Java StubBasedPsiElementBase怎么用?Java StubBasedPsiElementBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StubBasedPsiElementBase类属于com.intellij.extapi.psi包,在下文中一共展示了StubBasedPsiElementBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PsiClassStubImpl

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
public PsiClassStubImpl(final JavaClassElementType type,
                        final StubElement parent,
                        final StringRef qualifiedName,
                        final StringRef name,
                        final StringRef baseRefText,
                        final byte flags) {
  super(parent, type);
  myQualifiedName = qualifiedName;
  myName = name;
  myBaseRefText = baseRefText;
  myFlags = flags;
  if (StubBasedPsiElementBase.ourTraceStubAstBinding) {
    String creationTrace = "Stub creation thread: " + Thread.currentThread() + "\n" + DebugUtil.currentStackTrace();
    putUserData(StubBasedPsiElementBase.CREATION_TRACE, creationTrace);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PsiClassStubImpl.java

示例2: loadTreeElement

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@NotNull
private FileElement loadTreeElement() {
  ApplicationManager.getApplication().assertReadAccessAllowed();

  final FileViewProvider viewProvider = getViewProvider();
  if (viewProvider.isPhysical() && myManager.isAssertOnFileLoading(viewProvider.getVirtualFile())) {
    LOG.error("Access to tree elements not allowed in tests. path='" + viewProvider.getVirtualFile().getPresentableUrl()+"'");
  }

  Document cachedDocument = FileDocumentManager.getInstance().getCachedDocument(getViewProvider().getVirtualFile());

  FileElement treeElement = createFileElement(viewProvider.getContents());
  treeElement.setPsi(this);

  while (true) {
    StubTree stub = derefStub();
    List<Pair<StubBasedPsiElementBase, CompositeElement>> bindings = calcStubAstBindings(treeElement, cachedDocument, stub);

    FileElement savedTree = ensureTreeElement(viewProvider, treeElement, stub, bindings);
    if (savedTree != null) {
      return savedTree;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PsiFileImpl.java

示例3: createInvalidRef

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@Nonnull
static SubstrateRef createInvalidRef(@Nonnull final StubBasedPsiElementBase<?> psi) {
  return new SubstrateRef() {
    @Nonnull
    @Override
    public ASTNode getNode() {
      throw new PsiInvalidElementAccessException(psi);
    }

    @Override
    public boolean isValid() {
      return false;
    }

    @Nonnull
    @Override
    public PsiFile getContainingFile() {
      throw new PsiInvalidElementAccessException(psi);
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:SubstrateRef.java

示例4: ensureTreeElement

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@Nullable
private FileElement ensureTreeElement(@Nonnull FileViewProvider viewProvider,
                                      @Nonnull FileElement treeElement,
                                      @Nonnull FileTrees trees,
                                      @Nonnull List<Pair<StubBasedPsiElementBase, AstPath>> bindings) {
  synchronized (myPsiLock) {
    FileElement existing = derefTreeElement();
    if (existing != null) {
      return existing;
    }

    if (trees != myTrees) {
      return null; // try again
    }

    switchFromStubToAst(bindings, trees);
    updateTrees(trees.withAst(createTreeElementPointer(treeElement)));

    if (LOG.isDebugEnabled() && viewProvider.isPhysical()) {
      LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl());
    }

    return treeElement;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:PsiFileImpl.java

示例5: PsiClassStubImpl

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
public PsiClassStubImpl(final JavaClassElementType type,
		final StubElement parent,
		@Nullable final String qualifiedName,
		@Nullable final String name,
		@Nullable final String baseRefText,
		final byte flags)
{
	super(parent, type);
	myQualifiedName = qualifiedName;
	myName = name;
	myBaseRefText = baseRefText;
	myFlags = flags;
	if(StubBasedPsiElementBase.ourTraceStubAstBinding)
	{
		String creationTrace = "Stub creation thread: " + Thread.currentThread() + "\n" + DebugUtil.currentStackTrace();
		putUserData(StubBasedPsiElementBase.CREATION_TRACE, creationTrace);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:PsiClassStubImpl.java

示例6: ensureTreeElement

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@Nullable
private FileElement ensureTreeElement(@NotNull FileViewProvider viewProvider,
                                      @NotNull FileElement treeElement,
                                      @Nullable StubTree stub,
                                      @NotNull List<Pair<StubBasedPsiElementBase, CompositeElement>> bindings) {
  synchronized (PsiLock.LOCK) {
    FileElement existing = derefTreeElement();
    if (existing != null) {
      return existing;
    }

    if (stub != derefStub()) {
      return null; // stub has been just loaded by another thread, it needs to be bound to AST
    }

    if (stub != null) {
      treeElement.putUserData(STUB_TREE_IN_PARSED_TREE, new SoftReference<StubTree>(stub));
      putUserData(ObjectStubTree.LAST_STUB_TREE_HASH, stub.hashCode());
    }

    switchFromStubToAst(bindings);
    myStub = null;
    myTreeElementPointer = createTreeElementPointer(treeElement);

    if (LOG.isDebugEnabled() && viewProvider.isPhysical()) {
      LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl());
    }

    return treeElement;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:PsiFileImpl.java

示例7: switchFromStubToAst

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
private static void switchFromStubToAst(List<Pair<StubBasedPsiElementBase, CompositeElement>> pairs) {
  for (Pair<StubBasedPsiElementBase, CompositeElement> pair : pairs) {
    pair.second.setPsi(pair.first);
    pair.first.setNode(pair.second);
    pair.first.setStub(null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiFileImpl.java

示例8: loadTreeElement

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
private FileElement loadTreeElement() {
  ApplicationManager.getApplication().assertReadAccessAllowed();

  final FileViewProvider viewProvider = getViewProvider();
  if (viewProvider.isPhysical() && myManager.isAssertOnFileLoading(viewProvider.getVirtualFile())) {
    LOG.error("Access to tree elements not allowed in tests. path='" + viewProvider.getVirtualFile().getPresentableUrl()+"'");
  }

  Document cachedDocument = FileDocumentManager.getInstance().getCachedDocument(getViewProvider().getVirtualFile());

  final Document document = viewProvider.isEventSystemEnabled() ? viewProvider.getDocument() : null;
  FileElement treeElement = createFileElement(viewProvider.getContents());
  if (document != null) {
    treeElement.putUserData(HARD_REFERENCE_TO_DOCUMENT, document);
  }
  treeElement.setPsi(this);

  List<Pair<StubBasedPsiElementBase, CompositeElement>> bindings = calcStubAstBindings(treeElement, cachedDocument);

  synchronized (PsiLock.LOCK) {
    FileElement existing = derefTreeElement();
    if (existing != null) {
      return existing;
    }

    switchFromStubToAst(bindings);
    myStub = null;
    myTreeElementPointer = createTreeElementPointer(treeElement);

    if (LOG.isDebugEnabled() && viewProvider.isPhysical()) {
      LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl());
    }

    return treeElement;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:PsiFileImpl.java

示例9: assertConsistency

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
private static void assertConsistency(PsiElement cachedPsi) {
  if (cachedPsi instanceof StubBasedPsiElementBase &&
      ((StubBasedPsiElementBase)cachedPsi).getSubstrateRef() instanceof AstPath) {
    LOG.error("Expected strong reference at " + cachedPsi +
              " of " + cachedPsi.getClass() +
              " and " + ((StubBasedPsiElementBase)cachedPsi).getElementType());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:AstPath.java

示例10: loadTreeElement

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@Nonnull
private FileElement loadTreeElement() {
  ApplicationManager.getApplication().assertReadAccessAllowed();

  final FileViewProvider viewProvider = getViewProvider();
  if (viewProvider.isPhysical() && myManager.isAssertOnFileLoading(viewProvider.getVirtualFile())) {
    LOG.error("Access to tree elements not allowed in tests. path='" + viewProvider.getVirtualFile().getPresentableUrl()+"'");
  }

  FileElement treeElement = createFileElement(viewProvider.getContents());
  treeElement.setPsi(this);

  myFileElementBeingLoaded.set(treeElement);
  try {
    while (true) {
      FileTrees trees = myTrees;
      List<Pair<StubBasedPsiElementBase, AstPath>> bindings = calcStubAstBindings(treeElement, trees);

      FileElement savedTree = ensureTreeElement(viewProvider, treeElement, trees, bindings);
      if (savedTree != null) {
        return savedTree;
      }
    }
  }
  finally {
    myFileElementBeingLoaded.remove();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:PsiFileImpl.java

示例11: hasUnbindableCachedPsi

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
private boolean hasUnbindableCachedPsi() {
  for (PsiFile file : myViewProvider.getAllFiles()) {
    if (file instanceof PsiFileImpl) {
      for (StubBasedPsiElementBase<?> psi : ((PsiFileImpl)file).myRefToPsi.getAllCachedPsi()) {
        if (psi.getStubIndex() < 0) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:PsiFileImpl.java

示例12: bindStubsToCachedPsi

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
private void bindStubsToCachedPsi(StubTree stubTree) {
  for (StubBasedPsiElementBase<?> psi : myRefToPsi.getAllCachedPsi()) {
    int index = psi.getStubIndex();
    if (index >= 0) {
      //noinspection unchecked
      ((StubBase)stubTree.getPlainList().get(index)).setPsi(psi);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:PsiFileImpl.java

示例13: obtainPsi

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
@Nullable
public StubBasedPsiElementBase<?> obtainPsi(@Nonnull AstPath path, @Nonnull Factory<StubBasedPsiElementBase<?>> creator) {
  if (useStrongRefs()) {
    return null;
  }

  StubBasedPsiElementBase<?> psi = myRefToPsi.getCachedPsi(path);
  if (psi != null) return psi;

  synchronized (myPsiLock) {
    psi = myRefToPsi.getCachedPsi(path);
    return psi != null ? psi : myRefToPsi.cachePsi(path, creator.create());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:PsiFileImpl.java

示例14: invalidatePsi

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
void invalidatePsi() {
  myQueue.cleanupStaleReferences();
  for (MyReference reference : myMap.values()) {
    StubBasedPsiElementBase<?> psi = SoftReference.dereference(reference);
    if (psi != null) {
      DebugUtil.onInvalidated(psi);
      psi.setSubstrateRef(SubstrateRef.createInvalidRef(psi));
    }
  }
  myMap.clear();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:AstPathPsiMap.java

示例15: switchToStrongRefs

import com.intellij.extapi.psi.StubBasedPsiElementBase; //导入依赖的package包/类
void switchToStrongRefs() {
  myQueue.cleanupStaleReferences();
  for (MyReference reference : myMap.values()) {
    StubBasedPsiElementBase<?> psi = SoftReference.dereference(reference);
    if (psi != null) {
      CompositeElement node = (CompositeElement)psi.getNode();
      node.setPsi(psi);
      psi.setSubstrateRef(SubstrateRef.createAstStrongRef(node));
    }
  }
  myMap.clear();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:AstPathPsiMap.java


注:本文中的com.intellij.extapi.psi.StubBasedPsiElementBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。