Java 类com.intellij.openapi.editor.impl.EditorHeaderComponent 实例源码

项目:intellij-ce-playground    文件:GroovyConsoleRootType.java   
@Override
public void fileOpened(@NotNull final VirtualFile file, @NotNull FileEditorManager source) {
  final Project project = source.getProject();
  final GroovyConsoleStateService projectConsole = GroovyConsoleStateService.getInstance(project);

  for (FileEditor fileEditor : source.getAllEditors(file)) {
    if (!(fileEditor instanceof TextEditor)) continue;
    final Editor editor = ((TextEditor)fileEditor).getEditor();
    final JPanel panel = new EditorHeaderComponent();
    final DefaultActionGroup actionGroup = new DefaultActionGroup(EXECUTE_ACTION, new GrSelectModuleAction(projectConsole, file));
    final ActionToolbar menu = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, true);
    panel.add(menu.getComponent());
    editor.setHeaderComponent(panel);
    EXECUTE_ACTION.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, editor.getComponent());
  }
}
项目:intellij-ce-playground    文件:TraceViewPanel.java   
private void createUIComponents() {
  MouseAdapter l = new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
      if (e.getSource() == myCloseLabel) {
        closeSearchComponent();
      } else if (e.getSource() == mySearchLabel) {
        showSearchComponent();
      } else if (e.getSource() == myZoomFitLabel) {
        myTraceViewCanvas.zoomFit();
      }
    }
  };

  myDefaultHeaderPanel = new EditorHeaderComponent();
  mySearchLabel = new JLabel(AllIcons.Actions.Search);
  mySearchLabel.addMouseListener(l);
  mySearchLabel.setToolTipText("Find (Ctrl + F)");
  myZoomFitLabel = new JLabel(AndroidIcons.ZoomFit);
  myZoomFitLabel.setToolTipText("Zoom Fit");
  myZoomFitLabel.addMouseListener(l);

  myFindPanel = new EditorHeaderComponent();
  myFindFieldWrapper = new NonOpaquePanel(new BorderLayout());
  mySearchField = createSearchField();
  myFindFieldWrapper.add(mySearchField);

  myCloseLabel = new JLabel(AllIcons.Actions.Cross);
  myCloseLabel.addMouseListener(l);

  myVmStatsTreeTableModel = new VmStatsTreeTableModel();
  myTreeTable = new TreeTable(myVmStatsTreeTableModel);
  myTraceViewCanvas = new TraceViewCanvasWrapper();
  JBScrollPane scrollPane = new JBScrollPane(myTreeTable);

  mySplitter = new JBSplitter(true, 0.75f);
  mySplitter.setShowDividerControls(true);
  mySplitter.setShowDividerIcon(true);
  mySplitter.setFirstComponent(myTraceViewCanvas);
  mySplitter.setSecondComponent(scrollPane);
}