public static ModCommand setGUIComponentType(PsiPlainTextFile file, String fieldName, String typeText) {
    final Map<String, Pair<PsiType, TextRange>> fieldNameToTypeMap = getCachedData(file).myFieldNameToTypeMap;
    final Pair<PsiType, TextRange> typeRangePair = fieldNameToTypeMap.get(fieldName);
    if (typeRangePair != null) {
      final TextRange range = typeRangePair.getSecond();
      if (range != null) {
        return ModCommand.psiUpdate(file, f -> f.getViewProvider().getDocument()
          .replaceString(range.getStartOffset(), range.getEndOffset(), typeText));
      }
    }
    return ModCommand.nop();
  }
public static ModCommand setGUIComponentType(PsiPlainTextFile file, String fieldName, String typeText)