use of com.intellij.psi.impl.PsiManagerEx in project intellij-community by JetBrains.
the class PyMultiFileResolveTestCase method doResolve.
protected PsiElement doResolve(PsiFile psiFile) {
final PsiReference ref = PyResolveTestCase.findReferenceByMarker(psiFile);
final PsiManagerEx psiManager = (PsiManagerEx) myFixture.getPsiManager();
psiManager.setAssertOnFileLoadingFilter(new VirtualFileFilter() {
@Override
public boolean accept(VirtualFile file) {
FileType fileType = file.getFileType();
return fileType == PythonFileType.INSTANCE;
}
}, myFixture.getTestRootDisposable());
final PsiElement result;
if (ref instanceof PsiPolyVariantReference) {
final ResolveResult[] resolveResults = ((PsiPolyVariantReference) ref).multiResolve(false);
result = resolveResults.length == 0 || !resolveResults[0].isValidResult() ? null : resolveResults[0].getElement();
} else {
result = ref.resolve();
}
psiManager.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myFixture.getTestRootDisposable());
return result;
}
use of com.intellij.psi.impl.PsiManagerEx in project intellij-community by JetBrains.
the class PyExpressionCodeFragmentImpl method clone.
protected PyExpressionCodeFragmentImpl clone() {
final PyExpressionCodeFragmentImpl clone = (PyExpressionCodeFragmentImpl) cloneImpl((FileElement) calcTreeElement().clone());
clone.myPhysical = false;
clone.myOriginalFile = this;
FileManager fileManager = ((PsiManagerEx) getManager()).getFileManager();
SingleRootFileViewProvider cloneViewProvider = (SingleRootFileViewProvider) fileManager.createFileViewProvider(new LightVirtualFile(getName(), getLanguage(), getText()), false);
cloneViewProvider.forceCachedPsi(clone);
clone.myViewProvider = cloneViewProvider;
return clone;
}
use of com.intellij.psi.impl.PsiManagerEx in project intellij-community by JetBrains.
the class DomStubTest method prepareFile.
protected XmlFile prepareFile(String path) {
VirtualFile virtualFile = myFixture.copyFileToProject(path);
assertNotNull(virtualFile);
XmlFile file = (XmlFile) ((PsiManagerEx) getPsiManager()).getFileManager().findFile(virtualFile);
assertFalse(file.getNode().isParsed());
ObjectStubTree tree = StubTreeLoader.getInstance().readOrBuild(getProject(), virtualFile, file);
assertNotNull("Can't build stubs for " + path, tree);
((PsiManagerImpl) getPsiManager()).cleanupForNextTest();
file = (XmlFile) getPsiManager().findFile(virtualFile);
assertNotNull(file);
return file;
}
use of com.intellij.psi.impl.PsiManagerEx in project intellij-community by JetBrains.
the class DomStubUsingTest method testFileLoading.
public void testFileLoading() {
XmlFile file = prepareFile("foo.xml");
((PsiManagerEx) getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myFixture.getTestRootDisposable());
DomFileElement<Foo> element = DomManager.getDomManager(getProject()).getFileElement(file, Foo.class);
assertNotNull(element);
GenericDomValue<String> id = element.getRootElement().getId();
assertEquals("foo", id.getValue());
}
use of com.intellij.psi.impl.PsiManagerEx in project intellij-community by JetBrains.
the class IpnbPyFragment method clone.
protected IpnbPyFragment clone() {
final IpnbPyFragment clone = (IpnbPyFragment) cloneImpl((FileElement) calcTreeElement().clone());
clone.myPhysical = false;
clone.myOriginalFile = this;
FileManager fileManager = ((PsiManagerEx) getManager()).getFileManager();
SingleRootFileViewProvider cloneViewProvider = (SingleRootFileViewProvider) fileManager.createFileViewProvider(new LightVirtualFile(getName(), getLanguage(), getText()), false);
cloneViewProvider.forceCachedPsi(clone);
clone.myViewProvider = cloneViewProvider;
return clone;
}
Aggregations