public void testDeleteSelection() throws Exception {
    IStructuredSelection selection =
        new StructuredSelection(new SimpleFeature[] {feature1, feature3});
    table.setSelection(selection);

    UDIGTestUtil.inDisplayThreadWait(
        1000,
        new WaitCondition() {

          public boolean isTrue() {
            return table.getSelectionCount() == 2;
          }
        },
        false);

    table.deleteSelection();

    UDIGTestUtil.inDisplayThreadWait(
        1000,
        new WaitCondition() {

          public boolean isTrue() {
            return table.getViewer().getTable().getItemCount() == 2;
          }
        },
        false);

    assertEquals(feature2, table.getViewer().getTable().getItem(0).getData());
    assertEquals(feature4, table.getViewer().getTable().getItem(1).getData());
    assertEquals(0, table.getSelectionCount());
    assertTrue(table.getSelection().isEmpty());
  }
  private void selectFeature(final int index, boolean reveal) throws Exception {

    final Table tree = table.getViewer().getTable();

    FilterFactory fac = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    final String fid = "feature" + (index + 1); // $NON-NLS-1$
    Set<Identifier> ids = FeatureUtils.stringToId(fac, fid);
    Id selection = fac.id(ids);
    table.setSelection(new StructuredSelection(selection), reveal);
    UDIGTestUtil.inDisplayThreadWait(
        3000,
        new WaitCondition() {

          public boolean isTrue() {
            TableItem item = tree.getItem(index);
            if (item.getData() == null) return false;
            return fid.equals(((SimpleFeature) item.getData()).getID());
          }
        },
        false);
  }