private InstanceListPane initInstanceListPane(List instances, String title) {
    InstanceListPane instanceList = new InstanceListPane();
    instanceList.getInstanceList().addListSelectionListener(selectionListener);
    instanceList.setIsViewable(false);
    if (mouseAdaptor == null) {
      // To view instances
      mouseAdaptor =
          new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              if (e.isPopupTrigger()) doPopup(e);
            }

            public void mouseReleased(MouseEvent e) {
              if (e.isPopupTrigger()) doPopup(e);
            }

            // Use mouseClicked method. See InstanceListPane.init().
            public void mouseClicked(MouseEvent e) {
              if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
                JList list = (JList) e.getSource();
                if (list.getSelectedValues().length != 1) return;
                InstanceListPane instanceList = figureOutInstanceListPane(list);
                if (instanceList == changedList || instanceList == localHasMoreIEList) {
                  showComparison();
                } else {
                  GKInstance instance = (GKInstance) list.getSelectedValue();
                  JDialog parentDialog =
                      (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, centerPane);
                  FrameManager.getManager().showInstance(instance, parentDialog);
                }
              }
            }
          };
    }
    instanceList.getInstanceList().addMouseListener(mouseAdaptor);
    InstanceUtilities.sortInstances(instances);
    instanceList.setDisplayedInstances(instances);
    // instanceList.setTitle(title);
    instanceList.setListCellRenderer(cellRenderer);
    instanceList.hideTitle();
    SectionTitlePane titlePane = new SectionTitlePane(title);
    titlePane.setSectionPane(instanceList);
    centerPane.add(titlePane);
    centerPane.add(instanceList);
    listToTitle.put(instanceList, titlePane);
    return instanceList;
  }
 private void handleMergeResult(
     GKInstance localCopy, GKInstance dbCopy, InstanceComparisonPane comparisonPane) {
   if (comparisonPane.getSaveMergeOption() == InstanceComparisonPane.OVERWRITE_FIRST) {
     // Need to refresh the selected instance
     InstanceComparer comparer = new InstanceComparer();
     try {
       int result = comparer.compare(localCopy, dbCopy);
       if (result != InstanceComparer.IS_IDENTICAL) {
         typeMap.put(localCopy, mapCompareResultToString(result));
       } else {
         typeMap.remove(localCopy);
         changedList.deleteInstance(localCopy);
       }
       changedList.repaint();
     } catch (Exception e1) {
       System.err.println("SynchronizationDialog.handleMergeResult(): " + e1);
       e1.printStackTrace();
     }
   } else if (comparisonPane.getSaveMergeOption() == InstanceComparisonPane.SAVE_AS_NEW) {
     // Need to add a new instance to the local new instance
     GKInstance newInstance = comparisonPane.getMerged();
     List newInstances = (List) syncMap.get(NEW_KEY);
     if (newInstances == null) {
       newInstances = new ArrayList();
       syncMap.put(NEW_KEY, newInstances);
     }
     newInstances.add(newInstance);
     typeMap.put(newInstance, NEW_KEY);
     if (newList == null) {
       // Get some information from changed
       newList =
           initInstanceListPane(newInstances, "Instances created locally: " + newInstances.size());
       centerPane.validate();
     } else {
       // Cannot call this method because it is used for one schema class only
       // newList.addInstance(newInstance);
       newList.setTitle("Instances created locally: " + newInstances.size());
       newList.setDisplayedInstances(newInstances);
       newList.repaint();
     }
   }
 }