- LinkedHashMap<WidgetData, String> data = new LinkedHashMap<WidgetData, String>();
- if(commands != null) {
- for(Command c : commands) {
- if(c.getCommand() == null || c.getTargetId() == null || c.getTrigger() == null)
- continue;
- String trigger = c.getTrigger();
- if("click".equals(trigger)) {
- WidgetData wd = document.getWidgetData().get(c.getTargetId());
- if(wd != null)
- data.put(wd, c.getCommand());
- }
- }
- }
- data.put(document.getWidgetData().get(object.getId()), "onPress");
- SelectionListener listener = new ButtonSelectionListener(data);
+ List<Pair<WidgetData, ICommand>> data = new ArrayList<>();
+ data.addAll(SWTViews.getTriggeredCommands(document, commands, "eventOut"));
+ data.add(new Pair<WidgetData, ICommand>(wd, new Command("onPress")));
+ SelectionListener listener = new ButtonSelectionListener(wd, data);