本文整理汇总了Java中com.intellij.psi.SingleRootFileViewProvider类的典型用法代码示例。如果您正苦于以下问题:Java SingleRootFileViewProvider类的具体用法?Java SingleRootFileViewProvider怎么用?Java SingleRootFileViewProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SingleRootFileViewProvider类属于com.intellij.psi包,在下文中一共展示了SingleRootFileViewProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldInspect
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
@Override
public boolean shouldInspect(@NotNull PsiElement psiRoot) {
if (ApplicationManager.getApplication().isUnitTestMode()) return true;
final FileHighlightingSetting settingForRoot = getHighlightingSettingForRoot(psiRoot);
if (settingForRoot == FileHighlightingSetting.SKIP_HIGHLIGHTING ||
settingForRoot == FileHighlightingSetting.SKIP_INSPECTION) {
return false;
}
final Project project = psiRoot.getProject();
final VirtualFile virtualFile = psiRoot.getContainingFile().getVirtualFile();
if (virtualFile == null || !virtualFile.isValid()) return false;
if (ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (ProjectScope.getLibrariesScope(project).contains(virtualFile) && !fileIndex.isInContent(virtualFile)) return false;
return !SingleRootFileViewProvider.isTooLargeForIntelligence(virtualFile);
}
示例2: shouldInspect
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public static boolean shouldInspect(@NotNull PsiElement psiRoot) {
if (ApplicationManager.getApplication().isUnitTestMode()) return true;
if (!shouldHighlight(psiRoot)) return false;
final Project project = psiRoot.getProject();
final VirtualFile virtualFile = psiRoot.getContainingFile().getVirtualFile();
if (virtualFile == null || !virtualFile.isValid()) return false;
if (ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (ProjectScope.getLibrariesScope(project).contains(virtualFile) && !fileIndex.isInContent(virtualFile)) return false;
if (SingleRootFileViewProvider.isTooLargeForIntelligence(virtualFile)) return false;
final HighlightingSettingsPerFile component = HighlightingSettingsPerFile.getInstance(project);
if (component == null) return true;
final FileHighlightingSetting settingForRoot = component.getHighlightingSettingForRoot(psiRoot);
return settingForRoot != FileHighlightingSetting.SKIP_INSPECTION;
}
示例3: createExpressionFragment
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
@NotNull
public static CSharpFragmentFileImpl createExpressionFragment(Project project, String text, @Nullable final PsiElement context)
{
LightVirtualFile virtualFile = new LightVirtualFile("dummy.cs", CSharpFileType.INSTANCE, text, System.currentTimeMillis());
SingleRootFileViewProvider viewProvider = new SingleRootFileViewProvider(PsiManager.getInstance(project), virtualFile, true)
{
@NotNull
@Override
public SingleRootFileViewProvider createCopy(@NotNull final VirtualFile copy)
{
SingleRootFileViewProvider provider = new SingleRootFileViewProvider(getManager(), copy, false);
CSharpFragmentFileImpl psiFile = new CSharpFragmentFileImpl(ourExpressionFileElementType, ourExpressionFileElementType, provider, context);
provider.forceCachedPsi(psiFile);
psiFile.getNode();
return provider;
}
};
CSharpFragmentFileImpl file = new CSharpFragmentFileImpl(ourExpressionFileElementType, ourExpressionFileElementType, viewProvider, context);
viewProvider.forceCachedPsi(file);
file.getNode();
return file;
}
示例4: HaxeExpressionCodeFragmentImpl
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public HaxeExpressionCodeFragmentImpl(Project project,
@NonNls String name,
CharSequence text,
boolean isPhysical) {
super(new SingleRootFileViewProvider(PsiManager.getInstance(project),
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text),
isPhysical) {
@Override
public boolean supportsIncrementalReparse(@NotNull Language rootLanguage) {
return false;
}
});
myPhysical = isPhysical;
((SingleRootFileViewProvider)getViewProvider()).forceCachedPsi(this);
final MyHaxeFileElementType type = new MyHaxeFileElementType();
init(type, type);
}
示例5: HaxeExpressionCodeFragmentImpl
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public HaxeExpressionCodeFragmentImpl(Project project, @NonNls String name, CharSequence text, boolean isPhysical)
{
super(new SingleRootFileViewProvider(PsiManager.getInstance(project), new LightVirtualFile(name,
FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
{
@Override
public boolean supportsIncrementalReparse(@NotNull Language rootLanguage)
{
return false;
}
});
myPhysical = isPhysical;
((SingleRootFileViewProvider) getViewProvider()).forceCachedPsi(this);
final MyHaxeFileElementType type = new MyHaxeFileElementType();
init(type, type);
}
示例6: shouldInspect
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
@Override
public boolean shouldInspect(@Nonnull PsiElement psiRoot) {
if (ApplicationManager.getApplication().isUnitTestMode()) return true;
if (!shouldHighlight(psiRoot)) return false;
final Project project = psiRoot.getProject();
final VirtualFile virtualFile = psiRoot.getContainingFile().getVirtualFile();
if (virtualFile == null || !virtualFile.isValid()) return false;
if (ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (ProjectScope.getLibrariesScope(project).contains(virtualFile) && !fileIndex.isInContent(virtualFile)) return false;
if (SingleRootFileViewProvider.isTooLargeForIntelligence(virtualFile)) return false;
final FileHighlightingSetting settingForRoot = getHighlightingSettingForRoot(psiRoot);
return settingForRoot != FileHighlightingSetting.SKIP_INSPECTION;
}
示例7: shouldInspect
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public static boolean shouldInspect(@Nonnull PsiElement psiRoot) {
if (ApplicationManager.getApplication().isUnitTestMode()) return true;
if (!shouldHighlight(psiRoot)) return false;
final Project project = psiRoot.getProject();
final VirtualFile virtualFile = psiRoot.getContainingFile().getVirtualFile();
if (virtualFile == null || !virtualFile.isValid()) return false;
if (ProjectCoreUtil.isProjectOrWorkspaceFile(virtualFile)) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (ProjectScope.getLibrariesScope(project).contains(virtualFile) && !fileIndex.isInContent(virtualFile)) return false;
if (SingleRootFileViewProvider.isTooLargeForIntelligence(virtualFile)) return false;
final HighlightingSettingsPerFile component = HighlightingSettingsPerFile.getInstance(project);
if (component == null) return true;
final FileHighlightingSetting settingForRoot = component.getHighlightingSettingForRoot(psiRoot);
return settingForRoot != FileHighlightingSetting.SKIP_INSPECTION;
}
示例8: createPsiFileFromSource
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
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
@Nonnull
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);
}
示例9: LuaCodeFragment
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public LuaCodeFragment(Project project,
IElementType contentElementType,
boolean isPhysical,
@NonNls String name,
CharSequence text,
@Nullable PsiElement context) {
super(TokenType.CODE_FRAGMENT,
contentElementType,
PsiManagerEx.getInstanceEx(project).getFileManager().createFileViewProvider(
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
);
setContext(context);
((SingleRootFileViewProvider)getViewProvider()).forceCachedPsi(this);
}
示例10: isDetectable
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
private static boolean isDetectable(@NotNull final VirtualFile file) {
if (file.isDirectory() || !file.isValid() || file.is(VFileProperty.SPECIAL) || file.getLength() == 0) {
// for empty file there is still hope its type will change
return false;
}
return file.getFileSystem() instanceof FileSystemInterface && !SingleRootFileViewProvider.isTooLargeForContentLoading(file);
}
示例11: PyExpressionCodeFragmentImpl
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public PyExpressionCodeFragmentImpl(Project project, @NonNls String name, CharSequence text, boolean isPhysical) {
super(((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
new LightVirtualFile(name, FileTypeManager.getInstance().getFileTypeByFileName(name), text), isPhysical)
);
myPhysical = isPhysical;
((SingleRootFileViewProvider)getViewProvider()).forceCachedPsi(this);
}
示例12: PyExpressionCodeFragment
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
public PyExpressionCodeFragment(@NotNull final Project project,
@NonNls final String name,
@NotNull final CharSequence text) {
super(((PsiManagerEx)PsiManager.getInstance(project)).getFileManager().createFileViewProvider(
new LightVirtualFile(name, PythonFileType.INSTANCE, text), true));
((SingleRootFileViewProvider)getViewProvider()).forceCachedPsi(this);
}
示例13: accept
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
if (file.isDirectory() || !file.isValid()) {
return false;
}
if (SingleRootFileViewProvider.isTooLargeForContentLoading(file)) {
return false;
}
final FileType ft = file.getFileType();
return !ft.isBinary() || BinaryFileTypeDecompilers.INSTANCE.forFileType(ft) != null;
}
示例14: createFromText
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
protected PsiFile createFromText(final Language language, CharSequence text, PsiManager manager) {
@NonNls
final LightVirtualFile virtualFile = new LightVirtualFile("foo", createTemplateFakeFileType(language), text, LocalTimeCounter.currentTime());
FileViewProvider viewProvider = new SingleRootFileViewProvider(manager, virtualFile, false) {
@Override
@NotNull
public Language getBaseLanguage() {
return language;
}
};
return viewProvider.getPsi(language);
}
示例15: transform
import com.intellij.psi.SingleRootFileViewProvider; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public PsiFile transform(String fileName, @NotNull MsilFile msilFile)
{
DotNetNamedElement[] members = msilFile.getMembers();
StringBuilder builder = new StringBuilder();
for(DotNetNamedElement member : members)
{
JavaClassStubBuilder build = StubBuilder.build((DotNetTypeDeclaration) member);
if(build == null)
{
continue;
}
build.buildToText(builder, null);
builder.append("\n");
}
VirtualFile virtualFile = new MsilFileRepresentationVirtualFile(fileName, JavaFileType.INSTANCE, builder);
SingleRootFileViewProvider viewProvider = new SingleRootFileViewProvider(PsiManager.getInstance(msilFile.getProject()), virtualFile, true);
final PsiJavaFileImpl file = new PsiJavaFileImpl(viewProvider);
viewProvider.forceCachedPsi(file);
((PsiManagerEx) PsiManager.getInstance(msilFile.getProject())).getFileManager().setViewProvider(virtualFile, viewProvider);
new WriteCommandAction.Simple<Object>(file.getProject(), file)
{
@Override
protected void run() throws Throwable
{
CodeStyleManager.getInstance(getProject()).reformat(file);
}
}.execute();
return file;
}