Listing tools and environments


About lising tools and environments

When you initialize the geoprocessor in your program, you have access to all the tools contained in your system toolboxes and you can have your custom toolboxes added. Thus, you may have access to hundreds of tools. The geoprocessor has several appropriately named methods to return a list of tools (ListTools) and environments (ListEnvironments).
Each method has a wildcard option and can return a IGpEnumList of strings that can be looped through. The following code example lists tools and environments:
[Java]
// List all tools containing the name Clip.
IGpEnumList toolList = gp.listTools("*clip");
String toolName = toolList.next();
while (!"" .equals(toolName)){
    System.out.println(toolName);
    toolName = toolList.next();
}

// List all environment names.
IGpEnumList envList = gp.listEnvironments("*");
String envName = envList.next();
while (!"" .equals(envName)){
    System.out.println(envName);
    envName = toolList.next();
}