3838import processing .app .SketchCode ;
3939import processing .app .ui .Editor ;
4040import processing .core .PApplet ;
41- import processing .mode .java .pdex .LineMarker ;
4241import processing .mode .java .pdex .Problem ;
4342
4443
@@ -99,13 +98,14 @@ public void paintComponent(Graphics g) {
9998 int currentTabIndex = editor .getSketch ().getCurrentCodeIndex ();
10099
101100 for (LineMarker m : errorPoints ) {
102- if (m .getProblem ().getTabIndex () != currentTabIndex ) continue ;
103- if (m .getType () == LineMarker .ERROR ) {
101+ Problem problem = m .problem ;
102+ if (problem .getTabIndex () != currentTabIndex ) continue ;
103+ if (problem .isError ()) {
104104 g .setColor (errorColor );
105105 } else {
106106 g .setColor (warningColor );
107107 }
108- g .drawLine (2 , m .getY () , getWidth () - 2 , m .getY () );
108+ g .drawLine (2 , m .y , getWidth () - 2 , m .y );
109109 }
110110 }
111111
@@ -123,7 +123,7 @@ private void scrollToMarkerAt(final int y) {
123123 try {
124124 LineMarker m = findClosestMarker (y );
125125 if (m != null ) {
126- editor .highlight (m .getProblem () );
126+ editor .highlight (m .problem );
127127 }
128128 } catch (Exception ex ) {
129129 ex .printStackTrace ();
@@ -144,7 +144,7 @@ private void showMarkerHover(final int y) {
144144 try {
145145 LineMarker m = findClosestMarker (y );
146146 if (m != null ) {
147- Problem p = m .getProblem () ;
147+ Problem p = m .problem ;
148148// String kind = p.isError() ?
149149// Language.text("editor.status.error") :
150150// Language.text("editor.status.warning");
@@ -172,13 +172,14 @@ private void recalculateMarkerPositions() {
172172 int height = getHeight () - topMargin - bottomMargin ;
173173
174174 for (LineMarker m : errorPoints ) {
175- if (m .getProblem ().getTabIndex () != currentTab ) continue ;
175+ Problem problem = m .problem ;
176+ if (problem .getTabIndex () != currentTab ) continue ;
176177 // Ratio of error line to total lines
177- float ratio = (m .getLineNumber () + 1 ) / ((float ) totalLines );
178+ float ratio = (problem .getLineNumber () + 1 ) / ((float ) totalLines );
178179 // Ratio multiplied by height of the error bar
179180 float y = topMargin + ratio * height ;
180181
181- m .setY (( int ) y ) ;
182+ m .y = ( int ) y ;
182183 }
183184 }
184185 }
@@ -188,7 +189,7 @@ private LineMarker findClosestMarker(final int y) {
188189 LineMarker closest = null ;
189190 int closestDist = Integer .MAX_VALUE ;
190191 for (LineMarker m : errorPoints ) {
191- int dist = Math .abs (y - m .getY () );
192+ int dist = Math .abs (y - m .y );
192193 if (dist < 3 && dist < closestDist ) {
193194 closest = m ;
194195 closestDist = dist ;
@@ -206,4 +207,20 @@ public Dimension getPreferredSize() {
206207 public Dimension getMinimumSize () {
207208 return new Dimension (Editor .RIGHT_GUTTER , super .getMinimumSize ().height );
208209 }
210+
211+ /**
212+ * Line markers displayed on the Error Column.
213+ */
214+ private static class LineMarker {
215+ /** y co-ordinate of the marker */
216+ int y ;
217+
218+ /** Problem that the error marker represents */
219+ final Problem problem ;
220+
221+
222+ LineMarker (Problem problem ) {
223+ this .problem = problem ;
224+ }
225+ }
209226}
0 commit comments