Skip to content

Commit c2d9fab

Browse files
committed
Merge pull request processing#3907 from JakubValtar/update-status
Update status error/warning when changing the line
2 parents bc169f8 + 3674a5d commit c2d9fab

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

app/src/processing/app/ui/Editor.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,6 +2789,14 @@ public String getStatusMessage() {
27892789
}
27902790

27912791

2792+
/**
2793+
* Returns the current notice message in the editor status bar.
2794+
*/
2795+
public int getStatusMode() {
2796+
return status.mode;
2797+
}
2798+
2799+
27922800
// /**
27932801
// * Returns the current mode of the editor status bar: NOTICE, ERR or EDIT.
27942802
// */

app/src/processing/app/ui/EditorStatus.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel {
5050

5151
@SuppressWarnings("hiding")
5252
static public final int ERROR = 1;
53-
static public final int COMPILER_ERROR = 1; // temporary
54-
static public final int WARNING = 2;
53+
static public final int CURSOR_LINE_ERROR = 2;
54+
static public final int WARNING = 3;
55+
static public final int CURSOR_LINE_WARNING = 4;
5556
static public final int NOTICE = 0;
5657

5758
static final int YES = 1;
@@ -121,19 +122,25 @@ public void updateMode() {
121122
fgColor = new Color[] {
122123
mode.getColor("status.notice.fgcolor"),
123124
mode.getColor("status.error.fgcolor"),
125+
mode.getColor("status.error.fgcolor"),
126+
mode.getColor("status.warning.fgcolor"),
124127
mode.getColor("status.warning.fgcolor")
125128
};
126129

127130
bgColor = new Color[] {
128131
mode.getColor("status.notice.bgcolor"),
129132
mode.getColor("status.error.bgcolor"),
133+
mode.getColor("status.error.bgcolor"),
134+
mode.getColor("status.warning.bgcolor"),
130135
mode.getColor("status.warning.bgcolor")
131136
};
132137

133138
bgImage = new Image[] {
134139
mode.loadImage("/lib/status/notice.png"),
135140
mode.loadImage("/lib/status/error.png"),
136-
mode.loadImage("/lib/status/edit.png")
141+
mode.loadImage("/lib/status/error.png"),
142+
mode.loadImage("/lib/status/warning.png"),
143+
mode.loadImage("/lib/status/warning.png")
137144
};
138145

139146
font = mode.getFont("status.font");

java/src/processing/mode/java/JavaEditor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ public void windowLostFocus(WindowEvent e) {
167167

168168
public void windowGainedFocus(WindowEvent e) { }
169169
});
170+
171+
textarea.addCaretListener(new CaretListener() {
172+
public void caretUpdate(CaretEvent e) {
173+
errorCheckerService.updateEditorStatus();
174+
}
175+
});
170176
}
171177

172178

java/src/processing/mode/java/pdex/ErrorCheckerService.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,13 +953,18 @@ public void updateEditorStatus() {
953953
if (errorMarker != null) {
954954
if (errorMarker.getType() == LineMarker.WARNING) {
955955
editor.statusMessage(errorMarker.getProblem().getMessage(),
956-
EditorStatus.WARNING);
956+
EditorStatus.CURSOR_LINE_WARNING);
957957
} else {
958958
editor.statusMessage(errorMarker.getProblem().getMessage(),
959-
EditorStatus.COMPILER_ERROR);
959+
EditorStatus.CURSOR_LINE_ERROR);
960960
}
961961
} else {
962-
editor.statusEmpty(); // No error, clear the status
962+
switch (editor.getStatusMode()) {
963+
case EditorStatus.CURSOR_LINE_ERROR:
964+
case EditorStatus.CURSOR_LINE_WARNING:
965+
editor.statusEmpty();
966+
break;
967+
}
963968
}
964969
}
965970

0 commit comments

Comments
 (0)