bit more work on threads, making sure all windows quite

This commit is contained in:
Manindra Moharana
2013-08-24 17:24:54 +05:30
parent 904bfcd005
commit 05e69b4e41
4 changed files with 30 additions and 11 deletions

View File

@@ -133,10 +133,11 @@ Gotta do it carefully between main thread, ECS Thread, and SwingWorker threads
Fields that are concurrently accessed:
ECS members:
ArrayList<Problem> problems - updated in ECS, accessed by ErrorBar.update()
ArrayList<URL> classpathJars - updated in ECS, accessed by ASTGenerator.loadJars()
hasErrors, syntaxErrors - Atomic Boolean
CompilationUnit cu - updated in ECS, accessed a zillion times in ASTGenerator :'(
x ArrayList<Problem> problems - updated in ECS, accessed by ErrorBar.update()
x ArrayList<URL> classpathJars - updated in ECS, accessed by ASTGenerator.loadJars()
x hasErrors, syntaxErrors - Atomic Boolean
x boolean warningsEnabled - made it volatile
* CompilationUnit cu - updated in ECS, accessed a zillion times in ASTGenerator :'(
General Stuff

View File

@@ -3090,6 +3090,19 @@ public class ASTGenerator {
}
}
public void disposeAllWindows(){
disposeWindow(frame2);
disposeWindow(frameAutoComp);
disposeWindow(frmImportSuggest);
disposeWindow(frmOccurenceList);
disposeWindow(frmRename);
}
public static void disposeWindow(JFrame f) {
if(f != null)
f.dispose();
}
public static final String ignoredImports[] = {
"com.oracle.", "sun.", "sunw.", "com.sun.", "javax.", "sunw.", "org.ietf.",

View File

@@ -282,6 +282,10 @@ public class ErrorCheckerService implements Runnable{
checkCode();
checkForMissingImports();
}
checkerClass = null;
astGenerator.disposeAllWindows();
astGenerator = null;
logE("Thread stopped: " + editor.getSketch().getName());
}
private void checkForMissingImports() {
@@ -559,20 +563,20 @@ public class ErrorCheckerService implements Runnable{
} catch (ClassNotFoundException e) {
System.err.println("Compiltation Checker files couldn't be found! "
+ e + " compileCheck() problem.");
stopThread();
pauseThread();
} catch (MalformedURLException e) {
System.err.println("Compiltation Checker files couldn't be found! "
+ e + " compileCheck() problem.");
stopThread();
pauseThread();
} catch (Exception e) {
System.err.println("compileCheck() problem." + e);
e.printStackTrace();
stopThread();
pauseThread();
} catch (NoClassDefFoundError e) {
System.err
.println(e
+ " compileCheck() problem. Somebody tried to mess with Experimental Mode files.");
stopThread();
pauseThread();
}
// log("Compilecheck, Done.");
}
@@ -793,7 +797,7 @@ public class ErrorCheckerService implements Runnable{
} catch (Exception e) {
log("Exception at updateErrorTable() " + e);
e.printStackTrace();
stopThread();
pauseThread();
}
}
@@ -1397,6 +1401,7 @@ public class ErrorCheckerService implements Runnable{
* Stops the Error Checker Service thread
*/
public void stopThread() {
logE("Stopping thread: " + editor.getSketch().getName());
stopThread.set(true);
}

View File

@@ -183,7 +183,7 @@ public class ErrorWindow extends JFrame {
return;
}
thisEditor.addWindowListener(new WindowAdapter() {
/*thisEditor.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
@@ -207,7 +207,7 @@ public class ErrorWindow extends JFrame {
thisErrorWindow.setExtendedState(Frame.NORMAL);
}
});
});*/
thisEditor.addComponentListener(new ComponentListener() {