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


Java JavaClassFileType类代码示例

本文整理汇总了Java中com.intellij.ide.highlighter.JavaClassFileType的典型用法代码示例。如果您正苦于以下问题:Java JavaClassFileType类的具体用法?Java JavaClassFileType怎么用?Java JavaClassFileType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaClassFileType类属于com.intellij.ide.highlighter包,在下文中一共展示了JavaClassFileType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contains

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Override
public boolean contains(@NotNull final VirtualFile file) {
  if (!super.contains(file)) {
    return false;
  }

  if (myIndex == null) {
    return false;
  }

  if (JavaClassFileType.INSTANCE == file.getFileType()) {
    return myIndex.isInLibraryClasses(file);
  }

  return myIndex.isInSourceContent(file) ||
         myBaseScope.isForceSearchingInLibrarySources() && myIndex.isInLibrarySource(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaSourceFilterScope.java

示例2: create

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
/**
 * SyntaxHighlighterProvider implementation (for .class files).
 */
@Nullable
@Override
public SyntaxHighlighter create(@NotNull FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
  if (project != null && file != null) {
    PsiFile psiFile = PsiManager.getInstance(project).findFile(file);

    if (fileType == JavaClassFileType.INSTANCE && psiFile != null) {
      Language language = psiFile.getLanguage();
      if (language != JavaLanguage.INSTANCE) {
        return SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, file);
      }
    }

    if (psiFile instanceof ClsFileImpl) {
      LanguageLevel sourceLevel = ((ClsFileImpl)psiFile).getLanguageLevel();
      return new JavaFileHighlighter(sourceLevel);
    }
  }

  return new JavaFileHighlighter();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaSyntaxHighlighterFactory.java

示例3: createNotificationPanel

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (file.getFileType() == JavaClassFileType.INSTANCE) return null;

  final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) {
    return null;
  }

  if (psiFile.getLanguage() != JavaLanguage.INSTANCE) {
    return null;
  }

  Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
  if (module == null) {
    return null;
  }

  Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk != null) {
    return null;
  }

  return createPanel(myProject, psiFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:SetupSDKNotificationProvider.java

示例4: createNotificationPanel

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Override
public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
  if (file.getFileType() == JavaClassFileType.INSTANCE) return null;

  final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) {
    return null;
  }

  if (psiFile.getLanguage() != JavaLanguage.INSTANCE) {
    return null;
  }

  if (ProjectRootManager.getInstance(myProject).getProjectSdk() != null) {
    return null;
  }

  return createPanel(myProject, psiFile);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:SetupSDKNotificationProvider.java

示例5: contains

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Override
public boolean contains(@NotNull final VirtualFile file)
{
	if(!super.contains(file))
	{
		return false;
	}

	if(myIndex == null)
	{
		return false;
	}

	if(file.getFileType() == JavaClassFileType.INSTANCE)
	{
		return myIndex.isInLibraryClasses(file);
	}

	return myIndex.isInSourceContent(file) || myBaseScope.isForceSearchingInLibrarySources() && myIndex.isInLibrarySource(file);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:JavaSourceFilterScope.java

示例6: hasAcceptablePackage

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
private boolean hasAcceptablePackage(@NotNull VirtualFile vFile)
{
	if(vFile.getFileType() == JavaClassFileType.INSTANCE)
	{
		// See IDEADEV-5626
		final VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile);
		VirtualFile parent = vFile.getParent();
		final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myManager.getProject());
		while(parent != null && !Comparing.equal(parent, root))
		{
			if(!nameHelper.isIdentifier(parent.getName()))
			{
				return false;
			}
			parent = parent.getParent();
		}
	}

	return true;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:JavaFileManagerImpl.java

