private void initializePropertyBrowser()
{
GeneratorContext context = getContext();
Item item = context.getItem();
PropertyBrowser oe = getPropertyBrowser();
oe.setObjectModified(false);
oe.setOriginalObject(context.getOriginalItem());
try
{
if (context.isNewItem() && !context.isItemSaved())
{
// Make the object name editable if it's a new item
// Create the property browser tree and clone it
ObjectNode rootNode = NodeStructureMgr.getInstance().createEditorStructureFor(item.getClass());
// Set the read-only property of the 'Name' property to false
changeReadOnlyModeOfPropertyDescriptor(rootNode, "Name", false);
// TODO Feature 3 Allow for selecting the model for new items; implement setOwningModelQualifier
// changeReadOnlyModeOfPropertyDescriptor(rootNode, "OwningModelQualifier", false);
// Set the item; we consider it new (needed for the ModelObjectValidator, which
// checks name uniqueness) only if the item has not been saved yet.
boolean newFlag = !context.isItemSaved();
oe.setObject(item, newFlag, rootNode);
}
else
{
oe.setObject(item, false);
}
}
catch (XMLDriverException e)
{
ExceptionUtil.printTrace(e);