mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #3907 from JakubValtar/update-status
Update status error/warning when changing the line
This commit is contained in:
@@ -2789,6 +2789,14 @@ public abstract class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current notice message in the editor status bar.
|
||||
*/
|
||||
public int getStatusMode() {
|
||||
return status.mode;
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Returns the current mode of the editor status bar: NOTICE, ERR or EDIT.
|
||||
// */
|
||||
|
||||
@@ -50,8 +50,9 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel {
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
static public final int ERROR = 1;
|
||||
static public final int COMPILER_ERROR = 1; // temporary
|
||||
static public final int WARNING = 2;
|
||||
static public final int CURSOR_LINE_ERROR = 2;
|
||||
static public final int WARNING = 3;
|
||||
static public final int CURSOR_LINE_WARNING = 4;
|
||||
static public final int NOTICE = 0;
|
||||
|
||||
static final int YES = 1;
|
||||
@@ -121,19 +122,25 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel {
|
||||
fgColor = new Color[] {
|
||||
mode.getColor("status.notice.fgcolor"),
|
||||
mode.getColor("status.error.fgcolor"),
|
||||
mode.getColor("status.error.fgcolor"),
|
||||
mode.getColor("status.warning.fgcolor"),
|
||||
mode.getColor("status.warning.fgcolor")
|
||||
};
|
||||
|
||||
bgColor = new Color[] {
|
||||
mode.getColor("status.notice.bgcolor"),
|
||||
mode.getColor("status.error.bgcolor"),
|
||||
mode.getColor("status.error.bgcolor"),
|
||||
mode.getColor("status.warning.bgcolor"),
|
||||
mode.getColor("status.warning.bgcolor")
|
||||
};
|
||||
|
||||
bgImage = new Image[] {
|
||||
mode.loadImage("/lib/status/notice.png"),
|
||||
mode.loadImage("/lib/status/error.png"),
|
||||
mode.loadImage("/lib/status/edit.png")
|
||||
mode.loadImage("/lib/status/error.png"),
|
||||
mode.loadImage("/lib/status/warning.png"),
|
||||
mode.loadImage("/lib/status/warning.png")
|
||||
};
|
||||
|
||||
font = mode.getFont("status.font");
|
||||
|
||||
@@ -167,6 +167,12 @@ public class JavaEditor extends Editor {
|
||||
|
||||
public void windowGainedFocus(WindowEvent e) { }
|
||||
});
|
||||
|
||||
textarea.addCaretListener(new CaretListener() {
|
||||
public void caretUpdate(CaretEvent e) {
|
||||
errorCheckerService.updateEditorStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -953,13 +953,18 @@ public class ErrorCheckerService {
|
||||
if (errorMarker != null) {
|
||||
if (errorMarker.getType() == LineMarker.WARNING) {
|
||||
editor.statusMessage(errorMarker.getProblem().getMessage(),
|
||||
EditorStatus.WARNING);
|
||||
EditorStatus.CURSOR_LINE_WARNING);
|
||||
} else {
|
||||
editor.statusMessage(errorMarker.getProblem().getMessage(),
|
||||
EditorStatus.COMPILER_ERROR);
|
||||
EditorStatus.CURSOR_LINE_ERROR);
|
||||
}
|
||||
} else {
|
||||
editor.statusEmpty(); // No error, clear the status
|
||||
switch (editor.getStatusMode()) {
|
||||
case EditorStatus.CURSOR_LINE_ERROR:
|
||||
case EditorStatus.CURSOR_LINE_WARNING:
|
||||
editor.statusEmpty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user