55import java .beans .*;
66import java .io .*;
77import java .util .ArrayList ;
8+ import java .util .Collections ;
89import java .util .Iterator ;
910import java .util .List ;
1011import java .util .Map ;
@@ -130,9 +131,6 @@ public void actionPerformed(ActionEvent e) {
130131 getSketch ().setModified (false );
131132
132133 hasJavaTabs = checkForJavaTabs ();
133- //initializeErrorChecker();
134-
135- initErrorChecker ();
136134
137135 // hack to add a JPanel to the right-hand side of the text area
138136 JPanel textAndError = new JPanel ();
@@ -150,6 +148,8 @@ public void actionPerformed(ActionEvent e) {
150148
151149 getJavaTextArea ().setMode (jmode );
152150
151+ initErrorChecker ();
152+
153153 // ensure completion is hidden when editor loses focus
154154 addWindowFocusListener (new WindowFocusListener () {
155155 public void windowLostFocus (WindowEvent e ) {
@@ -195,6 +195,8 @@ public EditorToolbar createToolbar() {
195195 }
196196
197197
198+ private int previousTabCount = 1 ;
199+
198200 // Override the parent call to add hook to the rebuild() method
199201 public EditorHeader createHeader () {
200202 return new EditorHeader (this ) {
@@ -203,6 +205,14 @@ public void rebuild() {
203205
204206 // after Rename and New Tab, we may have new .java tabs
205207 hasJavaTabs = checkForJavaTabs ();
208+
209+ if (errorCheckerService != null ) {
210+ int currentTabCount = sketch .getCodeCount ();
211+ if (currentTabCount != previousTabCount ) {
212+ previousTabCount = currentTabCount ;
213+ errorCheckerService .notifySketchChanged ();
214+ }
215+ }
206216 }
207217 };
208218 }
0 commit comments