use of com.intellij.psi.SingleRootFileViewProvider 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.SingleRootFileViewProvider in project intellij-plugins by JetBrains.
the class DartExpressionCodeFragmentImpl method clone.
protected DartExpressionCodeFragmentImpl clone() {
final DartExpressionCodeFragmentImpl clone = (DartExpressionCodeFragmentImpl) cloneImpl((FileElement) calcTreeElement().clone());
clone.myPhysical = false;
clone.myOriginalFile = this;
final FileManager fileManager = ((PsiManagerEx) getManager()).getFileManager();
final SingleRootFileViewProvider cloneViewProvider = (SingleRootFileViewProvider) fileManager.createFileViewProvider(new LightVirtualFile(getName(), getLanguage(), getText()), false);
clone.myViewProvider = cloneViewProvider;
cloneViewProvider.forceCachedPsi(clone);
clone.init(getContentElementType(), getContentElementType());
return clone;
}
use of com.intellij.psi.SingleRootFileViewProvider in project intellij-community by JetBrains.
the class TemplateDataElementType method createPsiFileFromSource.
protected PsiFile createPsiFileFromSource(final Language language, CharSequence sourceCode, PsiManager manager) {
@NonNls final LightVirtualFile virtualFile = new LightVirtualFile("foo", createTemplateFakeFileType(language), sourceCode, LocalTimeCounter.currentTime());
FileViewProvider viewProvider = new SingleRootFileViewProvider(manager, virtualFile, false) {
@Override
@NotNull
public Language getBaseLanguage() {
return language;
}
};
// Since we're already inside a template language PSI that was built regardless of the file size (for whatever reason),
// there should also be no file size checks for template data files.
SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile);
return viewProvider.getPsi(language);
}
use of com.intellij.psi.SingleRootFileViewProvider in project intellij-community by JetBrains.
the class JavaParsingTestCase method createPsiFile.
private PsiFile createPsiFile(final String name, final String text, final TestParser parser) {
if (TEST_FILE_ELEMENT_TYPE == null) {
TEST_FILE_ELEMENT_TYPE = new MyIFileElementType();
}
TEST_PARSER = parser;
final LightVirtualFile virtualFile = new LightVirtualFile(name + '.' + myFileExt, StdFileTypes.JAVA, text, -1);
final FileViewProvider viewProvider = new SingleRootFileViewProvider(PsiManager.getInstance(getProject()), virtualFile, true);
return new PsiJavaFileImpl(viewProvider) {
@NotNull
@Override
protected FileElement createFileElement(@NotNull final CharSequence text) {
return new FileElement(TEST_FILE_ELEMENT_TYPE, text);
}
};
}
Aggregations