/*
 * Copyright 2000-2014 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.openapi.actionSystem;

import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.PropertyKey;

import javax.swing.*;

/**
 * @author Konstantin Bulenkov
 */
public class RegistryToggleAction extends ToggleAction {
  @NotNull
  private final String myKey;

  public RegistryToggleAction(@NotNull @PropertyKey(resourceBundle = Registry.REGISTRY_BUNDLE) String key) {
    this(key, null, null, null);
  }

  public RegistryToggleAction(@NotNull @PropertyKey(resourceBundle = Registry.REGISTRY_BUNDLE) String key,
                              @Nullable String name) {
    this(key, name, null, null);
  }

  public RegistryToggleAction(@NotNull @PropertyKey(resourceBundle = Registry.REGISTRY_BUNDLE) String key,
                              @Nullable String name,
                              @Nullable String description,
                              @Nullable Icon icon) {
    super(name, description, icon);
    myKey = key;
  }

  @Override
  public boolean isSelected(AnActionEvent e) {
    return Registry.is(myKey);
  }

  @Override
  public void setSelected(AnActionEvent e, boolean state) {
    Registry.get(myKey).setValue(state);
  }
}

@@ -21,9 +21,9 @@
 -201
-4
+5
  Jet
@@ -1869,14 +1869,82 @@
 state);%0A
+    doWhenDone(e);%0A  %7D%0A%0A  public void doWhenDone(AnActionEvent e) %7B%0A
   %7D%0A%7D%0A

add doWhenDone() method