images plugin now part of a CE
[fedora-idea.git] / images / src / org / intellij / images / editor / actions / ZoomOutAction.java
blobbabd5f47a190e10f2bc6449603920e8dec0967b9
1 /*
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 org.intellij.images.editor.ImageEditor;
21 import org.intellij.images.editor.ImageZoomModel;
22 import org.intellij.images.editor.actionSystem.ImageEditorActionUtil;
24 /**
25 * Zoom out.
27 * @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
28 * @see ImageEditor#getZoomModel
30 public final class ZoomOutAction extends AnAction {
31 public void actionPerformed(AnActionEvent e) {
32 ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
33 if (editor != null) {
34 ImageZoomModel zoomModel = editor.getZoomModel();
35 zoomModel.zoomOut();
39 public void update(AnActionEvent e) {
40 super.update(e);
41 if (ImageEditorActionUtil.setEnabled(e)) {
42 ImageEditor editor = ImageEditorActionUtil.getValidEditor(e);
43 ImageZoomModel zoomModel = editor.getZoomModel();
44 e.getPresentation().setEnabled(zoomModel.canZoomOut());