I am developing an editor extension for ArcMap. The extension should forbid changes to features, which have a attribute value "deny" in a column to restrict any change to the feature. Therefore I check on every OnChangeFeature event if the feature has the attribute value "deny". If this is the case, the change has to be aborted. But when I call IEditor.AbortOperation(), a message box is displayed, for example "The feature(s) could not be moved. Failed to move related features [FeatureClass]" when moving a feature. Is there a way to get rid of that massage box or at least to customize the text?#region IExtension Implementations
public void Shutdown()
{
_editor = null;
_editEvents = null;
}
public string Name
{
get { return "ValidateFeatures_Extension"; }
}
public void Startup(ref object initializationData)
{
if (initializationData != null && initializationData is IEditor)
{
_editor = (IEditor)initializationData;
//Wire editor events.
_editEvents = (IEditEvents_Event)_editor;
_editEvents.OnStartEditing += EditEventsOnStartEditing;
}
}
#endregion
#region Editor event notification implementation
private void EditEventsOnStartEditing()
{
if (_editor.EditWorkspace.Type == esriWorkspaceType.esriFileSystemWorkspace)
{
return;
}
_editEvents.OnChangeFeature += EditEventsOnChangeFeature;
_editEvents.OnCreateFeature += EditEventsOnCreateFeature;
}
private void EditEventsOnChangeFeature(IObject obj)
{
Validate(obj as IFeature);
}
private void EditEventsOnCreateFeature(IObject obj)
{
Validate(obj as IFeature);
}
#endregion
private void Validate(IFeature inFeature)
{
var fieldIndex = inFeature.Fields.FindField("DENYCHANGES");
if (fieldIndex < 0)
{
return;
}
if (inFeature.Value[fieldIndex].Equals("deny"))
{
_editor.AbortOperation();
}
}