use of net.sourceforge.processdash.process.ui.ScriptMenuBuilder in project processdash by dtuma.
the class ScriptMenuReplicator method updateScriptMenuItems.
public void updateScriptMenuItems() {
// look for the last "script menu separator" item to determine where
// the script menu entries appear in our popup menu.
int pos = popupMenu.getItemCount() - 1;
while (!(popupMenu.getItem(pos) instanceof ScriptMenuSeparator)) {
pos--;
}
// now, discard any script menu items that are currently present.
while (pos-- > 0) {
if (popupMenu.getItem(pos) instanceof ScriptItemTag)
popupMenu.remove(pos);
else
break;
}
// retrieve the current list of script menu items from the dashboard
PropertyKey currentPhase = activeTaskModel.getNode();
currentPath = (currentPhase == null ? null : currentPhase.path());
List<ScriptID> scriptItems = ScriptEnumerator.getScripts(ctx, currentPhase);
if (scriptItems != null && scriptItems.size() > 1) {
ScriptMenuBuilder b = new ScriptMenuBuilder(scriptItems);
addMenuItems(popupMenu, b.getMenuItems(), pos);
}
}
Aggregations