private void updateTracesCombo(BehavioralAnnotation behavioralAnnotation) { this.traces.clear(); Iterator<Trace> traceIter = behavioralAnnotation.iteratorOfTraces(); while (traceIter.hasNext()) { Trace trace = traceIter.next(); this.traces.put("Method call sequence " + trace.getId(), trace); } List<String> list = new ArrayList<String>(this.traces.keySet()); Collections.sort(list); this.tracesCombo.setItems( list.toArray((String[]) Array.newInstance(String.class, list.size()))); if (list.size() > 0) { this.tracesCombo.select(0); updateTrace(this.traces.get(list.get(0))); } }
/** @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ public Object[] getElements(Object inputElement) { Trace trace = (Trace) inputElement; return trace.entrySetOfBindings().toArray(); }
private void updateTrace(Trace trace) { Image image; StringBuffer buffer = new StringBuffer(); if (trace.getResult() == Trace.NOT_ACCEPTED) { image = BehavioralInferenceImages.getImage(BehavioralInferenceImages.IMG_NOT_ACCEPTED); buffer.append("Method call sequence was not accepted"); if (trace.getPassedAcceptingState() == 1) { buffer.append(", passed 1 accepting state," + " length of accepted subsequence: "); buffer.append(trace.getLengthOfAcceptedTrace()); } else if (trace.getPassedAcceptingState() > 1) { buffer.append(", passed "); buffer.append(trace.getPassedAcceptingState()); buffer.append(" accepting states, length of accepted subsequence: "); buffer.append(trace.getLengthOfAcceptedTrace()); } } else if (trace.getResult() == Trace.ACCEPTED) { image = BehavioralInferenceImages.getImage(BehavioralInferenceImages.IMG_ACCEPTED); buffer.append("Method call sequence was accepted, length of sequence: "); buffer.append(trace.getLengthOfAcceptedTrace()); } else { image = BehavioralInferenceImages.getImage(BehavioralInferenceImages.IMG_REJECTED); buffer.append("Method call sequence was rejected"); if (trace.getPassedAcceptingState() == 1) { buffer.append(", passed 1 accepting state," + " length of accepted subsequence: "); buffer.append(trace.getLengthOfAcceptedTrace()); } else if (trace.getPassedAcceptingState() > 1) { buffer.append(", passed "); buffer.append(trace.getPassedAcceptingState()); buffer.append(" accepting states, length of accepted subsequence: "); buffer.append(trace.getLengthOfAcceptedTrace()); } } this.resultImageLabel.setImage(image); this.resultLabel.setText(buffer.toString()); this.boundObjectsTableViewer.setInput(trace); updateSequenceDiagram(trace); }