// This is an absurdly convoluted way to get the info we need.
// But there seems to be no other way.
// This is an architectural flaw in vergil.
GraphPane pane = ((JGraph) source).getGraphPane();
FigureLayer layer = pane.getForegroundLayer();
CanvasComponent currentFigure = layer.getCurrentFigure();
GraphController controller = pane.getGraphController();
GraphModel model = controller.getGraphModel();
if (currentFigure != null) {
_target = null;
while ((_target == null) && (currentFigure != null)) {
Object object = currentFigure;
if (object instanceof Figure) {
object = ((Figure) currentFigure).getUserObject();
}
_target = (NamedObj) model.getSemanticObject(object);
currentFigure = currentFigure.getParent();
}
// NOTE: _target may end up null here!
if (_target == null) {
throw new InternalErrorException(