public void actionPerformed(final ActionEvent e) {
   if (myPressedWhenSelected) {
     myDecorator.fireHidden();
   } else {
     myDecorator.fireActivated();
   }
   myPressedWhenSelected = false;
 }
  protected void processMouseEvent(final MouseEvent e) {
    if (e.isPopupTrigger() && e.getComponent().isShowing()) {
      super.processMouseEvent(e);
      return;
    }

    if (UIUtil.isCloseClick(e)) {
      myDecorator.fireHiddenSide();
      return;
    }

    if (e.getButton() == MouseEvent.BUTTON1) {
      if (MouseEvent.MOUSE_PRESSED == e.getID()) {
        myPressedPoint = e.getPoint();
        myPressedWhenSelected = isSelected();
        myDragCancelled = false;
      } else if (MouseEvent.MOUSE_RELEASED == e.getID()) {
        finishDragging();
        myPressedPoint = null;
        myDragButtonImage = null;
      }
    }

    super.processMouseEvent(e);
  }
 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);
          }
        });
  }
 WindowInfoImpl getWindowInfo() {
   return myDecorator.getWindowInfo();
 }
 private void showPopup(final Component component, final int x, final int y) {
   final ActionGroup group = myDecorator.createPopupGroup();
   final ActionPopupMenu popupMenu =
       ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
   popupMenu.getComponent().show(component, x, y);
 }
 void dispose() {
   myDecorator.getToolWindow().removePropertyChangeListener(myToolWindowHandler);
 }