Search in sources :

Example 1 with ScriptMenuBuilder

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);
    }
}
Also used : ScriptID(net.sourceforge.processdash.process.ScriptID) ScriptMenuBuilder(net.sourceforge.processdash.process.ui.ScriptMenuBuilder) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

PropertyKey (net.sourceforge.processdash.hier.PropertyKey)1 ScriptID (net.sourceforge.processdash.process.ScriptID)1 ScriptMenuBuilder (net.sourceforge.processdash.process.ui.ScriptMenuBuilder)1