@Override
 public void update(AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   presentation.setVisible(false);
   final DataContext dataContext = e.getDataContext();
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   if (project != null) {
     final RunConfiguration configuration = RunConfiguration.DATA_KEY.getData(dataContext);
     if (isPatternBasedConfiguration(configuration)) {
       final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(dataContext);
       if (testProxy != null) {
         final Location location =
             testProxy.getLocation(
                 project, ((T) configuration).getConfigurationModule().getSearchScope());
         if (location != null) {
           final PsiElement psiElement = location.getPsiElement();
           if (psiElement instanceof PsiClass
               && getPattern((T) configuration)
                   .contains(((PsiClass) psiElement).getQualifiedName())) {
             presentation.setVisible(true);
           }
         }
       }
     }
   }
 }
 @Override
 public void actionPerformed(AnActionEvent e) {
   final DataContext dataContext = e.getDataContext();
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   LOG.assertTrue(project != null);
   final T configuration = (T) RunConfiguration.DATA_KEY.getData(dataContext);
   LOG.assertTrue(configuration != null);
   final GlobalSearchScope searchScope = configuration.getConfigurationModule().getSearchScope();
   final AbstractTestProxy testProxy = AbstractTestProxy.DATA_KEY.getData(dataContext);
   LOG.assertTrue(testProxy != null);
   final String qualifiedName =
       ((PsiClass) testProxy.getLocation(project, searchScope).getPsiElement()).getQualifiedName();
   getPattern(configuration).remove(qualifiedName);
 }
 private ConfigurationContext(final DataContext dataContext) {
   myRuntimeConfiguration = RunConfiguration.DATA_KEY.getData(dataContext);
   myContextComponent = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
   myModule = LangDataKeys.MODULE.getData(dataContext);
   @SuppressWarnings({"unchecked"})
   final Location<PsiElement> location =
       (Location<PsiElement>) Location.DATA_KEY.getData(dataContext);
   if (location != null) {
     myLocation = location;
     return;
   }
   final Project project = CommonDataKeys.PROJECT.getData(dataContext);
   if (project == null) {
     myLocation = null;
     return;
   }
   final PsiElement element = getSelectedPsiElement(dataContext, project);
   if (element == null) {
     myLocation = null;
     return;
   }
   myLocation = new PsiLocation<>(project, myModule, element);
 }