mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 13:21:07 +01:00
more weeding
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex;
|
||||
package processing.mode.java;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
@@ -30,6 +30,7 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingWorker;
|
||||
@@ -37,8 +38,9 @@ import javax.swing.text.BadLocationException;
|
||||
|
||||
import processing.app.Base;
|
||||
import processing.app.SketchCode;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.JavaEditor;
|
||||
import processing.mode.java.pdex.ErrorCheckerService;
|
||||
import processing.mode.java.pdex.ErrorMarker;
|
||||
import processing.mode.java.pdex.Problem;
|
||||
|
||||
/**
|
||||
* The bar on the left of the text area which displays all errors as rectangles. <br>
|
||||
@@ -95,7 +97,7 @@ public class ErrorBar extends JPanel {
|
||||
/**
|
||||
* Stores error markers displayed PER TAB along the error bar.
|
||||
*/
|
||||
protected ArrayList<ErrorMarker> errorPoints = new ArrayList<ErrorMarker>();
|
||||
protected List<ErrorMarker> errorPoints = new ArrayList<ErrorMarker>();
|
||||
|
||||
/**
|
||||
* Stores previous list of error markers.
|
||||
@@ -148,8 +150,7 @@ public class ErrorBar extends JPanel {
|
||||
* @param problems
|
||||
* - List of problems.
|
||||
*/
|
||||
synchronized public void updateErrorPoints(final ArrayList<Problem> problems) {
|
||||
|
||||
synchronized public void updateErrorPoints(final List<Problem> problems) {
|
||||
// NOTE TO SELF: ErrorMarkers are calculated for the present tab only
|
||||
// Error Marker index in the arraylist is LOCALIZED for current tab.
|
||||
// Also, need to do the update in the UI thread via SwingWorker to prevent
|
||||
@@ -30,8 +30,8 @@ import processing.core.PApplet;
|
||||
import processing.mode.java.debug.LineBreakpoint;
|
||||
import processing.mode.java.debug.LineHighlight;
|
||||
import processing.mode.java.debug.LineID;
|
||||
import processing.mode.java.pdex.ErrorBar;
|
||||
import processing.mode.java.pdex.ErrorCheckerService;
|
||||
import processing.mode.java.pdex.ErrorMarker;
|
||||
import processing.mode.java.pdex.ErrorMessageSimplifier;
|
||||
import processing.mode.java.pdex.JavaTextArea;
|
||||
import processing.mode.java.pdex.Problem;
|
||||
@@ -62,10 +62,10 @@ public class JavaEditor extends Editor {
|
||||
|
||||
protected JMenu debugMenu;
|
||||
|
||||
protected Debugger debugger; // the debugger
|
||||
protected DebugTray tray; // the variable inspector frame
|
||||
protected Debugger debugger;
|
||||
protected DebugTray tray;
|
||||
|
||||
public ErrorBar errorBar;
|
||||
private ErrorBar errorBar;
|
||||
|
||||
protected XQConsoleToggle btnShowConsole;
|
||||
protected XQConsoleToggle btnShowErrors;
|
||||
@@ -2328,13 +2328,21 @@ public class JavaEditor extends Editor {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the error bar
|
||||
* @param problems
|
||||
*/
|
||||
public void updateErrorBar(ArrayList<Problem> problems) {
|
||||
|
||||
public void updateErrorBar(List<Problem> problems) {
|
||||
errorBar.updateErrorPoints(problems);
|
||||
}
|
||||
|
||||
|
||||
public List<ErrorMarker> getErrorPoints() {
|
||||
return errorBar.errorPoints;
|
||||
}
|
||||
|
||||
|
||||
public void repaintErrorBar() {
|
||||
errorBar.repaint();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggle between Console and Errors List
|
||||
|
||||
@@ -1085,6 +1085,7 @@ public class ErrorCheckerService implements Runnable {
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected int lastCaretLine = -1;
|
||||
|
||||
/**
|
||||
@@ -1097,8 +1098,8 @@ public class ErrorCheckerService implements Runnable {
|
||||
// editor.statusNotice("Position: " +
|
||||
// editor.getTextArea().getCaretLine());
|
||||
if (JavaMode.errorCheckEnabled) {
|
||||
synchronized (editor.errorBar.errorPoints) {
|
||||
for (ErrorMarker emarker : editor.errorBar.errorPoints) {
|
||||
synchronized (editor.getErrorPoints()) {
|
||||
for (ErrorMarker emarker : editor.getErrorPoints()) {
|
||||
if (emarker.getProblem().getLineNumber() == editor.getTextArea().getCaretLine()) {
|
||||
if (emarker.getType() == ErrorMarker.Warning) {
|
||||
editor.statusMessage(emarker.getProblem().getMessage(),
|
||||
@@ -1713,12 +1714,12 @@ public class ErrorCheckerService implements Runnable {
|
||||
// pauseThread();
|
||||
Base.log(editor.getSketch().getName()
|
||||
+ " - Error Checker paused.");
|
||||
editor.errorBar.errorPoints.clear();
|
||||
editor.getErrorPoints().clear();
|
||||
problemsList.clear();
|
||||
updateErrorTable();
|
||||
updateEditorStatus();
|
||||
editor.getTextArea().repaint();
|
||||
editor.errorBar.repaint();
|
||||
editor.repaintErrorBar();
|
||||
} else {
|
||||
//resumeThread();
|
||||
Base.log(editor.getSketch().getName()
|
||||
|
||||
@@ -56,8 +56,8 @@ import processing.app.syntax.TokenMarker;
|
||||
|
||||
|
||||
/**
|
||||
* Customized line painter. Adds support for background colors, left hand gutter
|
||||
* area with background color and text.
|
||||
* Customized line painter. Adds support for background colors,
|
||||
* left hand gutter area with background color and text.
|
||||
*/
|
||||
public class JavaTextAreaPainter extends TextAreaPainter
|
||||
implements MouseListener, MouseMotionListener {
|
||||
@@ -70,7 +70,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
public Color errorMarkerColor; // = new Color(0xED2630);
|
||||
public Color warningMarkerColor; // = new Color(0xFFC30E);
|
||||
|
||||
static int ctrlMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
// static int ctrlMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
|
||||
|
||||
public JavaTextAreaPainter(JavaTextArea textArea, TextAreaDefaults defaults) {
|
||||
@@ -180,7 +180,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
protected void paintLine(Graphics gfx, int line, int x,
|
||||
TokenMarker tokenMarker) {
|
||||
try {
|
||||
// TODO This line is causing NPE's randomly ever since I added the
|
||||
// TODO This line is causing NPEs randomly ever since I added the
|
||||
// toggle for Java Mode/Debugger toolbar. [Manindra]
|
||||
super.paintLine(gfx, line, x + getGutterWidth(), tokenMarker);
|
||||
|
||||
@@ -326,7 +326,7 @@ public class JavaTextAreaPainter extends TextAreaPainter
|
||||
|
||||
// Check if current line contains an error. If it does, find if it's an
|
||||
// error or warning
|
||||
for (ErrorMarker emarker : errorCheckerService.getEditor().errorBar.errorPoints) {
|
||||
for (ErrorMarker emarker : errorCheckerService.getEditor().getErrorPoints()) {
|
||||
if (emarker.getProblem().getLineNumber() == line) {
|
||||
notFound = false;
|
||||
if (emarker.getType() == ErrorMarker.Warning) {
|
||||
|
||||
Reference in New Issue
Block a user