Select to view content in your preferred language

Deactivate add-in Tool

2668
3
Jump to solution
02-03-2012 05:27 AM
LeoDonahue
Deactivated User
ArcGIS 10.0 Tool Add-in.

ITool has a deactivate method that is called by the system when you click on another tool from the previous tool in use.  How can I call that deactivate method?  I can't seem to find a class that returns a reference to Tool.
0 Kudos
1 Solution

Accepted Solutions
GeorgeFaraj
Frequent Contributor
ArcGIS 10.0 Tool Add-in.

ITool has a deactivate method that is called by the system when you click on another tool from the previous tool in use.  How can I call that deactivate method?  I can't seem to find a class that returns a reference to Tool.


Shouldn't you just set the 'CurrentTool?'

View solution in original post

0 Kudos
3 Replies
GeorgeFaraj
Frequent Contributor
ArcGIS 10.0 Tool Add-in.

ITool has a deactivate method that is called by the system when you click on another tool from the previous tool in use.  How can I call that deactivate method?  I can't seem to find a class that returns a reference to Tool.


Shouldn't you just set the 'CurrentTool?'
0 Kudos
LeoDonahue
Deactivated User
Maybe you are right.

My tool add-in resides in this package: com.esri.arcgis.addins.desktop.Tool  Which means I can't cast anything like ICommand to my add-in tool.

java.lang.ClassCastException: com.esri.arcgis.systemUI.ICommandProxy cannot be cast to com.esri.arcgis.addins.desktop.Tool


When you "set the Curent Tool", do you use the execute method on CommandItem?  I don't see an 'activate' method on CommandItem.  Or what is the way to set the current tool?

I would have thought I could just call the deactivate() method since my class extends Tool and implements that method which is in the com.esri.arcgis.addins.desktop.Tool package.  Nothing happens when I call deactivate.
0 Kudos
GeorgeFaraj
Frequent Contributor
All Engine myself so I don't know the ins-and-outs of extensions but the 'CurrentTool' is a property of IApplication (and the MapControl and Toolbar and so on.) I suspect you should use something derived from IApplication, like:

IApplication app = GetMeSomehow();
app.CurrentTool = null; // (or 'Nothing' if VB)
0 Kudos