Add-in ComboBox - Java

716
2
Jump to solution
03-04-2013 04:03 AM
LeoDonahue
Occasional Contributor III
Why did the Java Add-in ComboBox not include a reference to the application in the initialize method? The other add-ins get that reference in their corresponding init methods.

I can get the hook for the ComboBox using HookHelper, which gives me IActiveView, IMap and IPageLayout, but just curious why the implementation for this add-in did not give us a reference to IApplication.
0 Kudos
1 Solution

Accepted Solutions
LeoDonahue
Occasional Contributor III
Adding the IComboBox hook.

I guess I just expected a reference to IApplication in the initialize method, or at least the docs could have shown this in the combo box example.

    /**      * Called when the combo box is initialized. Subclasses must implement this method      * to add entries to the combo box using the add() method.      *       * @exception java.io.IOException if there are interop problems.      * @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.      */     @Override     public void initialize() {                  try {                               IHookHelper hookHelper = new HookHelper();             hookHelper.setHookByRef(this.hook.getHook());              // hookHelper now gives you access to IActiveView, IMap and IPageLayout.                      } catch (AutomationException e) {             e.printStackTrace();         } catch (IOException e) {             e.printStackTrace();         }     }

View solution in original post

0 Kudos
2 Replies
LeoDonahue
Occasional Contributor III
Adding the IComboBox hook.

I guess I just expected a reference to IApplication in the initialize method, or at least the docs could have shown this in the combo box example.

    /**      * Called when the combo box is initialized. Subclasses must implement this method      * to add entries to the combo box using the add() method.      *       * @exception java.io.IOException if there are interop problems.      * @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.      */     @Override     public void initialize() {                  try {                               IHookHelper hookHelper = new HookHelper();             hookHelper.setHookByRef(this.hook.getHook());              // hookHelper now gives you access to IActiveView, IMap and IPageLayout.                      } catch (AutomationException e) {             e.printStackTrace();         } catch (IOException e) {             e.printStackTrace();         }     }
0 Kudos
ArjunDongre
Occasional Contributor

Resurrecting this thread, but do you remember how you went about discovering your answer?

0 Kudos