示例7: processedFile

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
private static boolean processedFile(PsiElement element, IconDescriptor iconDescriptor)
{
	final PsiFile containingFile = element.getContainingFile();
	if(containingFile == null)
	{
		return false;
	}
	final FileType fileType = containingFile.getFileType();
	if(fileType != JavaFileType.INSTANCE && fileType != JavaClassFileType.INSTANCE)
	{
		return false;
	}

	final VirtualFile virtualFile = containingFile.getVirtualFile();
	if(virtualFile == null)
	{
		return false;
	}
	if(!JavaProjectRootsUtil.isJavaSourceFile(element.getProject(), virtualFile, true))
	{
		iconDescriptor.setMainIcon(JavaIcons.FileTypes.JavaOutsideSource);
		return true;
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:JavaIconDescriptorUpdater.java

示例8: getPsiFileInRoot

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Nullable
private PsiJavaFile getPsiFileInRoot(final VirtualFile dirFile)
{
	final VirtualFile[] children = dirFile.getChildren();
	for(VirtualFile child : children)
	{
		if(JavaClassFileType.INSTANCE.equals(child.getFileType()))
		{
			final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(child);
			if(psiFile instanceof PsiJavaFile)
			{
				return (PsiJavaFile) psiFile;
			}
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:JavaPsiImplementationHelperImpl.java

示例9: hasAcceptablePackage

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
private boolean hasAcceptablePackage(final VirtualFile vFile) {
  if (vFile.getFileType() == JavaClassFileType.INSTANCE) {
    // See IDEADEV-5626
    final VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile);
    VirtualFile parent = vFile.getParent();
    final PsiNameHelper nameHelper = PsiNameHelper.getInstance(myManager.getProject());
    while (parent != null && !Comparing.equal(parent, root)) {
      if (!nameHelper.isIdentifier(parent.getName())) return false;
      parent = parent.getParent();
    }
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaFileManagerImpl.java

示例10: getInputFilter

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@NotNull
@Override
public FileBasedIndex.InputFilter getInputFilter() {
  return new DefaultFileTypeSpecificInputFilter(JavaClassFileType.INSTANCE) {
    @Override
    public boolean acceptInput(@NotNull VirtualFile file) {
      return ourEnabled && super.acceptInput(file);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BytecodeAnalysisIndex.java

示例11: contains

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@Override
public boolean contains(final VirtualFile file) {
  if (!super.contains(file)) {
    return false;
  }

  if (JavaClassFileType.INSTANCE == file.getFileType()) {
    return myIndex.isInLibraryClasses(file);
  }

  if (myIndex.isInSourceContent(file)) {
    return true;
  }
  final Project project = getProject();

  if (project != null) {
    for (OrderEntry entry : myIndex.getOrderEntriesForFile(file)) {
      if (entry instanceof JdkOrderEntry) {
        final JdkOrderEntry jdkOrderEntry = (JdkOrderEntry)entry;

        for (SdkResolveScopeProvider provider : SdkResolveScopeProvider.EP_NAME.getExtensions()) {
          final GlobalSearchScope scope = provider.getScope(project, jdkOrderEntry);

          if (scope != null && scope.contains(file)) {
            return true;
          }
        }
      }
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:JavaSourceFilterScope.java

示例12: hasAcceptablePackage

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
private boolean hasAcceptablePackage(final VirtualFile vFile) {
  if (vFile.getFileType() == JavaClassFileType.INSTANCE) {
    // See IDEADEV-5626
    final VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile);
    VirtualFile parent = vFile.getParent();
    final PsiNameHelper nameHelper = JavaPsiFacade.getInstance(myManager.getProject()).getNameHelper();
    while (parent != null && !Comparing.equal(parent, root)) {
      if (!nameHelper.isIdentifier(parent.getName())) return false;
      parent = parent.getParent();
    }
  }

  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:JavaFileManagerBase.java

示例13: JavaCoreApplicationEnvironment

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
public JavaCoreApplicationEnvironment(Disposable parentDisposable) {
  super(parentDisposable);

  registerFileType(JavaClassFileType.INSTANCE, "class");
  registerFileType(JavaFileType.INSTANCE, "java");
  registerFileType(ArchiveFileType.INSTANCE, "jar;zip");

  addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE,  new ClassFileViewProviderFactory());
  addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder());
  
  addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new CoreJavaASTFactory());
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, JavaLanguage.INSTANCE, new JavaParserDefinition());
  addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator());

  registerExtensionPoint(Extensions.getRootArea(), ClsStubBuilderFactory.EP_NAME, ClsStubBuilderFactory.class);
  registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
  registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);
  addExtension(ClsStubBuilderFactory.EP_NAME, new DefaultClsStubBuilderFactory());

  myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());

  myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl());
  myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService());
  myApplication.registerService(JavaVersionService.class, new JavaVersionService());

  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiPackage.class, new PackagePresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:JavaCoreApplicationEnvironment.java

示例14: JavaCoreApplicationEnvironment

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
public JavaCoreApplicationEnvironment(Disposable parentDisposable) {
  super(parentDisposable);

  registerFileType(JavaClassFileType.INSTANCE, "class");
  registerFileType(JavaFileType.INSTANCE, "java");
  registerFileType(JarArchiveFileType.INSTANCE, "jar");

  addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE,  new ClassFileViewProviderFactory());
  addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder());

  addExplicitExtension(LanguageParserDefinitions.INSTANCE, JavaLanguage.INSTANCE, new JavaParserDefinition());
  addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator());

  registerExtensionPoint(Extensions.getRootArea(), PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class);
  registerExtensionPoint(Extensions.getRootArea(), JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class);

  myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper());

  myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl());
  myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService());
  myApplication.registerService(JavaVersionService.class, new JavaVersionService());

  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiJavaPackage.class, new PackagePresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider());
  addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:30,代码来源:JavaCoreApplicationEnvironment.java

示例15: getOutputFileTypes

import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@NotNull
@Override
public FileType[] getOutputFileTypes()
{
	return new FileType[]{
			JavaFileType.INSTANCE,
			JavaClassFileType.INSTANCE
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:AnnotationProcessingCompiler.java


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