// Single element selected, show it in the property browser.
Figure figure = (Figure) selection.get(0);
if (figure instanceof ProcessElementContainer)
{
ModelObject mo = ((ProcessElementContainer) figure).getReferredProcessElement();
Object originalObject = null;
// Determine the item the figure element references to
Item referencedItem = null;
if (mo instanceof SubprocessNode)
{
referencedItem = ((SubprocessNode) mo).getSubprocess();
}
if (editor() instanceof NodeItemEditorPlugin)
{
// We are in the nodeeditor, we need not the process object,
// but the item behind it
if (referencedItem != null)
{
// Get the reference object for name uniqueness checks
originalObject = ModelConnector.getInstance().getItemByQualifier(referencedItem.getQualifier(), false);
// We will edit the referenced item directly
mo = referencedItem;
}
}
else
{
if (mo instanceof MultiSocketNode)
{
MultiSocketNode node = (MultiSocketNode) mo;
// If we edit an activity node, create a configuration bean if not already there
// in order to be able to edit the settings in the property browser.
// The bean will be removed if it contains the default values only when saving the activity node again
// (see plugin_propertybrowser_executesave () in the ModelerEventModule)
if (node.getConfigurationBean() == null)
{
// We create a new configuration bean (if defined by the underlying activity)
if (referencedItem != null)
{
node.setConfigurationBean(referencedItem.createConfigurationBean());
}
}
}
}
// Make sure the global reference names are up to date or else we may have trouble
// saving the object (the ModelObjectValidator will try to rebuild the references from the names)
mo.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES | ModelObject.SYNC_LOCAL_REFNAMES);
String title = mo.getName();
String modelObjectTypeName = mo.getModelObjectTypeName();
if (modelObjectTypeName != null)
{
title = title + " (" + modelObjectTypeName + ")";
}
// Send the object to the OE
modeler.fireEvent(new PropertyBrowserSetEvent(modeler, mo, originalObject, false, mo.getDescription(), title, null, false, true));
// Show object description in info panel
modeler.fireEvent(new JaspiraEvent(modeler, "plugin.infopanel.setinfotext", mo));
}