001 package nl.cwi.sen1.error.model; 002 003 import nl.cwi.sen1.error.viewer.ErrorViewerBridge; 004 import nl.cwi.sen1.gui.Studio; 005 import errorapi.types.Area; 006 import errorapi.types.Location; 007 008 public class LocationNode extends SelectableNode { 009 private Location location; 010 011 public LocationNode(Location location) { 012 super(location); 013 this.location = location; 014 } 015 016 public void selected(Studio studio, ErrorViewerBridge bridge) { 017 bridge.postEvent(studio.getATermFactory().make( 018 "location-selected(<term>)", location.toTerm())); 019 } 020 021 public String toString() { 022 StringBuffer buf = new StringBuffer(); 023 024 if (location.hasFilename()) { 025 buf.append("file: ").append(location.getFilename()); 026 } 027 028 if (location.hasArea()) { 029 Area area = location.getArea(); 030 buf.append(", line: ").append(area.getBeginLine()); 031 buf.append(", column: ").append(area.getBeginColumn()); 032 } 033 return buf.toString(); 034 } 035 }