Java 类com.intellij.util.ui.BaseButtonBehavior 实例源码

项目:intellij-ce-playground    文件:TabContentLayout.java   
TabContentLayout(ToolWindowContentUi ui) {
  super(ui);

  myPopupListener = new MyPopupListener();

  new BaseButtonBehavior(myUi) {
    protected void execute(final MouseEvent e) {
      if (!myUi.isCurrent(TabContentLayout.this)) return;

      if (myLastLayout != null) {
        final Rectangle moreRect = myLastLayout.moreRect;
        if (moreRect != null && moreRect.contains(e.getPoint())) {
          showPopup();
        }
      }
    }
  };
}
项目:intellij-ce-playground    文件:ContentTabLabel.java   
public ContentTabLabel(final Content content, TabContentLayout layout) {
  super(layout.myUi, true);
  myLayout = layout;
  myContent = content;
  update();

  myBehavior = new BaseButtonBehavior(this) {
    protected void execute(final MouseEvent e) {
      final ContentManager mgr = contentManager();
      if (mgr.getIndexOfContent(myContent) >= 0) {
        mgr.setSelectedContent(myContent, true);
      }
    }
  };
  myBehavior.setActionTrigger(MouseEvent.MOUSE_PRESSED);
  myBehavior.setMouseDeadzone(TimedDeadzone.NULL);
}
项目:tools-idea    文件:TabContentLayout.java   
TabContentLayout(ToolWindowContentUi ui) {
  super(ui);

  myPopupListener = new MyPopupListener();

  new BaseButtonBehavior(myUi) {
    protected void execute(final MouseEvent e) {
      if (!myUi.isCurrent(TabContentLayout.this)) return;

      if (myLastLayout != null) {
        final Rectangle moreRect = myLastLayout.moreRect;
        if (moreRect != null && moreRect.contains(e.getPoint())) {
          showPopup();
        }
      }
    }
  };
}
项目:tools-idea    文件:ContentTabLabel.java   
public ContentTabLabel(final Content content, TabContentLayout layout) {
  super(layout.myUi, true);
  myLayout = layout;
  myContent = content;
  update();

  myBehavior = new BaseButtonBehavior(this) {
    protected void execute(final MouseEvent e) {
      final ContentManager mgr = contentManager();
      if (mgr.getIndexOfContent(myContent) >= 0) {
        mgr.setSelectedContent(myContent, true);
      }
    }
  };
  myBehavior.setActionTrigger(MouseEvent.MOUSE_PRESSED);
  myBehavior.setMouseDeadzone(TimedDeadzone.NULL);
}
项目:consulo    文件:TabContentLayout.java   
TabContentLayout(DesktopToolWindowContentUi ui) {
  super(ui);

  myPopupListener = new MyPopupListener();

  new BaseButtonBehavior(myUi) {
    protected void execute(final MouseEvent e) {
      if (!myUi.isCurrent(TabContentLayout.this)) return;

      if (myLastLayout != null) {
        final Rectangle moreRect = myLastLayout.moreRect;
        if (moreRect != null && moreRect.contains(e.getPoint())) {
          showPopup();
        }
      }
    }
  };
}
项目:consulo    文件:ContentTabLabel.java   
public ContentTabLabel(final Content content, TabContentLayout layout) {
  super(layout.myUi, true);
  myLayout = layout;
  myContent = content;
  update();

  myBehavior = new BaseButtonBehavior(this) {
    protected void execute(final MouseEvent e) {
      final ContentManager mgr = contentManager();
      if (mgr.getIndexOfContent(myContent) >= 0) {
        mgr.setSelectedContent(myContent, true);
      }
    }
  };
  myBehavior.setActionTrigger(MouseEvent.MOUSE_PRESSED);
  myBehavior.setMouseDeadzone(TimedDeadzone.NULL);
}
项目:intellij-ce-playground    文件:ConfigurationErrorsComponent.java   
private ToolbarAlikeButton(@NotNull final Icon icon) {
  myIcon = icon;

  myBehavior = new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      onClick(e);
    }
  };

  setOpaque(false);
}
项目:intellij-ce-playground    文件:ActionMacroManager.java   
private Widget(StatusBar statusBar) {
  myStatusBar = statusBar;
  myPresentation = new WidgetPresentation() {
    @Override
    public String getTooltipText() {
      return "Macro is being recorded now";
    }

    @Override
    public Consumer<MouseEvent> getClickConsumer() {
      return Widget.this;
    }
  };


  new BaseButtonBehavior(myIcon) {
    @Override
    protected void execute(MouseEvent e) {
      showBalloon();
    }
  };

  myBalloonComponent = new NonOpaquePanel(new BorderLayout());

  final AnAction stopAction = ActionManager.getInstance().getAction("StartStopMacroRecording");
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(stopAction);
  final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.STATUS_BAR_PLACE, group, true);
  tb.setMiniMode(true);

  final NonOpaquePanel top = new NonOpaquePanel(new BorderLayout());
  top.add(tb.getComponent(), BorderLayout.WEST);
  myText = new JLabel(RECORDED + "..." + TYPING_SAMPLE, SwingConstants.LEFT);
  final Dimension preferredSize = myText.getPreferredSize();
  myText.setPreferredSize(preferredSize);
  myText.setText("Macro recording started...");
  myLastTyping = "";
  top.add(myText, BorderLayout.CENTER);
  myBalloonComponent.add(top, BorderLayout.CENTER);
}
项目:intellij-ce-playground    文件:ConfigurationErrorsPanel.java   
private ToolbarAlikeButton(@NotNull Icon icon) {
  myIcon = icon;

  myBehavior = new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      onClick(e);
    }
  };

  setOpaque(false);
}
项目:tools-idea    文件:ConfigurationErrorsComponent.java   
private ToolbarAlikeButton(@NotNull final Icon icon) {
  myIcon = icon;

  myBehavior = new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      onClick(e);
    }
  };

  setOpaque(false);
}
项目:tools-idea    文件:IdeStatusBarImpl.java   
private ToolWindowsWidget() {
  new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      performAction();
    }
  }.setActionTrigger(MouseEvent.MOUSE_PRESSED);

  UISettings.getInstance().addUISettingsListener(this, this);
  KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("focusOwner", this);
}
项目:tools-idea    文件:ActionMacroManager.java   
private Widget(StatusBar statusBar) {
  myStatusBar = statusBar;
  myPresentation = new WidgetPresentation() {
    @Override
    public String getTooltipText() {
      return "Macro is being recorded now";
    }

    @Override
    public Consumer<MouseEvent> getClickConsumer() {
      return Widget.this;
    }
  };


  new BaseButtonBehavior(myIcon) {
    @Override
    protected void execute(MouseEvent e) {
      showBalloon();
    }
  };

  myBalloonComponent = new NonOpaquePanel(new BorderLayout());

  final AnAction stopAction = ActionManager.getInstance().getAction("StartStopMacroRecording");
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(stopAction);
  final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.STATUS_BAR_PLACE, group, true);
  tb.setMiniMode(true);

  final NonOpaquePanel top = new NonOpaquePanel(new BorderLayout());
  top.add(tb.getComponent(), BorderLayout.WEST);
  myText = new JLabel(RECORDED + "..." + TYPING_SAMPLE, SwingConstants.LEFT);
  final Dimension preferredSize = myText.getPreferredSize();
  myText.setPreferredSize(preferredSize);
  myText.setText("Macro recording started...");
  myLastTyping = "";
  top.add(myText, BorderLayout.CENTER);
  myBalloonComponent.add(top, BorderLayout.CENTER);
}
项目:consulo    文件:ToolWindowsWidget.java   
ToolWindowsWidget(@Nonnull Disposable parent) {
  new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      performAction();
    }
  }.setActionTrigger(MouseEvent.MOUSE_PRESSED);

  IdeEventQueue.getInstance().addDispatcher(e -> {
    if (e instanceof MouseEvent) {
      MouseEvent mouseEvent = (MouseEvent)e;
      if (mouseEvent.getComponent() == null || !SwingUtilities.isDescendingFrom(mouseEvent.getComponent(), SwingUtilities.getWindowAncestor(this))) {
        return false;
      }

      if (e.getID() == MouseEvent.MOUSE_MOVED && isShowing()) {
        Point p = mouseEvent.getLocationOnScreen();
        Point screen = this.getLocationOnScreen();
        if (new Rectangle(screen.x - 4, screen.y - 2, getWidth() + 4, getHeight() + 4).contains(p)) {
          mouseEntered();
          wasExited = false;
        }
        else {
          if (!wasExited) {
            wasExited = mouseExited(p);
          }
        }
      }
      else if (e.getID() == MouseEvent.MOUSE_EXITED) {
        //mouse exits WND
        mouseExited(mouseEvent.getLocationOnScreen());
      }
    }
    return false;
  }, parent);

  ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(UISettingsListener.TOPIC, this);
  KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener("focusOwner", this);
  myAlarm = new Alarm(parent);
}
项目:consulo    文件:ActionMacroManager.java   
private Widget(StatusBar statusBar) {
  myStatusBar = statusBar;
  myPresentation = new WidgetPresentation() {
    @Override
    public String getTooltipText() {
      return "Macro is being recorded now";
    }

    @Override
    public Consumer<MouseEvent> getClickConsumer() {
      return Widget.this;
    }
  };


  new BaseButtonBehavior(myIcon) {
    @Override
    protected void execute(MouseEvent e) {
      showBalloon();
    }
  };

  myBalloonComponent = new NonOpaquePanel(new BorderLayout());

  final AnAction stopAction = ActionManager.getInstance().getAction("StartStopMacroRecording");
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(stopAction);
  final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.STATUS_BAR_PLACE, group, true);
  tb.setMiniMode(true);

  final NonOpaquePanel top = new NonOpaquePanel(new BorderLayout());
  top.add(tb.getComponent(), BorderLayout.WEST);
  myText = new JLabel(RECORDED + "..." + TYPING_SAMPLE, SwingConstants.LEFT);
  final Dimension preferredSize = myText.getPreferredSize();
  myText.setPreferredSize(preferredSize);
  myText.setText("Macro recording started...");
  myLastTyping = "";
  top.add(myText, BorderLayout.CENTER);
  myBalloonComponent.add(top, BorderLayout.CENTER);
}
项目:consulo    文件:ConfigurationErrorsComponent.java   
ToolbarAlikeButton(@Nonnull final Icon icon) {
  myIcon = icon;

  myBehavior = new BaseButtonBehavior(this, TimedDeadzone.NULL) {
    @Override
    protected void execute(MouseEvent e) {
      onClick(e);
    }
  };

  setOpaque(false);
}