当前位置: 首页>>代码示例>>Java>>正文


Java SingleRootFileViewProvider类代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HighlightingSettingsPerFile.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:HighlightLevelUtil.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:23,代码来源:CSharpFragmentFactory.java

示例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);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:19,代码来源:HaxeExpressionCodeFragmentImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:18,代码来源:HaxeExpressionCodeFragmentImpl.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:HighlightingSettingsPerFile.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:HighlightLevelUtil.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:TemplateDataElementType.java

示例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);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:15,代码来源:LuaCodeFragment.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FileTypeManagerImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyExpressionCodeFragmentImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyExpressionCodeFragment.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:TextEditorProvider.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:TemplateDataElementType.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:39,代码来源:JavaRepresentationProvider.java


注:本文中的com.intellij.psi.SingleRootFileViewProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。