A SERVICE OF

logo

270 Chapter 10: Creating a File Writer
Unregistering a File Writer iTool Developer’s Guide
Unregistering a File Writer
If you are creating a new iTool from an existing iTool class, you may want to remove
a file writer 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 writer you don’t want included in your iTool. Rather than recreating
the iTool class to remove the file writer, you could create your new iTool class in
such a way that it inherits from the existing iTool class, but unregisters the unwanted
file writer.
Unregister a file writer by calling the IDLitTool::UnregisterFileWriter method in the
Init method of your iTool class:
self->UnregisterFileWriter,
identifier
where identifier is the string name used when registering the file writer.
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 a standard tool, with the exception that it would not export PNG files, you
could include the following method call in your iTool’s Init method:
self->UnregisterFileWriter, 'PNG File Writer'
Finding the Identifier String
To find the string value used as the identifier parameter to the UnregisterFileWriter
method, you can inspect the class file that registers the file writer (if the file writer is
registered by a user-created class), or use the FindIdentifiers method of the IDLitTool
object to generate a list of registered file writers. (Standard iTool file writers are pre-
registered within the iTool framework.)
If the file writer is registered in a user-created class, you could inspect the class
definition file to find a call to the RegisterFileWriter method, which looks something
like this:
self->RegisterFileWriter, 'PNG File Writer', 'IDLitReadPNG'
The first argument to the RegisterFileWriter method ('PNG File Writer') is the
string name of the file writer.
Alternatively, to generate a list of relative identifiers for all file writers registered
with the current tool, use the following statements:
void = ITGETCURRENT(TOOL=oTool)
fwlist = oTool->FindIdentifiers(/FILE_WRITERS)
FOR i = 0, N_ELEMENTS(fwlist)-1 DO PRINT, $