2 * Copyright 2004-2005 Alexey Efimov
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.intellij.images.editor.actions;
18 import com.intellij.openapi.actionSystem.AnAction;
19 import com.intellij.openapi.actionSystem.AnActionEvent;
20 import com.intellij.openapi.project.DumbAware;
21 import org.intellij.images.editor.ImageEditor;
22 import org.intellij.images.editor.ImageZoomModel;
23 import org.intellij.images.editor.actionSystem.ImageEditorActionUtil;
24 import org.intellij.images.ui.ImageComponentDecorator;
29 * @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
30 * @see ImageEditor#getZoomModel
32 public final class ZoomOutAction extends AnAction implements DumbAware {
33 public void actionPerformed(AnActionEvent e) {
34 ImageComponentDecorator decorator = ImageEditorActionUtil.getImageComponentDecorator(e);
35 if (decorator != null) {
36 ImageZoomModel zoomModel = decorator.getZoomModel();
41 public void update(AnActionEvent e) {
43 if (ImageEditorActionUtil.setEnabled(e)) {
44 ImageComponentDecorator decorator = ImageEditorActionUtil.getImageComponentDecorator(e);
45 ImageZoomModel zoomModel = decorator.getZoomModel();
46 e.getPresentation().setEnabled(zoomModel.canZoomOut());