AnsweredAssumed Answered

How to undo operation in ArcMap Add-in

Question asked by petrvopenka on May 2, 2012
Latest reply on May 9, 2012 by petrvopenka
I am trying to programatically undo cutting of polygons if the area of newly created polygon is too small. However, the operation does no undo edits. It shows the dialog, but it does not roll back the edits. No errors are thrown in this example.

editor.addIEditEventsListener(new IEditEventsAdapter(){      public void onCreateFeature(IEditEventsOnCreateFeatureEvent theEvent)             throws IOException, AutomationException{                            IFeature createdFeature = (IFeature)theEvent.getObj();              Polygon newPolygon = (Polygon)createdFeature.getShape();           double newPolyArea = newPolygon.getArea();                      if(newPolyArea < 1000){            MessageDialog md = new MessageDialog();            md.doModal("Error editing", "Polygon too small" , null, null, 0);                        doc.getOperationStack().undo();              }           }      }


Is there any example of how to solve undos withing ArcMap Add-in?

Outcomes