Unregistering an Operation
If you are creating a new iTool from an existing iTool class, you may want to remove an operation registered for the existing class from your new tool. This can be useful if you have an iTool class that implements all of the functionality you need, but which registers an operation you don't want included in your iTool. Rather than recreating the iTool class to remove the operation, you could create your new iTool class in such a way that it inherits from the existing iTool class, but unregisters the unwanted operation.
Unregister an operation by calling the IDLitTool::UnregisterOperation method in the Init method of your iTool class:
where identifier is the string value of the IDENTIFIER property specified when registering the operation.
For example, suppose you are creating a new iTool that subclasses from the standard iSurface tool, which is defined by the IDLitToolSurface class. If you wanted your new tool to behave just like the iSurface tool, with the exception that it would not handle the resample operation, you could include the following method call in your iTool's Init method:
Finding the Identifier String
To find the string value used as the identifier parameter to the UnregisterOperation method, you can inspect the class file that registers the operation (if the operation is registered by a user-created class), or use the FindIdentifiers method of the IDLitTool object to generate a list of registered operations. (Standard iTool operations are pre-registered within the iTool framework.)
If the operation is registered in a user-created class, you could inspect the class definition file to find a call to the RegisterOperation method, which looks something like this:
self->RegisterOperation, 'Resample', 'idlitopresample', $ IDENTIFIER = 'Operations/Transform/Resample'
The value of the IDENTIFIER keyword to the RegisterOperation method ('Operations/Transform/Resample') is the string value of the operation's IDENTIFIER property.
Alternatively, to generate a list of relative identifiers for all operations registered with the current tool, use the following statements:
void = IGETCURRENT(TOOL=oTool) opslist = oTool->FindIdentifiers(/OPERATIONS) FOR i = 0, N_ELEMENTS(opslist)-1 DO PRINT, $ STRMID(opslist[i], STRPOS(opslist[i], '/OPERATIONS', $ /REVERSE_SEARCH)+1)
Note that the string in the call to STRPOS must be in upper case.
To refine the search so that only operations in the "Transform" folder are found, specify a search term as the argument to the FindIdentifiers method:
void = IGETCURRENT(TOOL=oTool) opslist = oTool->FindIdentifiers('*transform*', /OPERATIONS) FOR i = 0, N_ELEMENTS(opslist)-1 DO PRINT, $ STRMID(opslist[i], STRPOS(opslist[i], '/OPERATIONS', $ /REVERSE_SEARCH)+1)
See "IDLitTool::FindIdentifiers" (IDL Reference Guide) for details.