Search in sources :

Example 1 with FileManager

use of com.intellij.psi.impl.file.impl.FileManager 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;
}
Also used : LightVirtualFile(com.intellij.testFramework.LightVirtualFile) FileElement(com.intellij.psi.impl.source.tree.FileElement) SingleRootFileViewProvider(com.intellij.psi.SingleRootFileViewProvider) FileManager(com.intellij.psi.impl.file.impl.FileManager) PsiManagerEx(com.intellij.psi.impl.PsiManagerEx)

Example 2 with FileManager

use of com.intellij.psi.impl.file.impl.FileManager 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;
}
Also used : LightVirtualFile(com.intellij.testFramework.LightVirtualFile) FileElement(com.intellij.psi.impl.source.tree.FileElement) FileManager(com.intellij.psi.impl.file.impl.FileManager) PsiManagerEx(com.intellij.psi.impl.PsiManagerEx)

Example 3 with FileManager

use of com.intellij.psi.impl.file.impl.FileManager in project intellij-community by JetBrains.

the class SingleRootFileViewProvider method getPsi.

@Override
@Nullable
public final PsiFile getPsi(@NotNull Language target) {
    if (!isPhysical()) {
        FileManager fileManager = ((PsiManagerEx) myManager).getFileManager();
        VirtualFile virtualFile = getVirtualFile();
        if (fileManager.findCachedViewProvider(virtualFile) == null) {
            fileManager.setViewProvider(virtualFile, this);
        }
    }
    return getPsiInner(target);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LightVirtualFile(com.intellij.testFramework.LightVirtualFile) FileManager(com.intellij.psi.impl.file.impl.FileManager) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with FileManager

use of com.intellij.psi.impl.file.impl.FileManager in project intellij-community by JetBrains.

the class PsiManagerImpl method dropResolveCaches.

@Override
public void dropResolveCaches() {
    FileManager fileManager = myFileManager;
    if (fileManager instanceof FileManagerImpl) {
        // mock tests
        ((FileManagerImpl) fileManager).processQueue();
    }
    beforeChange(true);
    beforeChange(false);
}
Also used : FileManager(com.intellij.psi.impl.file.impl.FileManager) FileManagerImpl(com.intellij.psi.impl.file.impl.FileManagerImpl)

Example 5 with FileManager

use of com.intellij.psi.impl.file.impl.FileManager in project intellij-community by JetBrains.

the class GroovyCodeFragment method clone.

@Override
protected GroovyCodeFragment clone() {
    final GroovyCodeFragment clone = (GroovyCodeFragment) cloneImpl((FileElement) calcTreeElement().clone());
    clone.myOriginalFile = this;
    clone.myPseudoImports.putAll(myPseudoImports);
    FileManager fileManager = ((PsiManagerEx) getManager()).getFileManager();
    SingleRootFileViewProvider cloneViewProvider = (SingleRootFileViewProvider) fileManager.createFileViewProvider(new LightVirtualFile(getName(), getLanguage(), getText()), false);
    cloneViewProvider.forceCachedPsi(clone);
    clone.myViewProvider = cloneViewProvider;
    return clone;
}
Also used : LightVirtualFile(com.intellij.testFramework.LightVirtualFile) FileElement(com.intellij.psi.impl.source.tree.FileElement) FileManager(com.intellij.psi.impl.file.impl.FileManager) PsiManagerEx(com.intellij.psi.impl.PsiManagerEx)

Aggregations

FileManager (com.intellij.psi.impl.file.impl.FileManager)10 PsiManagerEx (com.intellij.psi.impl.PsiManagerEx)8 LightVirtualFile (com.intellij.testFramework.LightVirtualFile)8 FileElement (com.intellij.psi.impl.source.tree.FileElement)5 Document (com.intellij.openapi.editor.Document)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 SingleRootFileViewProvider (com.intellij.psi.SingleRootFileViewProvider)2 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)1 ASTNode (com.intellij.lang.ASTNode)1 Disposable (com.intellij.openapi.Disposable)1 EditorSettings (com.intellij.openapi.editor.EditorSettings)1 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 DocumentImpl (com.intellij.openapi.editor.impl.DocumentImpl)1 EditorFactoryImpl (com.intellij.openapi.editor.impl.EditorFactoryImpl)1 Project (com.intellij.openapi.project.Project)1 PsiFile (com.intellij.psi.PsiFile)1 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)1 FileManagerImpl (com.intellij.psi.impl.file.impl.FileManagerImpl)1 Nullable (org.jetbrains.annotations.Nullable)1 Test (org.junit.Test)1