Example usage for com.intellij.openapi.actionSystem Toggleable SELECTED_PROPERTY

List of usage examples for com.intellij.openapi.actionSystem Toggleable SELECTED_PROPERTY

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem Toggleable SELECTED_PROPERTY.

Prototype

String SELECTED_PROPERTY

To view the source code for com.intellij.openapi.actionSystem Toggleable SELECTED_PROPERTY.

Click Source Link

Document

A property for the presentation to hold the state of the toggleable action.

Usage

From source file:com.intellij.application.options.codeStyle.arrangement.util.ArrangementListRowDecorator.java

License:Apache License

public void setBeingEdited(boolean beingEdited) {
    if (myBeingEdited && !beingEdited) {
        myEditButton.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, false);
    }/*from  w  w  w  . jav  a  2s.  co m*/
    if (!beingEdited && !myUnderMouse) {
        myEditButton.setVisible(false);
    }
    if (beingEdited && !myBeingEdited) {
        myEditButton.setVisible(true);
        myEditButton.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, true);
    }
    myBeingEdited = beingEdited;
}

From source file:com.intellij.application.options.codeStyle.arrangement.util.ArrangementListRowDecorator.java

License:Apache License

@Nullable
@Override//from  w  w w.j a  v a2s.  co  m
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);
}

From source file:com.intellij.profile.codeInspection.ui.filter.InspectionFilterAction.java

License:Apache License

@Override
public void update(AnActionEvent e) {
    super.update(e);
    e.getPresentation().putClientProperty(Toggleable.SELECTED_PROPERTY, !myInspectionsFilter.isEmptyFilter());
}

From source file:com.intellij.ui.ToggleActionButton.java

License:Apache License

@Override
public final void actionPerformed(AnActionEvent e) {
    final boolean state = !isSelected(e);
    setSelected(e, state);// w w w  . j a  va2s  .c  o  m
    final Boolean selected = state ? Boolean.TRUE : Boolean.FALSE;
    final Presentation presentation = e.getPresentation();
    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);
}

From source file:com.intellij.ui.ToggleActionButton.java

License:Apache License

@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);
}

From source file:com.vladsch.MissingInActions.actions.pattern.BackwardSearchCaretSpawningAction.java

License:Apache License

@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;/*from w w  w  . j a  va  2s  .co  m*/
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(
            !ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}

From source file:com.vladsch.MissingInActions.actions.pattern.ForwardSearchCaretSpawningAction.java

License:Apache License

@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;//from w w w .  jav a 2s  .  c o m
            }
        }
    }

    presentation.putClientProperty(Toggleable.SELECTED_PROPERTY, selected);

    e.getPresentation().setVisible(
            !ApplicationSettings.getInstance().isHideDisabledButtons() || e.getPresentation().isEnabled());
}

From source file:org.cordovastudio.editors.designer.propertyTable.actions.TableTabAction.java

License:Apache License

public void updateState() {
    getTemplatePresentation().putClientProperty(Toggleable.SELECTED_PROPERTY,
            Boolean.valueOf(isSelected(null)));
    myButton.repaint();
}