How to disable an Editor Extension

12-14-2020 10:22 AM
Regular Contributor


I've created an Editor Extension add-in.  I have created the following in the config.daml but the extension is not showing up in the "Customize - Extensions" menu:



  <AddIn language="CLR" library="MaximoEditorExtension.dll" namespace="MaximoEditorExtension">
          <Extension id="Works_-_Tech_MaximoEditorExtension_Maximo_Editor_Extension" class="Maximo_Editor_Extension" productName="Maximo Editor Extension" showInExtensionDialog="true">
            <Description>Updates Maximo fields and Editor Tracking information.</Description>




So whenever I start editing the extension is always 'enabled', but I would like the user to be able to toggle it on/off as desired.

If I remove the <Editor> and </Editor> tags, the extensions will then show up, but it doesn't always disable when I 'uncheck' it from the Extensions window.

How do I get it to show up and function properly.


0 Kudos
4 Replies
Regular Contributor

OK, so I've created a work around for this but regardless of whether I create an Editor Extension, or just an Extension, I cannot get the extension to toggle on/off....even when it is showing in the Extensions Window with the toggle checkbox.

What I am going with is an Editor Extension, and I have created a way for the user to 'disable' the functionality when they start editing by answering a question to a MessageBox:

void Events_OnStartEditing()
            maximoTracking = false;

            if (MessageBox.Show("Would you also like to enable the Maximo edit tracking?", "Enable Maximo Tracking?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                maximoTracking = true;


I'm thinking there has got to be a better way to do this, but for now this is working.

I did find some ideas in this thread, but nothing seemed to work:


0 Kudos
Regular Contributor

OK, so as a follow up to my workaround above, this is not an ideal solution.  Apparantly the _OnStartEditing event fires many times during an edit session.  It fires:

1. when you first click the Start Editing button

2. when you click on Save Edits

3. when you Reconcile/Post your edits


Probably other times too, so my Message Box from the solution above keeps displaying to the user.  

So I guess back to my original questions, can anyone suggest a way to toggle on/off an editor extensions?  Or get a regular extension that displays in the Extensions Window to actually toggle off when you uncheck the checkbox??



0 Kudos
Esri Regular Contributor

Hey Brian,

Add-in editor extensions cant be added to the extension manager as their lifetime is controlled by the Editor extension itself. They startup with the Editor (when ArcMap starts) and like all extensions shutdown when ArcMap closes. The showInExtensionDialog tag has no effect here. Editor extensions otherwise provide convenient hooks to the Editor and its events. Controls delivered with an Editor extension usually tie their state (enabled/disabled) with the edit session state.

You can create a regular extension that includes editing controls/functions and appears in the extension manager by using that tag. Assuming autoload is false, the checkbox in the manager does two things; It starts the extension when checked and provides an additional state property (ExtensionState). Unchecking an extension in the manager only changes the state property. The extension does not ShutDown until Arcmap closes. Any controls provided with the extension should now also look for the ExtensionState property to set their availability. For an example of this in action take a look at the SelectionExtension sample. Take note in the example how events are subscribed/unsubscribed based on the extensionstate property.

Start/Stop editing events

The trick with the geodatabase, and all databases, is there is no save. You have a transaction that is either committed or discarded and the transaction ends. When you save edits, behind the scenes we commit and stop the database transaction (StopEditing fires with boolean true) then start a new transaction (StartEditing fires). The SaveEdits event does its own thing. A save does occur during post/reconcile.

Hope this helps and thanks for digging up ArcObjects memories...

0 Kudos
Regular Contributor

Hi @SeanJones 

Sorry for the delay getting back to you.  Yes, going back to ArcObjects projects is definitely a huge PITA, but unfortuntely I have to travel that road from time to time.

Even with the help you gave me above, I am having a hard time getting things to work in a regular Extension.  I can get the Editor Extension to work, but then of course it is always "ON", which is not ideal but I'm going to run with it for now.

Most likely I'll be back here in a few weeks with some questions and hopefully a clear mind to think this through a bit better.


Happy Holidays!!