FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

make error status open browser when url is present (fixes #3471) · dimr/processing@acc16ce · GitHub

Repository navigation

Commit acc16ce

Browse files
committed
make error status open browser when url is present (fixes processing#3471)
1 parent a773b9d commit acc16ce

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
package processing.app.ui;
2525

2626
import java.awt.*;
27+
import java.awt.event.MouseAdapter;
28+
import java.awt.event.MouseEvent;
2729

2830
import javax.swing.plaf.basic.BasicSplitPaneDivider;
2931
import javax.swing.plaf.basic.BasicSplitPaneUI;
3032

33+
import processing.app.Base;
3134
import processing.app.Mode;
35+
import processing.core.PApplet;
3236

3337

3438
/**
@@ -58,6 +62,7 @@ public class EditorStatus extends BasicSplitPaneDivider { //JPanel {
5862

5963
int mode;
6064
String message;
65+
String url;
6166

6267
Font font;
6368
FontMetrics metrics;
@@ -82,6 +87,29 @@ public EditorStatus(BasicSplitPaneUI ui, Editor editor) {
8287
this.editor = editor;
8388
empty();
8489
updateMode();
90+
91+
addMouseListener(new MouseAdapter() {
92+
public void mouseEntered(MouseEvent e) {
93+
if (url != null) {
94+
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
95+
}
96+
}
97+
98+
public void mousePressed(MouseEvent e) {
99+
if (url != null) {
100+
Base.openURL(url);
101+
}
102+
}
103+
});
104+
}
105+
106+
107+
static String findURL(String message) {
108+
String[] m = PApplet.match(message, "http\\S+");
109+
if (m != null) {
110+
return m[0];
111+
}
112+
return null;
85113
}
86114

87115

@@ -107,13 +135,15 @@ public void updateMode() {
107135
public void empty() {
108136
mode = NOTICE;
109137
message = NO_MESSAGE;
138+
url = null;
110139
repaint();
111140
}
112141

113142

114143
public void notice(String message) {
115144
mode = NOTICE;
116145
this.message = message;
146+
url = findURL(message);
117147
repaint();
118148
}
119149

@@ -126,6 +156,7 @@ public void unnotice(String unmessage) {
126156
public void error(String message) {
127157
mode = ERR;
128158
this.message = message;
159+
url = findURL(message);
129160
repaint();
130161
}
131162

‎todo.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ X Cannot find "processing.core" library. Line 12 in tab sketch_150704a
77
X also happens with "import to com.jogamp.opengl.GL2"
88
X https://github.com/processing/processing/issues/3547
99
X clean up the advanced opengl wiki page
10+
X Initialize the Find dialog with the current selection
11+
X https://github.com/processing/processing/issues/3457
12+
X Links in error bar are not selectable nor clickable
13+
X https://github.com/processing/processing/issues/3471
1014

1115
export
1216
X save export settings to preferences

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL