
184 Chapter 7: Creating an Operation
Unregistering an Operation iTool Developer’s Guide
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:
self->UnregisterOperation,
identifier
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:
self->UnregisterOperation, 'Operations/Transform/Resample'
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.