@Override public void ioReceived(IOInstance inst, int ret, Log... out) { if (inst == robot) { // Deal with streaming... LogSearching.Criteria criteria = LogSearching.criteriaAt(display.streamComboBox.getSelectedIndex()); if (criteria != null) { Log pass = null; for (Log l : out) { if (criteria.fits(l.getFullDescription())) pass = l; } if (pass != null) displayLog(pass); } // Deal with adding to groups (i.e. keeping)... assert (lastGroup != null); for (Log l : out) { if (shouldKeep(l.jvm_unique_id)) lastGroup.add(LogReference.referenceFromLog(l)); } Events.GLogsFound.generate(this, out); } else { Debug.error("%s got %d surprising logs from %s", this, out.length, inst); } }
private void controlLoadAction() { if (robot == null) { Path selected = (Path) display.pathBox.getSelectedItem(); if (selected == null) { Debug.error("null path"); ToolMessage.display("load action: null path", Color.RED); return; } if (FileIO.isValidLogFolder(selected)) { updateComboBoxAndSettings(display.pathBox, UserSettings.loadPathes, selected); lastGroup = Group.groupFromPath(selected); LogReference[] added; try { added = FileIO.readAllRefsFromPath(selected, true); } catch (Throwable e) { ToolMessage.displayError( "error {%s} (see below) reading Log refs from %s", e.getMessage(), selected); e.printStackTrace(); return; } lastGroup.add(added); // Log[] addedLogs = new Log[added.length]; // for (int i = 0; i < added.length; ++i) // addedLogs[i] = added[i].get(); ToolMessage.displayInfo("loaded %d logs into %s", added.length, lastGroup); Events.GGroupAdded.generate(this, lastGroup); Events.GLogRefsFound.generate(this, added); // Events.GLogsFound.generate(this, addedLogs); display.leftSideTabs.setSelectedComponent(display.logTab); } else { Debug.error("invalid Log folder: " + selected.toString()); ToolMessage.display("invalid Log folder: " + selected.toString(), Color.RED); return; } } else { Debug.error("cannot load session while streaming (%s)", robot); ToolMessage.display("cannot load session while streaming", Color.ORANGE); } }