Difficulty getting Editor Extension Addin to show up in extension dialog

2344
6
10-27-2010 03:32 PM
RyanClark
New Contributor II
I am trying to implement an editor extension that can be toggled on/off using the Extension Dialog. I'm building this as an Add-in using C#. I've setup my Config.esriaddinx to read:
<Extension id="Arizona_Geological_Survey_ncgmpToolbar_ncgmpEditorExtension" autoLoad="true" productName="NCGMP Editor" showInExtensionDialog="true" class="ncgmpEditorExtension" />


However, the "NCGMP Editor" extension still does not show up in the Extensions dialog. I'm not sure what I'm missing... Does something else need to be implemented in the code for the extension itself? The help documentation would suggest that all I need to do is make the showInExtensionDialog attribute true.

Thanks,
Ryan
0 Kudos
6 Replies
RyanClark
New Contributor II
I tried setting up a "dummy" addin with nothing but an editor extension. I then set the "showInExtensionDialog" attribute to true in the Config.esriaddinx document. Still, nothing appears in the extension dialog. I've attached the source code for this simple addin.

The help document for ESRI.Desktop.Addins.Extension class says that the "extension can also be configured to appear in the standard ArcGIS extension dialog by setting showInExtensionDialog to true in the add-in xml". Apparently this is not true, or at the very least there's more to it than the help documentation is suggesting. Has anyone tried to enable/disable an add-in-based extension in this manner?
0 Kudos
EagerIp
New Contributor II
Editor extensions do not get listed in the Extension Manager dialog since they are managed by the Editor instead. If you implement a regualr extension, the show in extension dialog property will apply.
0 Kudos
RyanClark
New Contributor II
Does that mean that there is not an easy way to enable/disable an editor extension that you built as part of an Addin?

Fundamentally, what is the difference between an Editor Extension and some other extension? Is there some other class? My editor extension uses the ESRI.ArcGIS.Desktop.AddIns.Extension class, I have to manually wire the edit events anyways -- when the SDK spins up the class for an editor extension the only difference from a regular extension appears to be the presence of
IEditor theEditor = ArcMap.Editor
in the OnStartup() function.

It seems like this used to be no problem, you'd just have to implement the IExtensionConfig interface on your extension. Would that still work for an editor extension built through the Addin SDK?

Can I just take the <Editor> tags off from around the <Extensions><Extension id ="...> in the Config.esriaddinx?
0 Kudos
by Anonymous User
Not applicable
Ryan,

Fundamentally, what is the difference between an Editor Extension and some other extension?


Editor extensions are a type of extension that start and stop with an edit session. You have no control over this and cant add an entry into the extensions dialog for these.
Regular extensions such as ArcMap extensions start and stop with the application (e.g ArcMap), unless you specify JIT loading for the extension in which case the extension loads and starts when it is first accessed.
Regular extensions created via the add-in wizard allow you to specify both JIT (auto load) and add an entry to the extensions dialog.

In your case if you want to create an extension that can be toggled within an edit session then you have to create a regular extension. Keep in mind the checkbox for an extension in the dialog is simply a state flag and you will need to enable your customizations accordingly.
0 Kudos
RyanClark
New Contributor II
I'm trying to build a separate button to use to toggle the editor extension on/off. In the button's OnClick(), I've tried the following two methods to get a reference to the extension itself:
protected override void OnClick()
        {
            //UID theUID = new UIDClass();
            //theUID.Value = ThisAddIn.IDs.ncgmpEditorExtension;

            //ncgmpEditorExtension theExt = ArcMap.Application.FindExtensionByCLSID(theUID) as ncgmpEditorExtension;

            var theExt = ESRI.ArcGIS.Desktop.AddIns.AddIn.FromID<ncgmpEditorExtension>(ThisAddIn.IDs.ncgmpEditorExtension);

            try
            {
                if (theExt.Enabled == true) { theExt.Enabled = false; }
                else { theExt.Enabled = true; }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }


In both cases (the commented section and the un-commented section...), theExt object is Null -- it isn't getting a reference to my editor extension. Any idea why? It doesn't matter if I'm currently editing or not - either way, null object.

Thanks,
Ryan
0 Kudos
LukeBadgerow
New Contributor
Editor extensions do not get listed in the Extension Manager dialog since they are managed by the Editor instead. If you implement a regualr extension, the show in extension dialog property will apply.


I'm getting that far.  Where I'm having difficulty is after I've completed the sketch, say of a water main (any line feature), and that handy little toolbar goes away... I can't get my event listeners to fire off the dialog window that I am trying to create for my users.  

I would have expected I could wrap a method around IEditEvents_Event.OnSketchFinished that would display my window, but I'm struggling to get alert messages to populate from anyplace within my AddIns.Extension class.  Any advice would be great.

a caveat I built the orig project as a toolbar then the project has morphed, could that be part of my issue?
0 Kudos