private List<OsmPrimitive> getSelectedSubjectPrimitives() {
    List<OsmPrimitive> selection = new ArrayList<>();
    if (tabbedPane == null || tabbedPane.getSelectedComponent() == null) return selection;

    if (tabbedPane.getSelectedComponent().equals(matchTable)) {
      for (SimpleMatch c : matches.getSelected()) {
        selection.add(c.getSubjectObject());
      }
    } else if (tabbedPane.getSelectedComponent().equals(subjectOnlyList)) {
      selection.addAll(subjectOnlyList.getSelectedValuesList());
    }
    return selection;
  }
  @Override
  public void primitivesRemoved(PrimitivesRemovedEvent event) {
    List<? extends OsmPrimitive> prims = event.getPrimitives();
    for (OsmPrimitive p : prims) {
      // TODO: use hashmap
      for (SimpleMatch c : matches) {
        if (c.getReferenceObject().equals(p) || c.getSubjectObject().equals(p)) {
          matches.remove(c);
          break;
        }
      }

      referenceOnlyListModel.removeElement(p);
      subjectOnlyListModel.removeElement(p);
    }
  }
  private void performMatching() {
    matches = generateMatches(settings);

    // populate unmatched objects
    List<OsmPrimitive> referenceOnly = new ArrayList<>(settings.getReferenceSelection());
    List<OsmPrimitive> subjectOnly = new ArrayList<>(settings.getSubjectSelection());
    for (SimpleMatch match : matches) {
      referenceOnly.remove(match.getReferenceObject());
      subjectOnly.remove(match.getSubjectObject());
    }

    referenceOnlyListModel.clear();
    referenceOnlyListModel.addAll(referenceOnly);
    subjectOnlyListModel.clear();
    subjectOnlyListModel.addAll(subjectOnly);

    updateTabTitles();

    matchTableModel.setMatches(matches);
    matches.addConflationListChangedListener(matchTableModel);
    matches.addConflationListChangedListener(conflateAction);
    matches.addConflationListChangedListener(removeAction);
    matches.addConflationListChangedListener(this);
    settings.getSubjectDataSet().addDataSetListener(this);
    settings.getReferenceDataSet().addDataSetListener(this);
    // add conflation layer
    try {
      if (conflationLayer == null) {
        conflationLayer = new ConflationLayer(matches);
        Main.main.addLayer(conflationLayer);
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          Main.parent, ex.toString(), "Error adding conflation layer", JOptionPane.ERROR_MESSAGE);
    }
    //        matches.addConflationListChangedListener(conflationLayer);
  }