2222
2323import java .awt .BorderLayout ;
2424import java .awt .Frame ;
25- import java .awt .Point ;
2625import java .awt .event .ComponentEvent ;
2726import java .awt .event .ComponentListener ;
2827import java .awt .event .WindowAdapter ;
3534import javax .swing .border .EmptyBorder ;
3635import javax .swing .table .TableModel ;
3736
38- import processing .app .Editor ;
3937import processing .app .Toolkit ;
4038import processing .mode .java .JavaEditor ;
4139
40+
4241/**
4342 * Error Window that displays a tablular list of errors. Clicking on an error
4443 * scrolls to its location in the code.
45- *
44+ *
4645 * @author Manindra Moharana <me@mkmoharana.com>
47- *
46+ *
4847 */
4948public class ErrorWindow extends JFrame {
5049
@@ -58,9 +57,10 @@ public class ErrorWindow extends JFrame {
5857 */
5958 protected JScrollPane scrollPane ;
6059
61- protected JavaEditor thisEditor ;
60+ //protected JavaEditor thisEditor;
61+ protected JavaEditor editor ;
6262 private JFrame thisErrorWindow ;
63-
63+
6464 /**
6565 * Handles the sticky Problem window
6666 */
@@ -70,19 +70,20 @@ public class ErrorWindow extends JFrame {
7070
7171 /**
7272 * Preps up ErrorWindow
73- *
73+ *
7474 * @param editor
7575 * - Editor
7676 * @param ecs - ErrorCheckerService
7777 */
7878 public ErrorWindow (JavaEditor editor , ErrorCheckerService ecs ) {
7979 thisErrorWindow = this ;
8080 errorCheckerService = ecs ;
81- thisEditor = editor ;
81+ this . editor = editor ;
8282 setTitle ("Problems" );
8383 prepareFrame ();
8484 }
8585
86+
8687 /**
8788 * Sets up ErrorWindow
8889 */
@@ -100,7 +101,7 @@ protected void prepareFrame() {
100101 scrollPane = new JScrollPane ();
101102 contentPane .add (scrollPane );
102103
103- errorTable = new XQErrorTable (errorCheckerService );
104+ errorTable = new XQErrorTable (editor );
104105 scrollPane .setViewportView (errorTable );
105106
106107 try {
@@ -111,17 +112,17 @@ protected void prepareFrame() {
111112 e .printStackTrace ();
112113 }
113114
114- if (thisEditor != null ) {
115- setLocation (new Point ( thisEditor .getLocation ().x
116- + thisEditor . getWidth (), thisEditor .getLocation ().y ) );
115+ if (editor != null ) {
116+ setLocation (editor .getLocation ().x + editor . getWidth (),
117+ editor .getLocation ().y );
117118 }
118-
119119 }
120120
121+
121122 /**
122123 * Updates the error table with new data(Table Model). Called from Error
123124 * Checker Service.
124- *
125+ *
125126 * @param tableModel
126127 * - Table Model
127128 * @return True - If error table was updated successfully.
@@ -173,12 +174,12 @@ public void windowClosing(WindowEvent e) {
173174
174175 @ Override
175176 public void windowDeiconified (WindowEvent e ) {
176- thisEditor .setExtendedState (Frame .NORMAL );
177+ editor .setExtendedState (Frame .NORMAL );
177178 }
178179
179180 });
180181
181- if (thisEditor == null ) {
182+ if (editor == null ) {
182183 System .out .println ("Editor null" );
183184 return ;
184185 }
@@ -209,7 +210,7 @@ public void windowDeiconified(WindowEvent e) {
209210
210211 });*/
211212
212- thisEditor .addComponentListener (new ComponentListener () {
213+ editor .addComponentListener (new ComponentListener () {
213214
214215 @ Override
215216 public void componentShown (ComponentEvent e ) {
@@ -249,10 +250,10 @@ public void componentHidden(ComponentEvent e) {
249250 * Implements the docking feature of the tool - The frame sticks to the
250251 * editor and once docked, moves along with it as the editor is resized,
251252 * moved, or closed.
252- *
253+ *
253254 * This class has been borrowed from Tab Manager tool by Thomas Diewald. It
254255 * has been slightly modified and used here.
255- *
256+ *
256257 * @author Thomas Diewald , http://thomasdiewald.com
257258 */
258259 private class DockTool2Base {
@@ -285,9 +286,7 @@ public boolean isDocked() {
285286
286287 //
287288 public void tryDocking () {
288- if (thisEditor == null )
289- return ;
290- Editor editor = thisEditor ;
289+ if (editor == null ) return ;
291290 Frame frame = thisErrorWindow ;
292291
293292 int ex = editor .getX ();
@@ -330,9 +329,7 @@ public void tryDocking() {
330329 }
331330
332331 public void dock () {
333- if (thisEditor == null )
334- return ;
335- Editor editor = thisEditor ;
332+ if (editor == null ) return ;
336333 Frame frame = thisErrorWindow ;
337334
338335 int ex = editor .getX ();
@@ -369,6 +366,5 @@ public void dock() {
369366 }
370367 frame .setLocation (x , y );
371368 }
372-
373369 }
374370}
0 commit comments