com.intellij.openapi.actionSystem.Toggleable Java Examples

The following examples show how to use com.intellij.openapi.actionSystem.Toggleable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrangementListRowDecorator.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #2
Source File: ToggleActionButton.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #3
Source File: ArrangementListRowDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: ShowFilterAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example #5
Source File: ToggleActionButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example #6
Source File: InspectionFilterAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void update(AnActionEvent e) {
  super.update(e);
  e.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, !myInspectionsFilter.isEmptyFilter());
}