itemTree.setSupportedObjectClasses(new Class [] { Model.class, ProcessItem.class, InitialNode.class, });
// Select initial nodes only
itemTree.setSelectableObjectClasses(new Class [] { InitialNode.class, });
ItemTreeState state = new ItemTreeState();
Item item = wizard.getContext().getItem();
Model currentModel = item.getOwningModel();
if (item instanceof ProcessItem)
{
// Open the tree at the target item
state.addExpandedQualifier(item.getQualifier());
}
else
{
// Open the tree at the model of the target item
state.addExpandedQualifier(currentModel.getQualifier());
}
// Select the previously selected initial nodes if present
ProcessEntrySettings settings = (ProcessEntrySettings) getGeneratorSettings();
List entries = settings.getEntryList();
if (entries != null)
{
int n = entries.size();
for (int i = 0; i < n; ++i)
{
ProcessEntry entry = (ProcessEntry) entries.get(i);
InitialNode initialNode = entry.getInitialNode();
if (initialNode != null)
{
state.addSelectedQualifier(initialNode.getQualifier());
}
}
}
else
{
state.addSelectedQualifier(currentModel.getQualifier());
}
itemTree.rebuildTree();
itemTree.expand(1);
itemTree.restoreState(state);