Ejemplo n.º 1
0
 public void actionPerformed(final ActionEvent e) {
   if (myPressedWhenSelected) {
     myDecorator.fireHidden();
   } else {
     myDecorator.fireActivated();
   }
   myPressedWhenSelected = false;
 }
Ejemplo n.º 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);
  }
Ejemplo n.º 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());
 }
Ejemplo n.º 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);
          }
        });
  }
Ejemplo n.º 5
0
 WindowInfoImpl getWindowInfo() {
   return myDecorator.getWindowInfo();
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 7
0
 void dispose() {
   myDecorator.getToolWindow().removePropertyChangeListener(myToolWindowHandler);
 }