| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,6 @@ | |||
| 32 | 32 | import java.util.List; | |
| 33 | 33 | ||
| 34 | 34 | import javax.swing.JPanel; | |
| 35 | - import javax.swing.SwingWorker; | ||
| 36 | 35 | import javax.swing.text.BadLocationException; | |
| 37 | 36 | ||
| 38 | 37 | import processing.app.Mode; | |
@@ -115,40 +114,21 @@ public List<LineMarker> getErrorPoints() { | |||
| 115 | 114 | } | |
| 116 | 115 | ||
| 117 | 116 | ||
| 118 | - synchronized public void updateErrorPoints(final List<Problem> problems) { | ||
| 119 | - // NOTE: ErrorMarkers are calculated for the present tab only Error Marker | ||
| 120 | - // index in the arraylist is LOCALIZED for current tab. Also, update is in | ||
| 121 | - // the UI thread via SwingWorker to prevent concurrency issues. [Manindra] | ||
| 122 | - try { | ||
| 123 | - new SwingWorker() { | ||
| 124 | - protected Object doInBackground() throws Exception { | ||
| 125 | - Sketch sketch = editor.getSketch(); | ||
| 126 | - int currentTab = sketch.getCurrentCodeIndex(); | ||
| 127 | - errorPoints = new ArrayList<>(); | ||
| 128 | - | ||
| 129 | - // Each problem.getSourceLine() will have an extra line added because | ||
| 130 | - // of class declaration in the beginning as well as default imports | ||
| 131 | - synchronized (problems) { | ||
| 132 | - for (Problem problem : problems) { | ||
| 133 | - if (problem.getTabIndex() == currentTab) { | ||
| 134 | - errorPoints.add(new LineMarker(problem, problem.isError())); | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - recalculateMarkerPositions(); | ||
| 140 | - return null; | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - protected void done() { | ||
| 144 | - repaint(); | ||
| 145 | - editor.getErrorChecker().updateEditorStatus(); | ||
| 146 | - } | ||
| 147 | - }.execute(); | ||
| 148 | - | ||
| 149 | - } catch (Exception ex) { | ||
| 150 | - ex.printStackTrace(); | ||
| 151 | - } | ||
| 117 | + public void updateErrorPoints(final List<Problem> problems) { | ||
| 118 | + // NOTE: ErrorMarkers are calculated for the present tab only Error Marker | ||
| 119 | + // index in the arraylist is LOCALIZED for current tab. | ||
| 120 | + Sketch sketch = editor.getSketch(); | ||
| 121 | + int currentTab = sketch.getCurrentCodeIndex(); | ||
| 122 | + errorPoints = Collections.synchronizedList(new ArrayList<LineMarker>()); | ||
| 123 | + // Each problem.getSourceLine() will have an extra line added because | ||
| 124 | + // of class declaration in the beginning as well as default imports | ||
| 125 | + for (Problem problem : problems) { | ||
| 126 | + if (problem.getTabIndex() == currentTab) { | ||
| 127 | + errorPoints.add(new LineMarker(problem, problem.isError())); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + repaint(); | ||
| 131 | + editor.getErrorChecker().updateEditorStatus(); | ||
| 152 | 132 | } | |
| 153 | 133 | ||
| 154 | 134 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments