Projects >> intellij-community >>fc07b64645bb78ce31414b27555e639f959b541f

Chunk
Conflicting content
    myHelpId = helpId;
    mySignature = new MethodSignatureComponent("", project, JavaFileType.INSTANCE);
    mySignature.setPreferredSize(new Dimension(500, 100));
<<<<<<< HEAD
    mySignature.setMinimumSize(new Dimension(500, 100));
=======
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    setTitle(title);

    // Create UI components
Solution content
    myHelpId = helpId;
    mySignature = new MethodSignatureComponent("", project, JavaFileType.INSTANCE);
    mySignature.setPreferredSize(new Dimension(500, 100));
    mySignature.setMinimumSize(new Dimension(500, 100));
    setTitle(title);

    // Create UI components
File
ExtractMethodDialog.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
  @Nullable
  public static Charset guessFromBOM(@NotNull byte[] buffer) {
    if (hasUTF8Bom(buffer)) return UTF8_CHARSET;
<<<<<<< HEAD
    if (hasUTF16LEBom(buffer)) return UTF_16LE_CHARSET;
    if (hasUTF16BEBom(buffer)) return UTF_16BE_CHARSET;

=======
    if (hasUTF16LEBom(buffer)) return Charset.forName("UTF-16LE");
    if (hasUTF16BEBom(buffer)) return Charset.forName("UTF-16BE");
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    return null;
  }
Solution content
  @Nullable
  public static Charset guessFromBOM(@NotNull byte[] buffer) {
    if (hasUTF8Bom(buffer)) return UTF8_CHARSET;
    if (hasUTF16LEBom(buffer)) return UTF_16LE_CHARSET;
    if (hasUTF16BEBom(buffer)) return UTF_16BE_CHARSET;

    return null;
  }
File
CharsetToolkit.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
<<<<<<< HEAD
import java.util.concurrent.atomic.AtomicReference;
=======
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

/**
 * @author cdr
Solution content
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @author cdr
File
CharArray.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
   */
  private static final int MAX_DEFERRED_CHANGES_NUMBER = 10000;

<<<<<<< HEAD
  private final AtomicReference myDeferredChangesStorage = new AtomicReference();
=======
  private final Lock myDeferredChangesLock = new ReentrantLock();
  
  @NotNull
  private TextChangesStorage myDeferredChangesStorage;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  
  private int myStart;
  /**
Solution content
   */
  private static final int MAX_DEFERRED_CHANGES_NUMBER = 10000;

  private final AtomicReference myDeferredChangesStorage = new AtomicReference();
  
  private int myStart;
  /**
File
CharArray.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Method invocation
Chunk
Conflicting content
   * @param change      new change to store
   */
  private void storeChange(@NotNull TextChangeImpl change) {
<<<<<<< HEAD
    TextChangesStorage storage = myDeferredChangesStorage.get();
    storage.getLock().lock();
=======
    myDeferredChangesLock.lock();
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    try {
      doStoreChange(change);
    }
Solution content
   * @param change      new change to store
   */
  private void storeChange(@NotNull TextChangeImpl change) {
    TextChangesStorage storage = myDeferredChangesStorage.get();
    storage.getLock().lock();
    try {
      doStoreChange(change);
    }
File
CharArray.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
      doStoreChange(change);
    }
    finally {
<<<<<<< HEAD
      storage.getLock().unlock();
=======
      myDeferredChangesLock.unlock();
    }
  }
  
  private void doStoreChange(@NotNull TextChangeImpl change) {
    if (myDeferredChangesStorage.size() >= MAX_DEFERRED_CHANGES_NUMBER) {
      flushDeferredChanged();
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    }
  }
  
Solution content
      doStoreChange(change);
    }
    finally {
      storage.getLock().unlock();
    }
  }
  
File
CharArray.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Method signature
Chunk
Conflicting content
      storage.getLock().unlock();
    }
  }
<<<<<<< HEAD
  
  private void doFlushDeferredChanged() {
    TextChangesStorage storage = myDeferredChangesStorage.get();
    List changes = storage.getChanges();
=======

  private void flushDeferredChanged() {
    myDeferredChangesLock.lock();
    try {
      doFlushDeferredChanged();
    }
    finally {
      myDeferredChangesLock.unlock();
    }
  }
  
  private void doFlushDeferredChanged() {
    List changes = myDeferredChangesStorage.getChanges();
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    if (changes.isEmpty()) {
      return;
    }
Solution content
      storage.getLock().unlock();
    }
  }
  
  private void doFlushDeferredChanged() {
    TextChangesStorage storage = myDeferredChangesStorage.get();
    List changes = storage.getChanges();
    if (changes.isEmpty()) {
      return;
    }
File
CharArray.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
      }
      return Trinity.create(null, guessed,null);
    }
<<<<<<< HEAD
    return null;
  }

  @NotNull
  private static Pair getBOMAndCharset(@NotNull byte[] content, final Charset charset) {
    if (charset != null && charset.name().contains(CharsetToolkit.UTF8) && CharsetToolkit.hasUTF8Bom(content)) {
      return Pair.create(charset, CharsetToolkit.UTF8_BOM);
    }
    try {
      if (CharsetToolkit.hasUTF16LEBom(content)) {
        return Pair.create(Charset.forName("UTF-16LE"), CharsetToolkit.UTF16LE_BOM);
      }
      if (CharsetToolkit.hasUTF16BEBom(content)) {
        return Pair.create(Charset.forName("UTF-16BE"), CharsetToolkit.UTF16BE_BOM);
=======

    FileType fileType = virtualFile.getFileType();
    String charsetName = fileType.getCharset(virtualFile, content);

    if (charsetName == null) {
      Charset saved = EncodingManager.getInstance().getEncoding(virtualFile, true);
      if (saved != null) return saved;
    }
    return CharsetToolkit.forName(charsetName);
  }

  // returns offset of the BOM end
  private static Pair detectAndSetBOM(@NotNull VirtualFile virtualFile, byte[] content) {
    Pair bomAndCharset = getBOMAndDetectedCharset(content, virtualFile.getCharset());
    final byte[] bom = bomAndCharset.first;
    if (bom.length != 0) {
      virtualFile.setBOM(bom);
    }
    return Pair.create(bom.length, bomAndCharset.second);
  }

  @NotNull
  private static Pair getBOMAndDetectedCharset(@NotNull byte[] content, final Charset charset) {
    if (charset != null && charset.name().contains(CharsetToolkit.UTF8) && CharsetToolkit.hasUTF8Bom(content)) {
      return Pair.create(CharsetToolkit.UTF8_BOM, charset);
    }
    try {
      if (CharsetToolkit.hasUTF16LEBom(content)) {
        return Pair.create(CharsetToolkit.UTF16LE_BOM, Charset.forName("UTF-16LE"));
      }
      if (CharsetToolkit.hasUTF16BEBom(content)) {
        return Pair.create(CharsetToolkit.UTF16BE_BOM, Charset.forName("UTF-16BE"));
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      }
    }
    catch (UnsupportedCharsetException ignore) {
Solution content
      }
      return Trinity.create(null, guessed,null);
    }
    return null;
  }

  @NotNull
  private static Pair getBOMAndCharset(@NotNull byte[] content, final Charset charset) {
    if (charset != null && charset.name().contains(CharsetToolkit.UTF8) && CharsetToolkit.hasUTF8Bom(content)) {
      return Pair.create(charset, CharsetToolkit.UTF8_BOM);
    }
    try {
      if (CharsetToolkit.hasUTF16LEBom(content)) {
        return Pair.create(Charset.forName("UTF-16LE"), CharsetToolkit.UTF16LE_BOM);
      }
      if (CharsetToolkit.hasUTF16BEBom(content)) {
        return Pair.create(Charset.forName("UTF-16BE"), CharsetToolkit.UTF16BE_BOM);
      }
    }
    catch (UnsupportedCharsetException ignore) {
File
LoadTextUtil.java
Developer's decision
Version 1
Kind of conflict
Annotation
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Try statement
Variable
Chunk
Conflicting content
    catch (UnsupportedCharsetException ignore) {
    }

<<<<<<< HEAD
    return Pair.create(charset, ArrayUtil.EMPTY_BYTE_ARRAY);
=======
    return Pair.create(ArrayUtil.EMPTY_BYTE_ARRAY, charset);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  /**
Solution content
    catch (UnsupportedCharsetException ignore) {
    }

    return Pair.create(charset, ArrayUtil.EMPTY_BYTE_ARRAY);
  }

  /**
File
LoadTextUtil.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Chunk
Conflicting content
    }
      setDetectedFromBytesFlagBack(virtualFile, charset, text);

<<<<<<< HEAD
    // in c ase of "UTF-16", OutputStreamWriter sometimes adds BOM on it's own.
    // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6800103
=======
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    byte[] bom = virtualFile.getBOM();
    Charset fromBom = bom == null ? null : CharsetToolkit.guessFromBOM(bom);
    if (fromBom != null) charset = fromBom;
Solution content
      setDetectedFromBytesFlagBack(virtualFile, charset, text);
    }

    // in c ase of "UTF-16", OutputStreamWriter sometimes adds BOM on it's own.
    // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6800103
    byte[] bom = virtualFile.getBOM();
    Charset fromBom = bom == null ? null : CharsetToolkit.guessFromBOM(bom);
    if (fromBom != null) charset = fromBom;
File
LoadTextUtil.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
  @NotNull
  public static CharSequence getTextByBinaryPresentation(@NotNull byte[] bytes, @NotNull VirtualFile virtualFile, final boolean rememberDetectedSeparators) {
<<<<<<< HEAD
    Pair pair = doDetectCharsetAndSetBOM(virtualFile, bytes);
    final Charset charset = pair.getFirst();
    byte[] bom = pair.getSecond();
    int offset = bom == null ? 0 : bom.length;
=======
    detectCharset(virtualFile, bytes);
    final Pair offsetAndCharset = detectAndSetBOM(virtualFile, bytes);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

    final Pair result = convertBytes(bytes, offsetAndCharset.second, offsetAndCharset.first);
    if (rememberDetectedSeparators) {
Solution content
  @NotNull
  public static CharSequence getTextByBinaryPresentation(@NotNull byte[] bytes, @NotNull VirtualFile virtualFile, final boolean rememberDetectedSeparators) {
    Pair pair = doDetectCharsetAndSetBOM(virtualFile, bytes);
    final Charset charset = pair.getFirst();
    byte[] bom = pair.getSecond();
    int offset = bom == null ? 0 : bom.length;

    final Pair result = convertBytes(bytes, charset, offset);
    if (rememberDetectedSeparators) {
File
LoadTextUtil.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
  @NotNull
  public static CharSequence getTextByBinaryPresentation(@NotNull byte[] bytes, Charset charset) {
<<<<<<< HEAD
    Pair pair = getBOMAndCharset(bytes, charset);
    byte[] bom = pair.getSecond();
    int offset = bom == null ? 0 : bom.length;

    final Pair result = convertBytes(bytes, charset, offset);
    return result.getFirst();
=======
    Pair bomAndCharset = getBOMAndDetectedCharset(bytes, charset);
    return convertBytes(bytes, bomAndCharset.second, bomAndCharset.first.length).getFirst();
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  // do not need to think about BOM here. it is processed outside
Solution content
  @NotNull
  public static CharSequence getTextByBinaryPresentation(@NotNull byte[] bytes, Charset charset) {
    Pair pair = getBOMAndCharset(bytes, charset);
    byte[] bom = pair.getSecond();
    int offset = bom == null ? 0 : bom.length;

    final Pair result = convertBytes(bytes, charset, offset);
    return result.getFirst();
  }

  // do not need to think about BOM here. it is processed outside
File
LoadTextUtil.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
  @Nullable
  public PsiFile getCachedPsiFile(@NotNull VirtualFile vFile) {
    ApplicationManager.getApplication().assertReadAccessAllowed();
<<<<<<< HEAD
    LOG.assertTrue(vFile.isValid());
    if (myDisposed) {
      LOG.error("Project is already disposed: " + myManager.getProject());
    }
=======
    LOG.assertTrue(vFile.isValid(), "Invalid file");
    LOG.assertTrue(!myDisposed, "Already disposed");
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    if (!myInitialized) return null;

    dispatchPendingEvents();
Solution content
  @Nullable
  public PsiFile getCachedPsiFile(@NotNull VirtualFile vFile) {
    ApplicationManager.getApplication().assertReadAccessAllowed();
    LOG.assertTrue(vFile.isValid(), "Invalid file");
    if (myDisposed) {
      LOG.error("Project is already disposed: " + myManager.getProject());
    }
    if (!myInitialized) return null;

    dispatchPendingEvents();
File
FileManagerImpl.java
Developer's decision
Combination
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
  private JPanel myPanel;
  private JButton myExportAsGlobalButton;
  private JButton myCopyToProjectButton;
<<<<<<< HEAD
=======
  public JButton myPredefinedButton;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  private JBScrollPane myJBScrollPane;
  private boolean myIsReset = false;
  private NewCodeStyleSettingsPanel mySettingsPanel;
Solution content
  private JPanel myPanel;
  private JButton myExportAsGlobalButton;
  private JButton myCopyToProjectButton;
  private JBScrollPane myJBScrollPane;
  private boolean myIsReset = false;
  private NewCodeStyleSettingsPanel mySettingsPanel;
File
CodeStyleSchemesPanel.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
      }
    });
    
<<<<<<< HEAD
=======
    myPredefinedButton.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        selectPredefinedStyle();
      }
    });

>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    myJBScrollPane.setBorder(null);
  }
Solution content
      }
    });
    
    myJBScrollPane.setBorder(null);
  }
File
CodeStyleSchemesPanel.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
  private final Tree myTree = new Tree(myRoot);
  private final JPanel myRightPanel = new JPanel(new BorderLayout());
  private JComponent myToolbarComponent;
<<<<<<< HEAD
  private final Splitter mySplitter = new Splitter(false);
=======
  private final JSplitPane myPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  private JPanel myWholePanel;
  private StorageAccessors myConfig;
  private Configurable mySelectedConfigurable = null;
Solution content
  private final Tree myTree = new Tree(myRoot);
  private final JPanel myRightPanel = new JPanel(new BorderLayout());
  private JComponent myToolbarComponent;
  private final Splitter mySplitter = new Splitter(false);
  private JPanel myWholePanel;
  private StorageAccessors myConfig;
  private Configurable mySelectedConfigurable = null;
File
RunConfigurable.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
  public JComponent createComponent() {
    myWholePanel = new JPanel(new BorderLayout());
    myConfig = StorageAccessors.createGlobal("runConfigurationTab");
<<<<<<< HEAD
    mySplitter.setFirstComponent(createLeftPanel());
    mySplitter.setSecondComponent(myRightPanel);
    myWholePanel.add(mySplitter, BorderLayout.CENTER);
=======
    myPanel.setLeftComponent(createLeftPanel());
    myPanel.setRightComponent(myRightPanel);
    myPanel.setBorder(null);
    final int value = (int)myConfig.getFloat(DIVIDER_PROPORTION, 200);

    myPanel.setDividerLocation(value > 0 ? value : 200);
    myWholePanel.add(myPanel, BorderLayout.CENTER);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

    updateDialog();
Solution content
  public JComponent createComponent() {
    myWholePanel = new JPanel(new BorderLayout());
    myConfig = StorageAccessors.createGlobal("runConfigurationTab");
    mySplitter.setFirstComponent(createLeftPanel());
    mySplitter.setSecondComponent(myRightPanel);
    myWholePanel.add(mySplitter, BorderLayout.CENTER);

    updateDialog();
File
RunConfigurable.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
      }
    });
    myRightPanel.removeAll();
<<<<<<< HEAD
    myConfig.setFloat(DIVIDER_PROPORTION, mySplitter.getProportion());
=======
    myConfig.setFloat(DIVIDER_PROPORTION, myPanel.getDividerLocation());
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  private void updateDialog() {
Solution content
      }
    });
    myRightPanel.removeAll();
    myConfig.setFloat(DIVIDER_PROPORTION, mySplitter.getProportion());
  }

  private void updateDialog() {
File
RunConfigurable.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
          myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.getTodoFilterName());
        }

<<<<<<< HEAD
=======

>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
        final Consumer consumer = new Consumer() {
          @Override
          public void consume(TodoFilter todoFilter) {
Solution content
          myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.getTodoFilterName());
        }

        final Consumer consumer = new Consumer() {
          @Override
          public void consume(TodoFilter todoFilter) {
File
TodoCheckinHandler.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
          @Override
          public void linkSelected(LinkLabel aSource, Object aLinkData) {
            DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer);
<<<<<<< HEAD
            ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group);
            popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight());
          }
        }, null);
        panel.add(linkLabel, BorderLayout.CENTER);
=======
            ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR,
                                                                                          group);
            popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight());
          }
        }, null);
        panel.add(linkLabel);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

        refreshEnable(checkBox);
        return panel;
Solution content
          @Override
          public void linkSelected(LinkLabel aSource, Object aLinkData) {
            DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer);
            ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group);
            popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight());
          }
        }, null);
        panel.add(linkLabel, BorderLayout.CENTER);

        refreshEnable(checkBox);
        return panel;
File
TodoCheckinHandler.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
      return ((INativeFileType) type).openFileInAssociatedApplication(project, myFile);
    }

<<<<<<< HEAD
    return navigateInRequestedEditor() || navigateInAnyFileEditor(project, focusEditor);
=======
    return navigateInRequestedEditor() || navigateInAnyFileEditor(project, requestFocus);

>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  private boolean navigateInRequestedEditor() {
Solution content
      return ((INativeFileType) type).openFileInAssociatedApplication(project, myFile);
    }

    return navigateInRequestedEditor() || navigateInAnyFileEditor(project, requestFocus);
  }

  private boolean navigateInRequestedEditor() {
File
OpenFileDescriptor.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
        bottomColor = new Color(200, 200, 200);
      }

<<<<<<< HEAD
      int _y = y + MacUIUtil.MAC_COMBO_BORDER_V_OFFSET;
=======
      int _y = y + (SystemInfo.isMacOSLion ? 1 : 0);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      
      g.setColor(topColor);
      g.drawLine(x + 3, _y + 3, x + width - 1, _y + 3);
Solution content
        bottomColor = new Color(200, 200, 200);
      }

      int _y = y + MacUIUtil.MAC_COMBO_BORDER_V_OFFSET;
      
      g.setColor(topColor);
      g.drawLine(x + 3, _y + 3, x + width - 1, _y + 3);
File
FixedComboBoxEditor.java
Developer's decision
Version 1
Kind of conflict
Variable
Chunk
Conflicting content
      public void messageEdt(PlaybackContext context, String text, Type type) {
        if (type == Type.message || type == Type.error) {
<<<<<<< HEAD
          if (context != null) {
            frame.getStatusBar().setInfo("Line " + context.getCurrentLine() + ": " + text);
          } else {
            frame.getStatusBar().setInfo(text);
          }
=======
          frame.getStatusBar().setInfo((context != null ? "Line " + context.getCurrentLine() + ": " : "") + text);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
        }
      }
Solution content
      public void messageEdt(PlaybackContext context, String text, Type type) {
        if (type == Type.message || type == Type.error) {
          if (context != null) {
            frame.getStatusBar().setInfo("Line " + context.getCurrentLine() + ": " + text);
          } else {
            frame.getStatusBar().setInfo(text);
          }
        }
      }
File
ActionMacroManager.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
<<<<<<< HEAD
=======
import com.intellij.notification.impl.NotificationsConfigurationImpl;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.options.ShowSettingsUtil;
Solution content
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.options.ShowSettingsUtil;
File
StatisticsNotificationManager.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
public class StatisticsNotificationManager {

<<<<<<< HEAD
  public static final String GROUP_DISPLAY_ID = "IDE Usage Statistics";

  private StatisticsNotificationManager() {
=======
  static {
    NotificationsConfigurationImpl.remove("SendUsagesStatistics");
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  public static void showNotification(@NotNull RemotelyConfigurableStatisticsService statisticsService, Project project) {
Solution content
public class StatisticsNotificationManager {

  public static final String GROUP_DISPLAY_ID = "IDE Usage Statistics";

  private StatisticsNotificationManager() {
  }

  public static void showNotification(@NotNull RemotelyConfigurableStatisticsService statisticsService, Project project) {
File
StatisticsNotificationManager.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Method signature
Static initializer
Chunk
Conflicting content
    Document document = editor.getDocument();
    boolean scroll = document.getTextLength() == editor.getCaretModel().getOffset();

<<<<<<< HEAD
    Long notificationTime = myProjectModel.getNotificationTime(notification);
    if (notificationTime == null) {
      return;
    }
    
    append(document, DateFormatUtil.formatTimeWithSeconds(notificationTime) + " ");
=======
    append(document, DateFormatUtil.formatTimeWithSeconds(notification.getCreationTime()) + " ");
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

    EventLog.LogEntry pair = EventLog.formatForLog(notification);
Solution content
    Document document = editor.getDocument();
    boolean scroll = document.getTextLength() == editor.getCaretModel().getOffset();

    Long notificationTime = myProjectModel.getNotificationTime(notification);
    if (notificationTime == null) {
      return;
    }
    
    append(document, DateFormatUtil.formatTimeWithSeconds(notificationTime) + " ");

    EventLog.LogEntry pair = EventLog.formatForLog(notification);
File
EventLogConsole.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
  }

  void addNotification(Notification notification) {
<<<<<<< HEAD
    long stamp = System.currentTimeMillis();
=======
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    NotificationDisplayType type = NotificationsConfigurationImpl.getSettings(notification.getGroupId()).getDisplayType();
    if (notification.isImportant() || (type != NotificationDisplayType.NONE && type != NotificationDisplayType.TOOL_WINDOW)) {
      synchronized (myNotifications) {
Solution content
  }

  void addNotification(Notification notification) {
    long stamp = System.currentTimeMillis();
    NotificationDisplayType type = NotificationsConfigurationImpl.getSettings(notification.getGroupId()).getDisplayType();
    if (notification.isImportant() || (type != NotificationDisplayType.NONE && type != NotificationDisplayType.TOOL_WINDOW)) {
      synchronized (myNotifications) {
File
LogModel.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
      public void attributesChanged(@NotNull RangeHighlighterEx highlighter) {
        int textLength = myDocument.getTextLength();
<<<<<<< HEAD
=======
        if (textLength == 0) return;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0

        int start = Math.min(Math.max(highlighter.getAffectedAreaStartOffset(), 0), textLength - 1);
        int end = Math.min(Math.max(highlighter.getAffectedAreaEndOffset(), 0), textLength - 1);
Solution content
      public void attributesChanged(@NotNull RangeHighlighterEx highlighter) {
        int textLength = myDocument.getTextLength();

        int start = Math.min(Math.max(highlighter.getAffectedAreaStartOffset(), 0), textLength - 1);
        int end = Math.min(Math.max(highlighter.getAffectedAreaEndOffset(), 0), textLength - 1);
File
EditorImpl.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
        int start = Math.min(Math.max(highlighter.getAffectedAreaStartOffset(), 0), textLength - 1);
        int end = Math.min(Math.max(highlighter.getAffectedAreaEndOffset(), 0), textLength - 1);

<<<<<<< HEAD
        int startLine = start == -1 ? 0 : myDocument.getLineNumber(start);
        int endLine = end == -1 ? myDocument.getLineCount() : myDocument.getLineNumber(end);
=======
        int startLine = myDocument.getLineNumber(start);
        int endLine = myDocument.getLineNumber(end);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
        repaintLines(Math.max(0, startLine - 1), Math.min(endLine + 1, getDocument().getLineCount()));
        GutterIconRenderer renderer = highlighter.getGutterIconRenderer();
Solution content
        int start = Math.min(Math.max(highlighter.getAffectedAreaStartOffset(), 0), textLength - 1);
        int end = Math.min(Math.max(highlighter.getAffectedAreaEndOffset(), 0), textLength - 1);

        int startLine = start == -1 ? 0 : myDocument.getLineNumber(start);
        int endLine = end == -1 ? myDocument.getLineCount() : myDocument.getLineNumber(end);
        repaintLines(Math.max(0, startLine - 1), Math.min(endLine + 1, getDocument().getLineCount()));
        GutterIconRenderer renderer = highlighter.getGutterIconRenderer();
File
EditorImpl.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
                break;

              case 3:
<<<<<<< HEAD
                if (HONOR_CAMEL_HUMPS_ON_TRIPLE_CLICK && mySettings.isCamelWords()) {
                  // We want to differentiate between triple and quadruple clicks when 'select by camel humps' is on. The former
                  // is assumed to select 'hump' while the later points to the whole word.
                  selectWordAtCaret(false);
                  break;
                }
              case 4:
=======
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
                mySelectionModel.selectLineAtCaret();
                setMouseSelectionState(MOUSE_SELECTION_STATE_LINE_SELECTED);
                mySavedSelectionStart = mySelectionModel.getSelectionStart();
Solution content
                break;

              case 3:
                if (HONOR_CAMEL_HUMPS_ON_TRIPLE_CLICK && mySettings.isCamelWords()) {
                  // We want to differentiate between triple and quadruple clicks when 'select by camel humps' is on. The former
                  // is assumed to select 'hump' while the later points to the whole word.
                  selectWordAtCaret(false);
                  break;
                }
              case 4:
                mySelectionModel.selectLineAtCaret();
                setMouseSelectionState(MOUSE_SELECTION_STATE_LINE_SELECTED);
                mySavedSelectionStart = mySelectionModel.getSelectionStart();
File
EditorImpl.java
Developer's decision
Version 1
Kind of conflict
Case statement
If statement
Chunk
Conflicting content
    Project project = null;
    if (projectDir.exists()) {
      try {
<<<<<<< HEAD
        project = ((ProjectManagerImpl) projectManager).convertAndLoadProject(baseDir.getPath());
=======
        for (ProjectOpenProcessor processor : ProjectOpenProcessor.EXTENSION_POINT_NAME.getExtensions()) {
          processor.refreshProjectFiles(projectDir);
        }

        project = ((ProjectManagerImpl) projectManager).convertAndLoadProject(baseDir.getPath(), cancelled);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      }
      catch (Exception e) {
        // ignore
Solution content
    Project project = null;
    if (projectDir.exists()) {
      try {
        for (ProjectOpenProcessor processor : ProjectOpenProcessor.EXTENSION_POINT_NAME.getExtensions()) {
          processor.refreshProjectFiles(projectDir);
        }
        
        project = ((ProjectManagerImpl) projectManager).convertAndLoadProject(baseDir.getPath());
      }
      catch (Exception e) {
        // ignore
File
PlatformProjectOpenProcessor.java
Developer's decision
Combination
Kind of conflict
For statement
Method invocation
Variable
Chunk
Conflicting content
      return super.getMinimumSize();
    }

<<<<<<< HEAD
    Dimension size = new Dimension(1, 20);
    if (myEditor != null) {
      size.height = myEditor.getLineHeight();

      size = UIUtil.addInsets(size, getInsets());
      size = UIUtil.addInsets(size, myEditor.getInsets());
    }

    return size;
=======
    return new Dimension(100, getPreferredSize().height);
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  public void setPreferredWidth(int preferredWidth) {
Solution content
      return super.getMinimumSize();
    }

    Dimension size = new Dimension(1, 20);
    if (myEditor != null) {
      size.height = myEditor.getLineHeight();

      size = UIUtil.addInsets(size, getInsets());
      size = UIUtil.addInsets(size, myEditor.getInsets());
    }

    return size;
  }

  public void setPreferredWidth(int preferredWidth) {
File
EditorTextField.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
      @Override
      protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
<<<<<<< HEAD
        //Mnemonics and actions
        if (e.isAltDown() || e.isMetaDown() || e.isControlDown()) {
=======
        //Mnemonics
        if (e.isAltDown() || e.isMetaDown() || e.isShiftDown() || e.isControlDown()) {
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
          return false;
        }
Solution content
      @Override
      protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
        //Mnemonics and actions
        if (e.isAltDown() || e.isMetaDown() || e.isControlDown()) {
          return false;
        }
File
JBListTable.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Chunk
Conflicting content
      final Dimension firstPrefSize = myFirstComponent.getPreferredSize();
      final Dimension secondPrefSize = mySecondComponent.getPreferredSize();
      return getOrientation()
<<<<<<< HEAD
             ? new Dimension(Math.max(firstPrefSize.width, secondPrefSize.width),
                             firstPrefSize.height + dividerWidth + secondPrefSize.height)
             : new Dimension(firstPrefSize.width + dividerWidth + secondPrefSize.width,
                             Math.max(firstPrefSize.height, secondPrefSize.height));
=======
             ? new Dimension(Math.max(firstPrefSize.width, secondPrefSize.width), firstPrefSize.height + dividerWidth + secondPrefSize.height)
             : new Dimension(firstPrefSize.width + dividerWidth + secondPrefSize.width, Math.max(firstPrefSize.height, secondPrefSize.height));
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    }

    if (myFirstComponent != null && myFirstComponent.isVisible()) { // only first component is visible
Solution content
      final Dimension firstPrefSize = myFirstComponent.getPreferredSize();
      final Dimension secondPrefSize = mySecondComponent.getPreferredSize();
      return getOrientation()
             ? new Dimension(Math.max(firstPrefSize.width, secondPrefSize.width),
                             firstPrefSize.height + dividerWidth + secondPrefSize.height)
             : new Dimension(firstPrefSize.width + dividerWidth + secondPrefSize.width,
                             Math.max(firstPrefSize.height, secondPrefSize.height));
    }

    if (myFirstComponent != null && myFirstComponent.isVisible()) { // only first component is visible
File
Splitter.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
/**
 * @author Dmitry Avdeev
 */
<<<<<<< HEAD
public class MultiMap {
=======
public class MultiMap implements Serializable {

>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  public static final MultiMap EMPTY = new MultiMap() {
    @Override
    protected Map createMap() {
Solution content
/**
 * @author Dmitry Avdeev
 */
public class MultiMap implements Serializable {

  public static final MultiMap EMPTY = new MultiMap() {
    @Override
    protected Map createMap() {
File
MultiMap.java
Developer's decision
Version 2
Kind of conflict
Class signature
Chunk
Conflicting content
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
                         USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);

<<<<<<< HEAD
    int _y = MAC_COMBO_BORDER_V_OFFSET;
=======
    int _y = SystemInfo.isMacOSLion ? 1 : 0;
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    
    final GeneralPath path1 = new GeneralPath();
    path1.moveTo(2, _y + 4);
Solution content
    g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
                         USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);

    int _y = MAC_COMBO_BORDER_V_OFFSET;
    
    final GeneralPath path1 = new GeneralPath();
    path1.moveTo(2, _y + 4);
File
MacUIUtil.java
Developer's decision
Version 1
Kind of conflict
Attribute
Variable
Chunk
Conflicting content
      case SMALL:
        return Math.max(defSize - 2f, 11f);
      case MINI:
<<<<<<< HEAD
        return Math.max(defSize - 4f, 9f);
=======
        return base.deriveFont(Math.max(defFont.getSize() - 4f, 9f));
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      default:
        return defSize;
    }
Solution content
      case SMALL:
        return Math.max(defSize - 2f, 11f);
      case MINI:
        return Math.max(defSize - 4f, 9f);
      default:
        return defSize;
    }
File
UIUtil.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Chunk
Conflicting content
    }
  }

<<<<<<< HEAD
  public static void addInsets(@NotNull JComponent component, @NotNull Insets insets) {
=======
  public static void addInsets(JComponent component, Insets insets) {
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    if (component.getBorder() != null) {
      component.setBorder(new CompoundBorder(new EmptyBorder(insets), component.getBorder()));
    }
Solution content
    }
  }

  public static void addInsets(@NotNull JComponent component, @NotNull Insets insets) {
    if (component.getBorder() != null) {
      component.setBorder(new CompoundBorder(new EmptyBorder(insets), component.getBorder()));
    }
File
UIUtil.java
Developer's decision
Version 1
Kind of conflict
Method signature
Chunk
Conflicting content
=======
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      component.setBorder(new EmptyBorder(insets));
    }
  }
<<<<<<< HEAD
  
  public static Dimension addInsets(@NotNull Dimension dimension, @NotNull Insets insets) {

    Dimension ans = new Dimension(dimension);
    ans.width += insets.left;
    ans.width += insets.right;
    ans.height += insets.top;
    ans.height += insets.bottom;

    return ans;
  }
}
Solution content
      component.setBorder(new EmptyBorder(insets));
    }
  }
  
  public static Dimension addInsets(@NotNull Dimension dimension, @NotNull Insets insets) {

    Dimension ans = new Dimension(dimension);
    ans.width += insets.left;
    ans.width += insets.right;
    ans.height += insets.top;
    ans.height += insets.bottom;

    return ans;
  }
}
File
UIUtil.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
  public void testTime() throws ParseException {
    Clock.setTime(2004, 11, 10, 17, 10, 15);

<<<<<<< HEAD
    if (SystemInfo.isMac) {
      assertEquals("17:10", DateFormatUtil.formatTime(Clock.getTime()));
      assertEquals("17:10:15", DateFormatUtil.formatTimeWithSeconds(Clock.getTime()));
    }
    else {
      assertEquals(DateFormat.getTimeInstance(DateFormat.SHORT).format(Clock.getTime()),
                   DateFormatUtil.formatTime(Clock.getTime()));
      assertEquals(DateFormat.getTimeInstance(DateFormat.MEDIUM).format(Clock.getTime()),
                   DateFormatUtil.formatTimeWithSeconds(Clock.getTime()));
    }
=======
    assertEquals("17:10", DateFormatUtil.formatTime(Clock.getTime()));
    assertEquals("17:10:15", DateFormatUtil.formatTimeWithSeconds(Clock.getTime()));
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  public void testPrettyDateTime() throws ParseException {
Solution content
  public void testTime() throws ParseException {
    Clock.setTime(2004, 11, 10, 17, 10, 15);

    if (SystemInfo.isMac) {
      assertEquals("17:10", DateFormatUtil.formatTime(Clock.getTime()));
      assertEquals("17:10:15", DateFormatUtil.formatTimeWithSeconds(Clock.getTime()));
    }
    else {
      assertEquals(DateFormat.getTimeInstance(DateFormat.SHORT).format(Clock.getTime()),
                   DateFormatUtil.formatTime(Clock.getTime()));
      assertEquals(DateFormat.getTimeInstance(DateFormat.MEDIUM).format(Clock.getTime()),
                   DateFormatUtil.formatTimeWithSeconds(Clock.getTime()));
    }
  }

  public void testPrettyDateTime() throws ParseException {
File
DateFormatUtilTest.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
  protected boolean isEnabled(@NotNull Project project, @NotNull GitVcs vcs, @NotNull VirtualFile... vFiles) {
    for (VirtualFile file : vFiles) {
      FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
<<<<<<< HEAD
      if (file.isDirectory() || (fileStatus != FileStatus.NOT_CHANGED && fileStatus != FileStatus.DELETED && fileStatus != FileStatus.ADDED)) {
=======
      if (file.isDirectory() || (fileStatus != FileStatus.NOT_CHANGED && fileStatus != FileStatus.DELETED)) {
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
        return true;
      }
    }
Solution content
  protected boolean isEnabled(@NotNull Project project, @NotNull GitVcs vcs, @NotNull VirtualFile... vFiles) {
    for (VirtualFile file : vFiles) {
      FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
      if (file.isDirectory() || (fileStatus != FileStatus.NOT_CHANGED && fileStatus != FileStatus.DELETED && fileStatus != FileStatus.ADDED)) {
        return true;
      }
    }
File
GitAdd.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
      }

      public void startFailed(final Throwable exception) {
<<<<<<< HEAD
        ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception);
=======
        try {
          ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception);
        } finally {
          sem.release();
        }
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
      }
    });
    runInCurrentThread(null);
Solution content
      }

      public void startFailed(final Throwable exception) {
        ex[0] = new VcsException("Process failed to start (" + myCommandLine.getCommandLineString() + "): " + exception.toString(), exception);
      }
    });
    runInCurrentThread(null);
