// Check if there are any generators defined for this item type that operate on an existing item
List list = GeneratorMgr.getInstance().getGenerators(item.getItemType(), false);
if (list != null)
{
// Instantiate the generate wizard
GeneratorWizard wizard = new GeneratorWizard(getPluginResourceCollection(), item);
// Use the item's icon as wizard icon
ImageIcon icon = (ImageIcon) ItemIconMgr.getInstance().getIcon(item.getItemType(), FlexibleSize.HUGE);
wizard.setDefaultWizardImage(icon);
// Create the selection page displaying all available
// generators and add it to the wizard
WizardSelectionPage selectionPage = new WizardSelectionPage(wizard);
int n = list.size();
for (int i = 0; i < n; ++i)
{
Generator generator = (Generator) list.get(i);
selectionPage.addGenerator(generator);
}
selectionPage.expandTree();
wizard.addAndLinkPage(GeneratorWizard.SELECTION_PAGE, selectionPage);
// The following page(s) will be added by this page dynamically if needed
wizard.displayFirst();
// Create an action that starts up the wizard
GeneratorAction action = new GeneratorAction(GeneratorPlugin.this, "generator.action", wizard);
ie.add(action);
}