public void event(DebugEvent debugEvent) {
// FIXME: this method is called every time the director gets a
// firing event for any actor...is this ok?
// Ignore debug events that aren't firing events.
if (debugEvent instanceof FiringEvent) {
FiringEvent event = (FiringEvent) debugEvent;
NamedObj objToHighlight = (NamedObj) event.getActor();
if (_toDebug.containsKey(objToHighlight)) {
// The actor associated with this firing event is in
// the set of actors to be debugged.
// If the object is not contained by the associated
// composite, then find an object above it in the hierarchy
// that is.
DebugProfile debugProfile = getDebugProfile((Executable) objToHighlight);
BasicGraphController graphController = debugProfile
.getGraphController();
AbstractBasicGraphModel graphModel = (AbstractBasicGraphModel) graphController
.getGraphModel();
NamedObj toplevel = graphModel.getPtolemyModel();
while ((objToHighlight != null)
&& (objToHighlight.getContainer() != toplevel)) {
objToHighlight = objToHighlight.getContainer();
}
if (objToHighlight == null) {
return;
}
Object location = objToHighlight.getAttribute("_location");
if (location != null) {
Figure figure = graphController.getFigure(location);
if (figure != null) {
// If the user has chosen to break on one of
// the firing events, highlight the actor and
// wait for the user to press the Resume
// button.
if (debugProfile.isListening(event.getType())) {
String message = objToHighlight.getName() + " "
+ event.getType().getName();
Manager manager = ((Actor) objToHighlight)
.getManager();
render(figure, manager, message);
}
}