3rd attempt. Error Check now happens only on text update.

This commit is contained in:
Manindra Moharana
2013-01-27 20:57:21 +05:30
parent 41fb67d3bd
commit d217185797
2 changed files with 34 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -221,6 +222,11 @@ public class ErrorCheckerService implements Runnable{
});
}
/**
* checkCode() only on text area update
*/
protected AtomicInteger textModified = new AtomicInteger(0);
public void run() {
stopThread = false;
@@ -237,12 +243,18 @@ public class ErrorCheckerService implements Runnable{
if (pauseThread)
continue;
if(textModified.get() == 0)
continue;
// Check every x seconds
checkCode();
}
}
private boolean checkCode() {
lastTimeStamp = System.currentTimeMillis();
@@ -270,6 +282,17 @@ public class ErrorCheckerService implements Runnable{
editor.updateErrorBar(problemsList);
updateEditorStatus();
updateTextAreaPainter();
int x = textModified.get();
//System.out.println("TM " + x);
if(x>=3){
textModified.set(3);
x = 3;
}
if(x>0)
textModified.set(x - 1);
else
textModified.set(0);
return true;
} catch (Exception e) {