private void highlightTemplateVariables(Template template, Editor topLevelEditor) {
    //add highlights
    if (myHighlighters != null) { // can be null if finish is called during testing
      TemplateState templateState = TemplateManagerImpl.getTemplateState(topLevelEditor);
      Map<TextRange, TextAttributes> rangesToHighlight;
      if (templateState == null) {
        rangesToHighlight = Collections.emptyMap();
      }
      else {
        EditorColorsManager colorsManager = EditorColorsManager.getInstance();
        rangesToHighlight = new HashMap<>();
        variableHighlights(template, templateState).forEach((range, attributesKey) -> {
          TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(attributesKey);
          if (attributes != null) {
            TextAttributesWithKey attributesWithKey = new TextAttributesWithKey(attributes, attributesKey);
            rangesToHighlight.put(range, attributesWithKey);
          }
        });
      }
      addHighlights(rangesToHighlight, topLevelEditor, myHighlighters, HighlightManager.getInstance(myProject));
    }
  }
private void highlightTemplateVariables(Template template, Editor topLevelEditor)