private void selectReferencesKeys()
   {
      // Method Instances.
      JPanel referenceKeysPanel;
      JPanel primaryKeysListPanel, foreignKeysListPanel;
      
      ListIterator<QueryTokens.Table> tableListIterator;
      JList<String> primaryKeyTablesList, foreignKeyTablesList;
      DefaultListModel<String> primaryKeyListModel, foreignKeyListModel;
      QueryTokens.Table keyTable;
      
      InputDialog referenceKeysDialog;
      String resource, resourceOK, resourceCancel;
      
      // Top panel
      referenceKeysPanel = new JPanel(new GridLayout(1, 2, 2, 2));
      referenceKeysPanel.setBorder(BorderFactory.createEtchedBorder());
      
      // Exported Keys List
      foreignKeyTablesList = new JList<String>();
      foreignKeyListModel = new DefaultListModel<String>();
      
      tableListIterator = getExportedKeysTable().listIterator();
      
      while (tableListIterator.hasNext())
      {
         String keyElement;
         keyTable = tableListIterator.next();
         
         if (keyTable.getSchema() == null)
            keyElement = keyTable.getName();
         else
            keyElement = keyTable.getSchema() + SQLFormatter.DOT + keyTable.getName();
         
         if (!foreignKeyListModel.contains(keyElement))
            foreignKeyListModel.addElement(keyElement);
      }
      foreignKeyTablesList.setModel(foreignKeyListModel);
      
      foreignKeysListPanel = new JPanel(new BorderLayout(2, 2));
      foreignKeysListPanel.setBorder(BorderFactory.createLoweredBevelBorder());
      
      foreignKeysListPanel.add(new JLabel(queryBuilderPane.sqlDiagramViewPanel.getDiagramResource(
         "DiagramEntity.label.ForeignTables"), JLabel.CENTER), BorderLayout.NORTH);
      foreignKeysListPanel.add(new JScrollPane(foreignKeyTablesList), BorderLayout.CENTER);
      
      referenceKeysPanel.add(foreignKeysListPanel);
      
      // Imported Keys List
      primaryKeyTablesList = new JList<String>();
      primaryKeyListModel = new DefaultListModel<String>();
      
      tableListIterator = getImportedKeysTable().listIterator();
      while (tableListIterator.hasNext())
      {
         String keyElement;
         keyTable = tableListIterator.next();
         
         if (keyTable.getSchema() == null)
            keyElement = keyTable.getName();
         else
            keyElement = keyTable.getSchema() + SQLFormatter.DOT + keyTable.getName();
         
         if (!primaryKeyListModel.contains(keyElement))
            primaryKeyListModel.addElement(keyElement);
      }
      primaryKeyTablesList.setModel(primaryKeyListModel);
      
      primaryKeysListPanel = new JPanel(new BorderLayout(2, 2));
      primaryKeysListPanel.setBorder(BorderFactory.createLoweredBevelBorder());
      
      primaryKeysListPanel.add(new JLabel(queryBuilderPane.sqlDiagramViewPanel.getDiagramResource(
         "DiagramEntity.label.PrimaryTables"), JLabel.CENTER), BorderLayout.NORTH);
      primaryKeysListPanel.add(new JScrollPane(primaryKeyTablesList), BorderLayout.CENTER);
      
      referenceKeysPanel.add(primaryKeysListPanel);
      
      // Setup the dialog with the content.
      Object content[] = {referenceKeysPanel};

      resource = queryBuilderPane.sqlDiagramViewPanel.getDiagramResource(
         "DiagramEntity.label.ReferencesKeys");
      resourceOK = queryBuilderPane.sqlDiagramViewPanel.getDiagramResource("SQLDiagramViewPanel.button.OK");
      resourceCancel = queryBuilderPane.sqlDiagramViewPanel.getDiagramResource(
         "SQLDiagramViewPanel.button.Cancel");
      
      referenceKeysDialog = new InputDialog(null, resource, resourceOK, resourceCancel,
                                                  content, null);
      referenceKeysDialog.pack();
      referenceKeysDialog.setPreferredSize(new Dimension(400,220));
      referenceKeysDialog.setResizable(true);
      referenceKeysDialog.center();
      referenceKeysDialog.setVisible(true);

      // Act on confirm selection.

      if (referenceKeysDialog.isActionResult())
      {
         addReferencesKeys(foreignKeyTablesList.getSelectedValuesList().toArray());
         addReferencesKeys(primaryKeyTablesList.getSelectedValuesList().toArray());
      }
      referenceKeysDialog.dispose();
   }