File
GitSimpleHandler.java
Developer's decision
Version 1
Kind of conflict
Array access
Method invocation
Try statement
Chunk
Conflicting content
  @Nullable
  public HgCommandResult executeInCurrentThread(@Nullable final VirtualFile repo, final String operation, final List arguments) {
<<<<<<< HEAD
    LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread());
=======
    //LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread());
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    if (myProject == null || myProject.isDisposed() || myVcs == null) {
      return null;
    }
Solution content
  @Nullable
  public HgCommandResult executeInCurrentThread(@Nullable final VirtualFile repo, final String operation, final List arguments) {
    LOG.assertTrue(!ApplicationManager.getApplication().isDispatchThread());
    if (myProject == null || myProject.isDisposed() || myVcs == null) {
      return null;
    }
File
HgCommandExecutor.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content
    return INSTANCE;
  }

<<<<<<< HEAD
  @Override
  public void split(@Nullable String text, @NotNull TextRange range, Consumer consumer) {
=======
   private static final Pattern HTML = Pattern.compile("<(\\S+?)[^<>]*?>(.*?)");


  public List split(@Nullable String text, @NotNull TextRange range) {
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
    if (text == null || StringUtil.isEmpty(text)) {
      return;
    }
Solution content
    return INSTANCE;
  }

  @Override
  public void split(@Nullable String text, @NotNull TextRange range, Consumer consumer) {
    if (text == null || StringUtil.isEmpty(text)) {
      return;
    }
File
CommentSplitter.java
Developer's decision
Version 1
Kind of conflict
Annotation
Attribute
Method invocation
Method signature
Chunk
Conflicting content
  public void testJavaComments() {
    String text = "/*special symbols*/";
<<<<<<< HEAD
    correctListToCheck(CommentSplitter.getInstance(), text, "special", "symbols");

=======
    List checkAreas = SplitterFactory.getInstance().getCommentSplitter().split(text);
    correctListToCheck(checkAreas, text, new String[]{"special", "symbols"});
>>>>>>> b8bf207ac0f89040cc51240ee8626732abf44fb0
  }

  public void _testJavaCommentsPerformance() {
Solution content
  public void testJavaComments() {
    String text = "/*special symbols*/";
    correctListToCheck(CommentSplitter.getInstance(), text, "special", "symbols");

  }


  public void testXmlComments() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "special", "symbols");

  }

  public void testCamelCaseInXmlComments() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "special", "Case", "symbols");

  }

  public void testWordsWithNumbers() {
    String text = "testCamelCase123";
    correctListToCheck(IdentifierSplitter.getInstance(), text, "test", "Camel", "Case");

  }

  public void testCommentsWithWordsWithNumbers() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "special", "Case", "symbols");

  }

  public void testCommentsWithAbr() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "Test", "Class");

  }

  public void testStringLiterals() {
    String text = "test\ntest\n";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "test", "test");

  }


  public void testCommentWithHtml() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "something", "here", "next", "content", "foooo", "barrrr",
                       "text");

  }

  public void testCommentWithHtmlTagsAndAtr() {
    String text = "";
    correctListToCheck(CommentSplitter.getInstance(), text, "something", "here", "foooo", "barrrr", "text", "text");

  }

  public void testSpecial() {
    String text = "test   test";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "test", "test");

  }

  public void testColorUC() {
    String text = "#AABBFF";
    correctListToCheck(WordSplitter.getInstance(), text);

  }

  public void testColorUCSC() {
    String text = "#AABBFF;";
    correctListToCheck(WordSplitter.getInstance(), text);

  }

  public void testColorUCSurrounded() {
    String text = "\"#AABBFF\"";
    correctListToCheck(WordSplitter.getInstance(), text);

  }

  public void testColorLC() {
    String text = "#fff";
    correctListToCheck(TextSplitter.getInstance(), text);

  }

  public void testTooShort() {
    String text = "bgColor carLight";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "Color", "Light");

  }

  public void testPhpVariableCorrectSimple() {
    String text = "$this";
    correctListToCheck(IdentifierSplitter.getInstance(), text, "this");

  }

  public void testPhpVariableCorrect() {
    String text = "$this_this$this";
    correctListToCheck(IdentifierSplitter.getInstance(), text, "this", "this", "this");

  }

  public void testEmail() {
    String text = "some text with email (shkate.test@gmail.com) inside";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "some", "text", "with", "email", "inside");

  }

  public void testEmailOnly() {
    String text = "shkate123-\u00DC.test@gmail.com";
    correctListToCheck(PlainTextSplitter.getInstance(), text);

  }

  public void testUrl() {
    String text = "http://www.jetbrains.com/idea";
    correctListToCheck(PlainTextSplitter.getInstance(), text);
  }

  public void testWordBeforeDelimiter() {
    String text = "badd,";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "badd");
  }

  public void testWordAfterDelimiter() {
    String text = ",badd";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "badd");
  }

  public void testWordInCapsBeforeDelimiter() {
    String text = "BADD,";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "BADD");

  }

  public void testWordInCapsAfterDelimiter() {
    String text = ",BADD";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "BADD");

  }

  public void testWordInCapsAfterDelimiter2() {
    String text = "BADD;";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "BADD");

  }

  public void testWordInCapsAfterDelimiter3() {
    String text = ";BADD;";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "BADD");
  }

  public void testWordWithUmlauts() {
    String text = "rechtsb\u00FCndig";
    correctListToCheck(PlainTextSplitter.getInstance(), text, text);
  }

  public void testWordUpperCasedWithUmlauts() {
    String text = "RECHTSB\u00DCNDIG";
    correctListToCheck(PlainTextSplitter.getInstance(), text, text);
  }

  public void testCommaSeparatedList() {
    String text = "properties,test,properties";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "properties", "test", "properties");

  }

  public void testSemicolonSeparatedList() {
    String text = "properties;test;properties";
    correctListToCheck(PlainTextSplitter.getInstance(), text, "properties", "test", "properties");

  }

  public void testProperties1() {
    String text = "properties.test.properties";
    correctListToCheck(PropertiesSplitter.getInstance(), text, "properties", "test", "properties");
  }


  public void testPropertiesWithCamelCase() {
    String text = "upgrade.testCommit.propertiesSomeNews";
    correctListToCheck(PropertiesSplitter.getInstance(), text, "upgrade", "test", "Commit", "properties", "Some",
                       "News");
  }

  public void testWordUpperCasedWithUmlautsInTheBeginning() {
    String text = "\u00DCNDIG";
    correctListToCheck(PlainTextSplitter.getInstance(), text, text);
  }


  public void testTCData() {
    final InputStream stream = SplitterTest.class.getResourceAsStream("contents.txt");
    String text = convertStreamToString(stream);
    List words = wordsToCheck(PlainTextSplitter.getInstance(), text);
    assertEquals(0, words.size());
  }


  private static List wordsToCheck(Splitter splitter, final String text) {
    final List words = new ArrayList();
    splitter.split(text, TextRange.allOf(text), new Consumer() {
      @Override
      public void consume(TextRange textRange) {
        words.add(textRange.substring(text));
      }
    });
    return words;
  }


  private static void correctListToCheck(Splitter splitter, String text, @NotNull String... expected) {
    List words = wordsToCheck(splitter, text);
    List expectedWords = Arrays.asList(expected);
    Assert.assertEquals("Splitting:'" + text + "'", expectedWords.toString(), words!=null ? words.toString() : "[]");
  }


  private String convertStreamToString(InputStream is) {
    if (is != null) {
      StringBuilder sb = new StringBuilder();
      String line;

      try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        while ((line = reader.readLine()) != null) {
          sb.append(line).append("\n");
        }
      }
      catch (Exception e) {
        throw new RuntimeException(e);
      }
      finally {
        try {
          is.close();
        }
        catch (IOException ignore) {

        }
      }
      return sb.toString();
    }
    else {
      return "";
    }
  }
}
File
SplitterTest.java
Developer's decision
Manual
Kind of conflict
Method invocation
Variable