{
// We do not display an 'Open' menu in the item editor.
return EVENT_IGNORED;
}
ModelObject mo = (ModelObject) ie.getSafeTransferData(ClientFlavors.MODEL_OBJECT);
List associations = mo.getAssociations();
if (associations != null)
{
JaspiraAction group = new JaspiraAction(AssociationPlugin.this, "submenu.open");
int n = associations.size();
for (int iAssoc = 0; iAssoc < n; ++iAssoc)
{
Association association = (Association) associations.get(iAssoc);
String hintMsg = null;
OpenEventInfo [] openEventInfo = null;
if (association.getAssociatedObject() == null)
{
// Association present, but no associated object.
// The association contains a hint message, e. g. "Object has not yet been generated"
hintMsg = association.getHintMsg();
}
else
{
// Check the mime types supported by this object
String [] types = association.getAssociationTypes();
if (types == null || types.length == 0)
{
hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.noassociation");
}
else
{
// Now check if any plugin is able to open this kind of MIME type
// The association manager will broadcast the plugin.association.supports event in order
// to determine the open event name that can be used to open the object of the association
openEventInfo = determineOpenEvents(types, AssociationPlugin.this);
if (openEventInfo == null)
{
hintMsg = getPluginResourceCollection().getRequiredString("messages.hints.wrongassociation");
}
}
}
if (openEventInfo != null)
{
// We are able to open this object.
// Create an open action for each open event information
for (int iEvent = 0; iEvent < openEventInfo.length; ++iEvent)
{
OpenAction openAction = new OpenAction(association, openEventInfo [iEvent], !mo.isModifiable());
openAction.setPriority(iAssoc * 10 + iEvent);
group.addMenuChild(openAction);
}
}
else