public void run(IProgressMonitor monitor) throws Exception {
    editBlackboard.startBatchingEvents();

    oldshape = shapeProvider.get(new SubProgressMonitor(monitor, 1));
    oldFeature = featureProvider.get(new SubProgressMonitor(monitor, 1));
    oldGeometry = (Geometry) oldFeature.getDefaultGeometry();
    layer = layerProvider.get(new SubProgressMonitor(monitor, 1));

    editBlackboard.removeGeometries(Collections.singleton(oldshape.getEditGeom()));
    ShapeType shapeType = oldshape.getEditGeom().getShapeType();
    EditGeom current =
        editBlackboard.newGeom(oldshape.getEditGeom().getFeatureIDRef().get(), shapeType);
    first = current;

    final Set<EditGeom> addedGeoms = new HashSet<EditGeom>();
    for (int i = 0; i < oldshape.getNumPoints(); i++) {
      addCoords(current.getShell(), i);
      if (current.getShell().getNumPoints() > 1
          && i < oldshape.getNumPoints() - 1
          && points.contains(oldshape.getPoint(i))) {

        current =
            editBlackboard.newGeom(
                "newFeature" + System.currentTimeMillis(), shapeType); // $NON-NLS-1$
        List<Coordinate> coords = oldshape.getCoordsAt(i);
        editBlackboard.addCoordinate(coords.get(coords.size() - 1), current.getShell());
        addedGeoms.add(current);
      }
    }

    editBlackboard.removeGeometries(addedGeoms);

    if (getCurrentShape() == oldshape) {
      currentShapeSet = true;
      setCurrentShape(first.getShell());
    }

    final FeatureStore<SimpleFeatureType, SimpleFeature> store =
        layer.getResource(FeatureStore.class, new SubProgressMonitor(monitor, 1));

    modifyOldFeature(store);

    createAndAddFeatures(addedGeoms, store);

    editBlackboard.fireBatchedEvents();
  }
  /** @see net.refractions.udig.project.internal.command.MapCommand#run() */
  @SuppressWarnings("deprecation")
  public void run(IProgressMonitor monitor) throws Exception {
    monitor.beginTask(Messages.WriteFeatureChangesCommand_runTask, 3);
    SubProgressMonitor subProgressMonitor = new SubProgressMonitor(monitor, 1);
    editFeature = featureProvider.get(subProgressMonitor);
    subProgressMonitor.done();
    store = storeProvider.get(subProgressMonitor);
    if (editFeature == null || store == null) {
      noChange = true;
      return;
    }

    FeatureType featureType = editFeature.getFeatureType();
    FilterFactory factory = FilterFactoryFinder.createFilterFactory();
    subProgressMonitor = new SubProgressMonitor(monitor, 1);
    subProgressMonitor.done();
    filter = factory.createFidFilter(editFeature.getID());
    FeatureCollection results = store.getFeatures(filter);

    FeatureIterator reader = results.features();
    try {
      if (reader.hasNext()) {
        try {
          store.modifyFeatures(
              featureType.getAttributeTypes(),
              editFeature.getAttributes(new Object[featureType.getAttributeCount()]),
              filter);
        } catch (Exception e) {
          ProjectPlugin.log("", e); // $NON-NLS-1$
          noChange = true;
        }

      } else {
        added = true;
        store.addFeatures(
            new StaticFeatureCollection(Collections.singleton(editFeature), featureType));
      }
    } finally {
      if (reader != null) reader.close();
    }
  }