/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.idea.svn.dialogs.browser;

import javax.swing.*;
import java.awt.*;

class MessageBoxCellRenderer extends DefaultListCellRenderer {

  public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    if (value != null) {
      String message = (String) value;
      message = message.replace('\r', '|');
      message = message.replace('\n', '|');
      if (message.length() > 50) {
        message = message.substring(0, 50) + "[...]";
      }
      value = message;
    }
    return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  }
}

@@ -644,16 +644,107 @@
 owser;%0A%0A
+import com.intellij.ui.ColoredListCellRenderer;%0Aimport org.jetbrains.annotations.NotNull;%0A%0A
 import j
@@ -761,25 +761,227 @@
 .*;%0A
+%0A
 import 
-java.awt.*
+static com.intellij.openapi.util.text.StringUtil.notNullize;%0Aimport static com.intellij.openapi.util.text.StringUtil.shortenTextWithEllipsis;%0Aimport static com.intellij.ui.SimpleTextAttributes.REGULAR_ATTRIBUTES
 ;%0A%0Ac
@@ -1020,15 +1020,15 @@
 nds 
-Default
+Colored
 List
@@ -1043,78 +1043,116 @@
 erer
- %7B%0A%0A  public Component getListCellRendererComponent(JList
+%3CString%3E %7B%0A%0A  @Override%0A  protected void customizeCellRenderer(@NotNull JList%3C? extends String%3E
  list, 
-Object
+String
  val
@@ -1174,19 +1174,17 @@
 boolean 
-isS
+s
 elected,
@@ -1192,21 +1192,17 @@
 boolean 
-cellH
+h
 asFocus)
@@ -1239,345 +1239,147 @@
     
-String message = (String) value;%0A      message = message.replace('%5Cr', '%7C');%0A      message = message.replace('%5Cn', '%7C');%0A      if (message.length() %3E 50) %7B%0A        message = message.substring(
+value = shortenTextWithEllipsis(value.replace('%5Cr', '%7C').replace('%5Cn', '%7C'), 5
 0, 
-5
 0)
- + %22%5B...%5D%22
 ;%0A    
- 
- 
 %7D%0A    
-  value = message;%0A    %7D%0A    return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus
+append(notNullize(value), REGULAR_ATTRIBUTES
 );%0A 

Simplify "MessageBoxCellRenderer" - inherit "ColoredListCellRenderer"