Java 类com.intellij.psi.stubs.BinaryFileStubBuilders 实例源码

项目:tools-idea    文件:JavaCoreApplicationEnvironment.java   
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());
}
项目:consulo-java    文件:JavaCoreApplicationEnvironment.java   
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());
}
项目:intellij-ce-playground    文件:JavaCoreApplicationEnvironment.java   
public JavaCoreApplicationEnvironment(@NotNull Disposable parentDisposable) {
  super(parentDisposable);

  registerFileType(JavaClassFileType.INSTANCE, "class");
  registerFileType(JavaFileType.INSTANCE, "java");
  registerFileType(ArchiveFileType.INSTANCE, "jar;zip");
  registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess");

  addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory());
  addExplicitExtension(LanguageParserDefinitions.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextParserDefinition());

  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());

  addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider());

  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());

  registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase());
  addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() {
    @Override
    protected boolean shouldShowExplicitLambdaType(PsiAnonymousClass anonymousClass, PsiNewExpression expression) {
      return false;
    }

    @Override
    protected boolean isBelowRightMargin(Project project, int lineLength) {
      return false;
    }
  });

  registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class);
  addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher());
}
项目:tools-idea    文件:CoreApplicationEnvironment.java   
public CoreApplicationEnvironment(Disposable parentDisposable) {
  myParentDisposable = parentDisposable;
  Extensions.cleanRootArea(myParentDisposable);

  myFileTypeRegistry = new CoreFileTypeRegistry();
  myEncodingRegistry = new CoreEncodingRegistry();

  myApplication = createApplication(myParentDisposable);
  ApplicationManager.setApplication(myApplication,
                                    new StaticGetter<FileTypeRegistry>(myFileTypeRegistry),
                                    new StaticGetter<EncodingRegistry>(myEncodingRegistry),
                                    myParentDisposable);
  myLocalFileSystem = createLocalFileSystem();
  myJarFileSystem = createJarFileSystem();

  Extensions.registerAreaClass(ExtensionAreas.IDEA_PROJECT, null);

  final MutablePicoContainer appContainer = myApplication.getPicoContainer();
  registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
    @Override
    public Document fun(CharSequence charSequence) {
      return new DocumentImpl(charSequence);
    }
  }, null));

  VirtualFileSystem[] fs = {myLocalFileSystem, myJarFileSystem};
  VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(fs, new MessageBusImpl(myApplication, null));
  registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager);

  registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager());
  myApplication.registerService(DefaultASTFactory.class, new CoreASTFactory());
  myApplication.registerService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
  myApplication.registerService(ReferenceProvidersRegistry.class, new MockReferenceProvidersRegistry());
  myApplication.registerService(StubTreeLoader.class, new CoreStubTreeLoader());
  myApplication.registerService(PsiReferenceService.class, new PsiReferenceServiceImpl());
  myApplication.registerService(MetaDataRegistrar.class, new MetaRegistry());

  registerApplicationExtensionPoint(ContentBasedFileSubstitutor.EP_NAME, ContentBasedFileSubstitutor.class);
  registerExtensionPoint(Extensions.getRootArea(), BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class);
  registerExtensionPoint(Extensions.getRootArea(), FileContextProvider.EP_NAME, FileContextProvider.class);

  registerApplicationExtensionPoint(MetaDataContributor.EP_NAME, MetaDataContributor.class);

  ProgressIndicatorProvider.ourInstance = createProgressIndicatorProvider();

  myApplication.registerService(JobLauncher.class, createJobLauncher());
}
项目:buck    文件:BuckFileUtil.java   
public static void setBuckFileType() {
  ApplicationManager.getApplication()
      .runWriteAction(
          new Runnable() {
            @Override
            public void run() {
              FileTypeManager fileTypeManager = FileTypeManagerImpl.getInstance();

              FileType fileType =
                  fileTypeManager.getFileTypeByFileName(
                      BuckFileType.INSTANCE.getDefaultExtension());

              // Remove all FileType associations for BUCK files that are not BuckFileType
              while (!(fileType instanceof BuckFileType || fileType instanceof UnknownFileType)) {
                List<FileNameMatcher> fileNameMatchers =
                    fileTypeManager.getAssociations(fileType);

                for (FileNameMatcher fileNameMatcher : fileNameMatchers) {
                  if (fileNameMatcher.accept(BuckFileType.INSTANCE.getDefaultExtension())) {
                    fileTypeManager.removeAssociation(fileType, fileNameMatcher);
                  }
                }

                fileType =
                    fileTypeManager.getFileTypeByFileName(
                        BuckFileType.INSTANCE.getDefaultExtension());
              }

              // Use a simple BinaryFileStubBuilder, that doesn't offer stubbing
              BinaryFileStubBuilders.INSTANCE.addExplicitExtension(
                  fileType,
                  new BinaryFileStubBuilder() {
                    @Override
                    public boolean acceptsFile(VirtualFile virtualFile) {
                      return false;
                    }

                    @Nullable
                    @Override
                    public Stub buildStubTree(FileContent fileContent) {
                      return null;
                    }

                    @Override
                    public int getStubVersion() {
                      return 0;
                    }
                  });
            }
          });
}