Java 类com.intellij.openapi.actionSystem.Toggleable 实例源码

项目:MissingInActions    文件:ForwardSearchCaretSpawningAction.java   
@Override
public void update(final AnActionEvent e) {
    super.update(e);

    Presentation presentation = e.getPresentation();
    boolean enabled = presentation.isEnabled();
    boolean selected = false;

    if (enabled) {
        final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
        if (editor != null) {
            LineSelectionManager manager = LineSelectionManager.getInstance(editor);
            RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
            if (spawningHandler != null && !spawningHandler.isBackwards()) {
                selected = true;
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
项目:MissingInActions    文件:BackwardSearchCaretSpawningAction.java   
@Override
public void update(final AnActionEvent e) {
    super.update(e);

    Presentation presentation = e.getPresentation();
    boolean enabled = presentation.isEnabled();
    boolean selected = false;

    if (enabled) {
        final EditorEx editor = (EditorEx) CommonDataKeys.EDITOR.getData(e.getDataContext());
        if (editor != null) {
            LineSelectionManager manager = LineSelectionManager.getInstance(editor);
            RangeLimitedCaretSpawningHandler spawningHandler = manager.getCaretSpawningHandler();
            if (spawningHandler != null && spawningHandler.isBackwards()) {
                selected = true;
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(!ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}
项目:intellij-ce-playground    文件:ArrangementListRowDecorator.java   
@Nullable
@Override
public Rectangle onMouseMove(@NotNull 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);
}
项目:tools-idea    文件:ArrangementListRowDecorator.java   
@Nullable
@Override
public Rectangle onMouseMove(@NotNull 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);
}
项目:consulo    文件:ArrangementListRowDecorator.java   
@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);
}
项目:intellij-ce-playground    文件:ToggleActionButton.java   
@Override
public final void actionPerformed(AnActionEvent e) {
  final boolean state = !isSelected(e);
  setSelected(e, state);
  final Boolean selected = state;
  final Presentation presentation = e.getPresentation();
  presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
}
项目:intellij-ce-playground    文件:ArrangementListRowDecorator.java   
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;
}
项目:tools-idea    文件:ToggleActionButton.java   
@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);
}
项目:tools-idea    文件:ArrangementListRowDecorator.java   
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;
}
项目:consulo    文件:ToggleActionButton.java   
@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);
}
项目:consulo    文件:ArrangementListRowDecorator.java   
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;
}
项目:intellij-ce-playground    文件:ToggleActionButton.java   
@Override
public final void updateButton(AnActionEvent e) {
  final Boolean selected = isSelected(e);
  final Presentation presentation = e.getPresentation();
  presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
}
项目:tools-idea    文件:ToggleActionButton.java   
@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);
}
项目:consulo    文件:ToggleActionButton.java   
@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);
}
项目:consulo    文件:InspectionFilterAction.java   
@Override
public void update(AnActionEvent e) {
  super.update(e);
  e.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, !myInspectionsFilter.isEmptyFilter());
}