Java Code Examples for com.intellij.util.LineSeparator#CRLF

The following examples show how to use com.intellij.util.LineSeparator#CRLF . 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: DiffUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static JComponent createSeparatorPanel(@Nonnull LineSeparator separator) {
  JLabel label = new JLabel(separator.name());
  Color color;
  if (separator == LineSeparator.CRLF) {
    color = JBColor.RED;
  }
  else if (separator == LineSeparator.LF) {
    color = JBColor.BLUE;
  }
  else if (separator == LineSeparator.CR) {
    color = JBColor.MAGENTA;
  }
  else {
    color = JBColor.BLACK;
  }
  label.setForeground(color);
  return label;
}
 
Example 2
Source File: Platform.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
default LineSeparator getLineSeparator() {
  if(isWindows()) {
    return LineSeparator.CRLF;
  }
  return LineSeparator.LF;
}
 
Example 3
Source File: StorageUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static LineSeparator detectLineSeparators(@Nonnull CharSequence chars, @Nullable LineSeparator defaultSeparator) {
  for (int i = 0, n = chars.length(); i < n; i++) {
    char c = chars.charAt(i);
    if (c == '\r') {
      return LineSeparator.CRLF;
    }
    else if (c == '\n') {
      // if we are here, there was no \r before
      return LineSeparator.LF;
    }
  }
  return defaultSeparator == null ? LineSeparator.getSystemLineSeparator() : defaultSeparator;
}
 
Example 4
Source File: ConvertToWindowsLineSeparatorsAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ConvertToWindowsLineSeparatorsAction() {
  super(ApplicationBundle.message("combobox.crlf.windows"), LineSeparator.CRLF);
}