Java 类com.intellij.openapi.fileTypes.impl.FileTypeRenderer 实例源码

项目:intellij-ce-playground    文件:CreateTaskFileDialog.java   
@Nullable
@Override
protected JComponent createCenterPanel() {
  myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myList.setCellRenderer(new FileTypeRenderer());

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      doOKAction();
      return true;
    }
  }.installOn(myList);

  CCLanguageManager manager = CCUtils.getStudyLanguageManager(myCourse);
  if (manager != null) {
    String extension = manager.getDefaultTaskFileExtension();
    ScrollingUtil.selectItem(myList, FileTypeManager.getInstance().getFileTypeByExtension(extension != null ? extension : "txt"));
  }
  return myPanel;
}
项目:consulo    文件:FileTypeChooser.java   
@Override
protected JComponent createCenterPanel() {
  myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName));

  myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myList.setCellRenderer(new FileTypeRenderer());

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      doOKAction();
      return true;
    }
  }.installOn(myList);

  myList.getSelectionModel().addListSelectionListener(e -> updateButtonsState());

  ScrollingUtil.selectItem(myList, PlainTextFileType.INSTANCE);

  return myPanel;
}