Java Code Examples for com.intellij.psi.impl.PsiManagerEx#getInstanceEx()

The following examples show how to use com.intellij.psi.impl.PsiManagerEx#getInstanceEx() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ASTDelegatePsiElement.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public PsiManagerEx getManager() {
  Project project = ProjectCoreUtil.theOnlyOpenProject();
  if (project != null) {
    return PsiManagerEx.getInstanceEx(project);
  }
  PsiElement parent = this;

  while (parent instanceof ASTDelegatePsiElement) {
    parent = parent.getParent();
  }

  if (parent == null) {
    throw new PsiInvalidElementAccessException(this);
  }

  return (PsiManagerEx)parent.getManager();
}
 
Example 2
Source File: TreeElement.java    From consulo with Apache License 2.0 6 votes vote down vote up
public PsiManagerEx getManager() {
  Project project = ProjectCoreUtil.theOnlyOpenProject();
  if (project != null) {
    return PsiManagerEx.getInstanceEx(project);
  }
  TreeElement element;
  CompositeElement parent;
  for (element = this; (parent = element.getTreeParent()) != null; element = parent) {
  }
  if (element instanceof FileElement) { //TODO!!
    return element.getManager();
  }
  parent = getTreeParent();
  if (parent != null) {
    return parent.getManager();
  }
  return null;
}
 
Example 3
Source File: StubBasedPsiElementBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public PsiManagerEx getManager() {
  Project project = ProjectCoreUtil.theOnlyOpenProject();
  if (project != null) {
    return PsiManagerEx.getInstanceEx(project);
  }
  return (PsiManagerEx)getContainingFile().getManager();
}