if (completions.getDSLConditions().length == 0 && facts.length == 0) {
popup.addRow(new HTML("<div class='highlight'>" + constants.NoModelTip() + "</div>")); //NON-NLS
}
final ChangeListener cl = new ChangeListener() {
public void onChange(Widget sender) {
int sel = choices.getSelectedIndex();
if (sel != -1) {
Command cmd = cmds.get(choices.getValue(choices.getSelectedIndex()));
if (cmd != null) {
cmd.execute();
}
verifyRule(null);
}
}
};
//choices.addChangeListener(cl);
choices.addKeyboardListener(new KeyboardListenerAdapter() {
@Override
public void onKeyUp(final Widget sender, char keyCode, int modifiers) {
if (keyCode == KeyboardListener.KEY_ENTER) {
cl.onChange(sender);
}
}
});
//only show the drop down if we are not using fixed position.
if (position == null) {
HorizontalPanel hp0 = new HorizontalPanel();
hp0.add(new HTML(constants.PositionColon()));
hp0.add(positionCbo);
hp0.add(new InfoPopup(constants.PositionColon(), constants.ConditionPositionExplanation()));
popup.addRow(hp0);
}
HorizontalPanel hp = new HorizontalPanel();
hp.add(choices);
Button b = new Button(constants.OK());
hp.add(b);
b.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
cl.onChange(sender);
}
});
popup.addRow(hp);
popup.show();