RuleModellerActionSelectorPopup extends AbstractRuleModellerSelectorPopup { boolean addCallMethodOn(final boolean previousItemsAdded) { boolean moreItemsAdded = false; List<String> lhsVars = model.getAllLHSVariables(); List<String> rhsVars = model.getRHSBoundFacts(); String[] globals = oracle.getGlobalVariables(); if (globals.length > 0) { if (previousItemsAdded) { choices.addItem(SECTION_SEPARATOR, SECTION_SEPARATOR); } for (int i = 0; i < globals.length; i++) { final String v = globals[i]; choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "GLOBCALL" + v); cmds.put("GLOBCALL" + v, new Command() { public void execute() { addCallMethod(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); } }); moreItemsAdded = true; } } if (lhsVars.size() > 0) { if (previousItemsAdded || moreItemsAdded) { choices.addItem(SECTION_SEPARATOR, SECTION_SEPARATOR); } for (Iterator<String> iter = lhsVars.iterator(); iter.hasNext(); ) { final String v = iter.next(); choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "CALL" + v); cmds.put("CALL" + v, new Command() { public void execute() { addCallMethod(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); } }); moreItemsAdded = true; } } if (rhsVars.size() > 0) { if (previousItemsAdded || moreItemsAdded) { choices.addItem(SECTION_SEPARATOR, SECTION_SEPARATOR); } for (Iterator<String> iter = rhsVars.iterator(); iter.hasNext(); ) { final String v = iter.next(); choices.addItem(GuidedRuleEditorResources.CONSTANTS.CallMethodOn0(v), "CALL" + v); cmds.put("CALL" + v, new Command() { public void execute() { addCallMethod(v, Integer.parseInt(positionCbo.getValue(positionCbo.getSelectedIndex()))); hide(); } }); moreItemsAdded = true; } } return moreItemsAdded; } RuleModellerActionSelectorPopup(final RuleModel model,
                                           final RuleModeller ruleModeller,
                                           final Collection<RuleModellerActionPlugin> actionPlugins,
                                           final Integer position,
                                           final AsyncPackageDataModelOracle oracle); @Override Widget getContent(); @Override void show();  }
@Test public void checkAddCallMethodOnGetsAllBindings() { popup.addCallMethodOn(false); verify(model).getAllLHSVariables(); verify(model).getRHSBoundFacts(); }