package com.intellij.coverage.actions;

import com.intellij.coverage.CoverageDataManager;
import com.intellij.coverage.CoverageSuitesBundle;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.project.Project;

public class HideCoverageInfoAction extends AnAction {
  public HideCoverageInfoAction() {
    super("&Hide Coverage Data", "Hide coverage data", AllIcons.Actions.Cancel);
  }

  public void actionPerformed(final AnActionEvent e) {
    CoverageDataManager.getInstance(e.getData(CommonDataKeys.PROJECT)).chooseSuitesBundle(null);
  }

  @Override
  public void update(AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    presentation.setEnabled(false);
    presentation.setVisible(ActionPlaces.isToolbarPlace(e.getPlace()));
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
      final CoverageSuitesBundle suitesBundle = CoverageDataManager.getInstance(project).getCurrentSuitesBundle();
      presentation.setEnabled(suitesBundle != null);
      presentation.setVisible(suitesBundle != null);
    }
  }
}

@@ -1,8 +1,609 @@
+/*%0A * Copyright 2000-2017 JetBrains s.r.o.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A
 package 
@@ -812,17 +812,192 @@
 nSystem.
-*
+AnAction;%0Aimport com.intellij.openapi.actionSystem.AnActionEvent;%0Aimport com.intellij.openapi.actionSystem.CommonDataKeys;%0Aimport com.intellij.openapi.actionSystem.Presentation
 ;%0Aimport
@@ -1549,48 +1549,26 @@
 ble(
+e.is
 Action
-Places.isToolbarPlace(e.getPlace()
+Toolbar(
 ));%0A
@@ -1604,35 +1604,16 @@
 .get
-Data(CommonDataKeys.PROJECT
+Project(
 );%0A 

use event.isActionToolbar()