Java 类com.intellij.lang.PerFileMappings 实例源码

项目:intellij-ce-playground    文件:LanguagePerFileConfigurable.java   
protected LanguagePerFileConfigurable(@NotNull Project project, Class<T> valueClass, PerFileMappings<T> mappings, String caption, String treeTableTitle, String overrideQuestion, String overrideTitle) {
  myProject = project;
  myValueClass = valueClass;
  myMappings = mappings;
  myTreeTableTitle = treeTableTitle;
  myOverrideQuestion = overrideQuestion;
  myOverrideTitle = overrideTitle;
  myLabel.setText(caption);
}
项目:intellij-ce-playground    文件:LRUPopupBuilder.java   
@NotNull
public static ListPopup forFileLanguages(@NotNull Project project, @NotNull final Iterable<VirtualFile> files, @NotNull final PerFileMappings<Language> mappings) {
  return forFileLanguages(project, null, new Consumer<Language>() {
    @Override
    public void consume(Language t) {
      for (VirtualFile file : files) {
        mappings.setMapping(file, t);
      }
    }
  });
}
项目:idea-multimarkdown    文件:MultiMarkdownPreviewEditorProvider.java   
public static boolean accept(@NotNull final VirtualFile file) {
    String fileExt = file.getExtension();
    FileType fileType = file.getFileType();
    boolean doAccept = fileType instanceof MultiMarkdownFileType;

    if (!doAccept) {
        doAccept = MultiMarkdownGlobalSettings.getInstance().scratchFileServiceFailed.runBuild(new FailedBuildRunnable<Boolean>() {
            @Nullable @Override
            public Boolean runCanFail() throws Throwable {
                // Issue: #14 scratch files have to be matched differently
                ScratchFileService fileService = ScratchFileService.getInstance();
                PerFileMappings<Language> scratchesMapping = fileService.getScratchesMapping();
                Language language = scratchesMapping.getMapping(file);
                return language instanceof MultiMarkdownLanguage;

                //// Issue: #15 class not found ScratchFileService, so we take care of it through reflection
                //Class<?> ScratchFileService = Class.forName("com.intellij.ide.scratch.ScratchFileService");
                //Method getInstance = ScratchFileService.getMethod("getInstance");
                //Method getScratchesMapping = ScratchFileService.getMethod("getScratchesMapping");
                //Object fileService = getInstance.invoke(ScratchFileService);
                //PerFileMappings<Language> mappings = (PerFileMappings<Language>) getScratchesMapping.invoke(fileService);
                //Language language = mappings.getMapping(file);
                //return language instanceof MultiMarkdownLanguage;
            }

            @Nullable @Override public Boolean run() {
                return false;
            }
        });
    }
    return doAccept;
}
项目:tools-idea    文件:LanguagePerFileConfigurable.java   
protected LanguagePerFileConfigurable(@NotNull Project project, Class<T> valueClass, PerFileMappings<T> mappings, String caption, String treeTableTitle, String overrideQuestion, String overrideTitle) {
  myProject = project;
  myValueClass = valueClass;
  myMappings = mappings;
  myTreeTableTitle = treeTableTitle;
  myOverrideQuestion = overrideQuestion;
  myOverrideTitle = overrideTitle;
  myLabel.setText(caption);
}
项目:consulo    文件:LanguagePerFileConfigurable.java   
protected LanguagePerFileConfigurable(@Nonnull Project project, Class<T> valueClass, PerFileMappings<T> mappings, String caption, String treeTableTitle, String overrideQuestion, String overrideTitle) {
  myProject = project;
  myValueClass = valueClass;
  myMappings = mappings;
  myTreeTableTitle = treeTableTitle;
  myOverrideQuestion = overrideQuestion;
  myOverrideTitle = overrideTitle;
  myLabel.setText(caption);
}
项目:intellij-ce-playground    文件:ScratchFileService.java   
@NotNull
public abstract PerFileMappings<Language> getScratchesMapping();
项目:intellij-ce-playground    文件:ScratchFileActions.java   
protected void actionPerformedImpl(AnActionEvent e, Project project, JBIterable<VirtualFile> files) {
  ScratchFileService fileService = ScratchFileService.getInstance();
  PerFileMappings<Language> mapping = fileService.getScratchesMapping();
  LRUPopupBuilder.forFileLanguages(project, files, mapping).showInBestPositionFor(e.getDataContext());
}
项目:intellij-ce-playground    文件:ScratchFileServiceImpl.java   
@NotNull
@Override
public PerFileMappings<Language> getScratchesMapping() {
  return myScratchMapping;
}
项目:consulo    文件:ScratchFileService.java   
@Nonnull
public abstract PerFileMappings<Language> getScratchesMapping();
项目:consulo    文件:ScratchFileServiceImpl.java   
@Nonnull
@Override
public PerFileMappings<Language> getScratchesMapping() {
  return myScratchMapping;
}