void updateState() {
   final ToolWindowImpl window = myDecorator.getToolWindow();
   final boolean toShow = window.isAvailable() || window.isPlaceholderMode();
   if (UISettings.getInstance().ALWAYS_SHOW_WINDOW_BUTTONS) {
     setVisible(true);
   } else {
     setVisible(toShow);
   }
   setEnabled(toShow && !window.isPlaceholderMode());
 }
  private void init() {
    setFocusable(false);
    setBackground(ourBackgroundColor);
    final Border border = BorderFactory.createEmptyBorder(5, 5, 0, 5);
    setBorder(border);
    updateText();
    updateState();
    apply(myDecorator.getWindowInfo());
    myDecorator.getToolWindow().addPropertyChangeListener(myToolWindowHandler);
    addActionListener(this);
    addMouseListener(new MyPopupHandler());
    setRolloverEnabled(true);
    setOpaque(false);

    enableEvents(MouseEvent.MOUSE_EVENT_MASK);

    addMouseMotionListener(
        new MouseMotionAdapter() {
          public void mouseDragged(final MouseEvent e) {
            processDrag(e);
          }
        });
  }
 void dispose() {
   myDecorator.getToolWindow().removePropertyChangeListener(myToolWindowHandler);
 }