private static @Nullable String previewOrExpandMacro(Macro macro, DataContext dataContext, String occurence) {
    try {
      if (macro instanceof PromptingMacro || macro instanceof MacroWithParams) {
        Boolean mode = VALIDATION_MODE.getData(dataContext);
        if (mode != null && mode) {
          throw new IncorrectOperationException();
        }
      }
      String value = macro instanceof PromptingMacro ?
                     macro.expandOccurence(dataContext, occurence) :
                     ReadAction.nonBlocking(() -> macro.expandOccurence(dataContext, occurence)).executeSynchronously();
      MacroUsageCollector.logMacroExpanded(macro, value != null);
      return value;
    }
    catch (Macro.ExecutionCancelledException e) {
      return null;
    }
  }
private static @Nullable String previewOrExpandMacro(Macro macro, DataContext dataContext, String occurence)