Skip to content

Commit 4dde285

Browse files
author
Federico Fissore
committed
Ensure hyperlinks are coloured using theme.txt colour
Enabling [CTRL,CMD]+click to open hyperlinks
1 parent 4c7fbd2 commit 4dde285

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

Diff for: app/src/processing/app/Editor.java

+25-16
Original file line numberDiff line numberDiff line change
@@ -923,23 +923,32 @@ protected String findClassInZipFile(String base, File file) {
923923
return null;
924924
}
925925

926-
926+
927927
protected SketchTextArea createTextArea() throws IOException {
928-
SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
929-
textArea.requestFocusInWindow();
930-
textArea.setMarkOccurrences(true);
931-
textArea.setMarginLineEnabled(false);
932-
textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.codefolding"));
933-
textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
934-
// textArea.setClearWhitespaceLinesEnabled(false);
935-
textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
936-
textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
937-
textArea.setEditorListener(new EditorListener(this));
938-
939-
ToolTipManager.sharedInstance().registerComponent(textArea);
940-
941-
configurePopupMenu(textArea);
942-
return textArea;
928+
SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
929+
textArea.requestFocusInWindow();
930+
textArea.setMarkOccurrences(true);
931+
textArea.setMarginLineEnabled(false);
932+
textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.codefolding"));
933+
textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
934+
textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
935+
textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
936+
textArea.setEditorListener(new EditorListener(this));
937+
textArea.addHyperlinkListener(new HyperlinkListener() {
938+
@Override
939+
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
940+
try {
941+
base.getPlatform().openURL(hyperlinkEvent.getURL().toExternalForm());
942+
} catch (Exception e) {
943+
Base.showWarning(e.getMessage(), e.getMessage(), e);
944+
}
945+
}
946+
});
947+
948+
ToolTipManager.sharedInstance().registerComponent(textArea);
949+
950+
configurePopupMenu(textArea);
951+
return textArea;
943952
}
944953

945954
protected JMenuItem createToolMenuItem(String className) {

Diff for: app/src/processing/app/syntax/SketchTextArea.java

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public void setTheme(String name) throws IOException {
112112
setUseSelectedTextColor(false);
113113
setSelectionColor(processing.app.Theme.getColor("editor.selection.color"));
114114
setMatchedBracketBorderColor(processing.app.Theme.getColor("editor.brackethighlight.color"));
115+
setHyperlinkForeground((Color) processing.app.Theme.getStyledFont("url", getFont()).get("color"));
115116

116117
setSyntaxTheme(TokenTypes.DATA_TYPE, "data_type");
117118
setSyntaxTheme(TokenTypes.FUNCTION, "function");

0 commit comments

Comments
 (0)