images plugin now part of a CE
[fedora-idea.git] / images / src / org / intellij / images / thumbnail / actions / ToggleRecursiveAction.java
blobafe67a59c63f265b305c39ac1830705b8ef180d7
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
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.
17 /** $Id$ */
19 package org.intellij.images.thumbnail.actions;
21 import com.intellij.openapi.actionSystem.AnActionEvent;
22 import com.intellij.openapi.actionSystem.ToggleAction;
23 import org.intellij.images.thumbnail.ThumbnailView;
24 import org.intellij.images.thumbnail.actionSystem.ThumbnailViewActionUtil;
26 /**
27 * Toggle recursive flag.
29 * @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
31 public final class ToggleRecursiveAction extends ToggleAction {
32 public boolean isSelected(AnActionEvent e) {
33 ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e);
34 return view != null && view.isRecursive();
37 public void setSelected(AnActionEvent e, boolean state) {
38 ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e);
39 if (view != null) {
40 view.setRecursive(state);
44 public void update(final AnActionEvent e) {
45 super.update(e);
46 ThumbnailViewActionUtil.setEnabled(e);