Справочник Пользователя для ITT Rule IDL Version 7.0

Скачать
Страница из 430
246
Chapter 9: Creating a File Reader
Unregistering a File Reader
iTool Developer’s Guide
Unregistering a File Reader
If you are creating a new iTool from an existing iTool class, you may want to remove 
a file reader 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 a file reader you don’t want included in your iTool. Rather than recreating 
the iTool class to remove the file reader, you could create your new iTool class in 
such a way that it inherits from the existing iTool class, but unregisters the unwanted 
file reader.
Unregister a file reader by calling the IDLitTool::UnregisterFileReader method in the 
Init method of your iTool class:
self->UnregisterFileReader, 
identifier
where identifier is the string name used when registering the file reader.
For example, suppose you are creating a new iTool that subclasses from a standard 
iTool that is based on the IDLitToolbase class. If you wanted your new tool to behave 
just like the a standard tool, with the exception that it would not read PNG files, you 
could include the following method call in your iTool’s Init method:
self->UnregisterFileReader, 'PNG File Reader'
Finding the Identifier String
To find the string value used as the identifier parameter to the UnregisterFileReader 
method, you can inspect the class file that registers the file reader (if the file reader is 
registered by a user-created class), or use the FindIdentifiers method of the IDLitTool 
object to generate a list of registered file readers. (Standard iTool file readers are pre-
registered within the iTool framework.)
If the file reader is registered in a user-created class, you could inspect the class 
definition file to find a call to the RegisterFileReader method, which looks something 
like this:
self->RegisterFileReader, 'PNG File Reader', 'IDLitReadPNG'
The first argument to the RegisterFileReader method (
'PNG File Reader'
) is the 
string name of the file reader.
Alternatively, to generate a list of relative identifiers for all file readers registered 
with the current tool, use the following statements:
void = ITGETCURRENT(TOOL=oTool)
frlist = oTool->FindIdentifiers(/FILE_READERS)
FOR i = 0, N_ELEMENTS(frlist)-1 DO PRINT, $