public @NotNull JPanel createPanel() {
    CommonActionsPanel.Buttons[] buttons = getButtons();
    JComponent contextComponent = getComponent();
    UIUtil.putClientProperty(contextComponent, JBViewport.FORCE_VISIBLE_ROW_COUNT_KEY, true);
    myActionsPanel = new CommonActionsPanel(this, contextComponent,
                                            myToolbarPosition,
                                            myExtraActions.toArray(AnAction.EMPTY_ARRAY),
                                            myButtonComparator,
                                            myAddName, myRemoveName, myMoveUpName, myMoveDownName, myEditName,
                                            myAddIcon, buttons);
    JScrollPane scrollPane = null;
    if (contextComponent instanceof JTree || contextComponent instanceof JTable || contextComponent instanceof JList) {
      // add scroll pane to supported components only
      scrollPane = new JBScrollPane(contextComponent) {
        @Override
        public Dimension getPreferredSize() {
          Dimension preferredSize = super.getPreferredSize();
          Dimension preferredViewportSize = ((Scrollable)contextComponent).getPreferredScrollableViewportSize();
          if (!isPreferredSizeSet() && preferredViewportSize == null) {
            setPreferredSize(new Dimension(0, preferredSize.height));
          }
          return preferredSize;
        }
      };
      scrollPane.setBorder(JBUI.Borders.empty());
      scrollPane.setViewportBorder(JBUI.Borders.empty());
      if (myPreferredSize != null) {
        scrollPane.setPreferredSize(myPreferredSize);
      }
      if (myMinimumSize != null) {
        scrollPane.setMinimumSize(myMinimumSize);
      }
    }
    JPanel panel = new JPanel(new BorderLayout()) {
      @Override
      public void addNotify() {
        super.addNotify();
        updateButtons();
      }

      @Override
      public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        contextComponent.setEnabled(enabled);
      }
    };
    panel.add(scrollPane != null ? scrollPane : contextComponent, BorderLayout.CENTER);
    panel.add(myActionsPanel, getPlacement(myToolbarPosition));
    installUpdaters();
    updateButtons();
    installDnD();
    panel.putClientProperty(DECORATOR_KEY, Boolean.TRUE);
    panel.putClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY, myActionsPanel.getComponent(0));
    panel.putClientProperty(DslComponentProperty.LABEL_FOR, contextComponent);
    panel.putClientProperty(DslComponentProperty.VERTICAL_COMPONENT_GAP, new VerticalComponentGap(true, true));
    panel.putClientProperty(DslComponentProperty.VISUAL_PADDINGS, UnscaledGaps.EMPTY);

    panel.setBorder(myPanelBorder != null ? myPanelBorder : IdeBorderFactory.createBorder(SideBorder.ALL));
    Border scrollPaneBorder = null;
    if (scrollPane != null && (myScrollPaneBorder != null || myPanelBorder instanceof EmptyBorder)) {
      // if the panel border is empty, the scrollpane shall get one anyway
      scrollPaneBorder = myScrollPaneBorder != null ? myScrollPaneBorder : IdeBorderFactory.createBorder(SideBorder.ALL);
      scrollPane.setBorder(scrollPaneBorder);
    }
    if ((myToolbarBorder == null || myToolbarBorder instanceof EmptyBorder) &&
        scrollPaneBorder == null || scrollPaneBorder instanceof EmptyBorder) {
      myToolbarBorder = new CustomLineBorder(
        myToolbarPosition == ActionToolbarPosition.BOTTOM ? 1 : 0,
        myToolbarPosition == ActionToolbarPosition.RIGHT ? 1 : 0,
        myToolbarPosition == ActionToolbarPosition.TOP ? 1 : 0,
        myToolbarPosition == ActionToolbarPosition.LEFT ? 1 : 0);
    }
    myActionsPanel.setBorder(myToolbarBorder != null ? myToolbarBorder : JBUI.Borders.empty());
    return panel;
  }
public @NotNull JPanel createPanel()