private JPanel createControlPanel()

in src/org/jetbrains/plugins/ipnb/editor/IpnbFileEditor.java [123:157]


  private JPanel createControlPanel() {
    final JPanel controlPanel = new JPanel();
    controlPanel.setBackground(IpnbEditorUtil.getBackground());
    myCellTypeCombo = new ComboBox(ourCellTypes);

    final DefaultActionGroup toolbarGroup = new DefaultActionGroup();
    toolbarGroup.addAll(new IpnbRunCellAction(this), new IpnbInterruptKernelAction(this), new IpnbReloadKernelAction(this));
    toolbarGroup.add(new Separator());
    toolbarGroup.addAll(new IpnbMoveCellUpAction(this), new IpnbMoveCellDownAction(this));
    toolbarGroup.add(new IpnbAddCellBelowAction(this));

    myToolbar = createToolbar(toolbarGroup);
    controlPanel.add(myToolbar);

    myCellTypeCombo.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        final Object selectedItem = myCellTypeCombo.getSelectedItem();
        final IpnbEditablePanel selectedCellPanel = myIpnbFilePanel.getSelectedCellPanel();
        if (selectedCellPanel != null && selectedItem instanceof String) {
          updateCellType((String)selectedItem, selectedCellPanel);
        }
      }
    });
    controlPanel.add(myCellTypeCombo);

    final IpnbPanel selectedCellPanel = myIpnbFilePanel.getSelectedCellPanel();
    if (selectedCellPanel != null) {
      updateCellTypeCombo(selectedCellPanel);
    }

    final MatteBorder border = BorderFactory.createMatteBorder(0, 0, 1, 0, JBColor.GRAY);
    controlPanel.setBorder(border);
    return controlPanel;
  }