Search in sources :

Example 11 with ImageComponentDecorator

use of org.intellij.images.ui.ImageComponentDecorator in project intellij-community by JetBrains.

the class ImageEditorActionUtil method setEnabled.

/**
     * Enable or disable current action from event.
     *
     * @param e Action event
     * @return Enabled value
     */
public static boolean setEnabled(AnActionEvent e) {
    ImageComponentDecorator decorator = getImageComponentDecorator(e);
    Presentation presentation = e.getPresentation();
    presentation.setEnabled(decorator != null);
    return presentation.isEnabled();
}
Also used : Presentation(com.intellij.openapi.actionSystem.Presentation) ImageComponentDecorator(org.intellij.images.ui.ImageComponentDecorator)

Example 12 with ImageComponentDecorator

use of org.intellij.images.ui.ImageComponentDecorator in project intellij-community by JetBrains.

the class ActualSizeAction method update.

public void update(AnActionEvent e) {
    super.update(e);
    if (ImageEditorActionUtil.setEnabled(e)) {
        ImageComponentDecorator decorator = ImageEditorActionUtil.getImageComponentDecorator(e);
        ImageZoomModel zoomModel = decorator.getZoomModel();
        e.getPresentation().setEnabled(zoomModel.getZoomFactor() != 1.0d);
    }
}
Also used : ImageZoomModel(org.intellij.images.editor.ImageZoomModel) ImageComponentDecorator(org.intellij.images.ui.ImageComponentDecorator)

Aggregations

ImageComponentDecorator (org.intellij.images.ui.ImageComponentDecorator)12 ImageZoomModel (org.intellij.images.editor.ImageZoomModel)6 Presentation (com.intellij.openapi.actionSystem.Presentation)1