public void popup(SelectionEditor editor, int cause)
{
if (cause != PopupEvent.POPUP_OPENING)
return;
JSelectionField selectionField = (JSelectionField) editor.getPropertyComponent();
// Save the text (will be cleared when removing the items)
String text = selectionField.getText();
// Clear the item list
selectionField.clearItems();
Object o = editor.getObject();
if (!(o instanceof InitialNode))
return;
TreeMap map = new TreeMap();
Iterator itNodes = ((InitialNode) o).getProcess().getNodes();
while (itNodes.hasNext())
{
Node node = (Node) itNodes.next();
if (!(node instanceof FinalNode))
continue;
FinalNode finalNode = (FinalNode) node;
if (finalNode.getJumpTarget() != null)
{
// We skip exit-continue nodes
continue;
}
String name = node.getName();
map.put(name, name);
}
selectionField.addItem(null);
for (Iterator itGroups = map.keySet().iterator(); itGroups.hasNext();)
{
String s = (String) itGroups.next();
selectionField.addItem(s);
}
// Restore the text
selectionField.setText(text);
}