Java Code Examples for com.intellij.openapi.util.text.StringUtil#escapeStringCharacters()

The following examples show how to use com.intellij.openapi.util.text.StringUtil#escapeStringCharacters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnifiedDiffWriter.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void writeFileHeading(final FilePatch patch,
                                     final Writer writer,
                                     final String lineSeparator,
                                     Map<String, CharSequence> additionalMap) throws IOException {
  writer.write(MessageFormat.format(INDEX_SIGNATURE, patch.getBeforeName(), lineSeparator));
  if (additionalMap != null && ! additionalMap.isEmpty()) {
    writer.write(ADDITIONAL_PREFIX);
    writer.write(lineSeparator);
    for (Map.Entry<String, CharSequence> entry : additionalMap.entrySet()) {
      writer.write(ADD_INFO_HEADER + entry.getKey());
      writer.write(lineSeparator);
      final String value = StringUtil.escapeStringCharacters(entry.getValue().toString());
      final List<String> lines = StringUtil.split(value, "\n");
      for (String line : lines) {
        writer.write(ADD_INFO_LINE_START);
        writer.write(line);
        writer.write(lineSeparator);
      }
    }
  }
  writer.write(HEADER_SEPARATOR + lineSeparator);
  writeRevisionHeading(writer, "---", patch.getBeforeName(), patch.getBeforeVersionId(), lineSeparator);
  writeRevisionHeading(writer, "+++", patch.getAfterName(), patch.getAfterVersionId(), lineSeparator);
}
 
Example 2
Source File: ExtractConceptInfoCollector.java    From Intellij-Plugin with Apache License 2.0 4 votes vote down vote up
private String getNameWithParamChar(String step, String p) {
    String arg = StringUtil.escapeStringCharacters(p);
    return step.charAt(step.indexOf(p) - 1) + arg + step.charAt(step.indexOf(p) + p.length());
}