public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
   try {
     EditorComponent component =
         ((EditorComponent)
             ((Editor) MapSequence.fromMap(_params).get("editor")).getCurrentEditorComponent());
     if (component == null) {
       return;
     }
     Set<String> enabledHints = component.getEnabledHints();
     ConceptEditorHintSettings settings = new ConceptEditorHintSettings();
     settings.putAll(
         ConceptEditorHintSettingsComponent.getInstance(
                 ((Project) MapSequence.fromMap(_params).get("project")))
             .getSettings());
     for (String lang : settings.getLanguagesNames()) {
       for (ConceptEditorHint hint : SetSequence.fromSet(settings.getHints(lang))) {
         settings.put(lang, hint, false);
       }
     }
     settings.updateSettings(enabledHints);
     final ConceptEditorHintPreferencesPage page = new ConceptEditorHintPreferencesPage(settings);
     DialogWrapper dialog =
         new HintsDialog(
             ((Project) MapSequence.fromMap(_params).get("project")), page, settings, component);
     dialog.show();
   } catch (Throwable t) {
     if (LOG.isEnabledFor(Priority.ERROR)) {
       LOG.error("User's action execute method failed. Action:" + "PushEditorHints", t);
     }
   }
 }
Esempio n. 2
0
  @NotNull
  private String[] getInitialEditorHints(EditorContext editorContext) {
    if (myInitialEditorHints != null) {
      return myInitialEditorHints;
    }

    Project project =
        ProjectHelper.toIdeaProject(ProjectHelper.getProject(editorContext.getRepository()));
    if (project == null) {
      return EMPTY_HINTS_ARRAY;
    }
    HintsState state = ConceptEditorHintSettingsComponent.getInstance(project).getState();
    return state.getEnabledHints().toArray(EMPTY_HINTS_ARRAY);
  }