本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
};
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
示例15: getOutputFileTypes
import com.intellij.ide.highlighter.JavaClassFileType; //导入依赖的package包/类
@NotNull
@Override
public FileType[] getOutputFileTypes()
{
return new FileType[]{
JavaFileType.INSTANCE,
JavaClassFileType.INSTANCE
};
}