Java源码示例:com.intellij.openapi.actionSystem.Toggleable

示例1
@Nullable
@Override
public Rectangle onMouseMove(@Nonnull MouseEvent event) {
  myEditButton.setVisible(myControl.getSelectedModelRows().size() <= 1);
  Rectangle bounds = getButtonScreenBounds();
  if (!myBeingEdited && bounds != null) {
    boolean selected = bounds.contains(event.getLocationOnScreen());
    boolean wasSelected = myEditButton.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY) == Boolean.TRUE;
    myEditButton.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
    if (selected ^ wasSelected) {
      return myScreenBounds;
    }
  }

  return myDelegate.onMouseMove(event);
}
 
示例2
@Override
public final void actionPerformed(AnActionEvent e) {
  final boolean state = !isSelected(e);
  setSelected(e, state);
  final Boolean selected = state ? Boolean.TRUE : Boolean.FALSE;
  final Presentation presentation = e.getPresentation();
  presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
}
 
示例3
public void setBeingEdited(boolean beingEdited) {
  if (myBeingEdited && !beingEdited) {
    myEditButton.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, false);
  }
  if (!beingEdited && !myUnderMouse) {
    myEditButton.setVisible(false);
  }
  if (beingEdited && !myBeingEdited) {
    myEditButton.setVisible(true);
    myEditButton.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, true);
  }
  myBeingEdited = beingEdited;
}
 
示例4
@Override
public void update(@Nonnull AnActionEvent e) {
  Icon icon = getTemplatePresentation().getIcon();
  e.getPresentation().setIcon(isActive() ? ExecutionUtil.getLiveIndicator(icon) : icon);
  e.getPresentation().setEnabled(isEnabled());
  Toggleable.setSelected(e.getPresentation(), isSelected(e));
}
 
示例5
@Override
public final void updateButton(AnActionEvent e) {
  final Boolean selected = isSelected(e) ? Boolean.TRUE : Boolean.FALSE;
  final Presentation presentation = e.getPresentation();
  presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
}
 
示例6
@Override
public void update(AnActionEvent e) {
  super.update(e);
  e.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, !myInspectionsFilter.isEmptyFilter());
}