@Override
  public void update(@NotNull AnActionEvent event){
    super.update(event);
    Presentation presentation = event.getPresentation();
    if (!presentation.isEnabled()) {
      return;
    }
    boolean isEnabled = false;
    String presentationText;
    final Module[] modules = event.getData(LangDataKeys.MODULE_CONTEXT_ARRAY);
    if (modules != null) {
      isEnabled = true;
      if (ArrayUtil.contains(null, modules)) {
        final DataContext dataContext = event.getDataContext();
        LOG.error("Unexpected null module slipped through validator; dataContext = " + dataContext + "; class = "+dataContext.getClass().getName());
      }
      if (modules.length == 1) {
        presentationText = JavaCompilerBundle.message("action.make.single.module.text", modules[0].getName());
      }
      else {
        String moduleNames = Stream.of(modules).map(m -> "'"+m.getName()+"'").collect(NlsMessages.joiningNarrowAnd());
        presentationText = moduleNames.length() > 20 ?
                           JavaCompilerBundle.message("action.make.selected.modules.text") :
                           JavaCompilerBundle.message("action.make.few.modules.text", moduleNames);
      }
    }
    else if (!ActionPlaces.isPopupPlace(event.getPlace())) {
      final Module module = event.getData(PlatformCoreDataKeys.MODULE);
      if (module != null) {
        isEnabled = true;
        presentationText = JavaCompilerBundle.message("action.make.single.module.text", module.getName());
      }
      else {
        presentationText = getTemplatePresentation().getTextWithMnemonic();
      }
    }
    else {
      presentationText = getTemplatePresentation().getTextWithMnemonic();
    }
    presentation.setText(presentationText);
    presentation.setEnabled(isEnabled);
    presentation.setVisible(isEnabled || !ActionPlaces.PROJECT_VIEW_POPUP.equals(event.getPlace()));
  }
@Override
  public void update(@NotNull AnActionEvent event)