Пример #1
0
 public void actionPerformed(final ActionEvent e) {
   if (myPressedWhenSelected) {
     myDecorator.fireHidden();
   } else {
     myDecorator.fireActivated();
   }
   myPressedWhenSelected = false;
 }
Пример #2
0
  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);
  }
Пример #3
0
 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());
 }
Пример #4
0
  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);
          }
        });
  }
Пример #5
0
 WindowInfoImpl getWindowInfo() {
   return myDecorator.getWindowInfo();
 }
Пример #6
0
 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);
 }
Пример #7
0
 void dispose() {
   myDecorator.getToolWindow().removePropertyChangeListener(myToolWindowHandler);
 }