Ensure hyperlinks are coloured using theme.txt colour

Enabling [CTRL,CMD]+click to open hyperlinks
This commit is contained in:
Federico Fissore 2015-04-28 12:36:42 +02:00
parent 5967294287
commit eb42243475
2 changed files with 26 additions and 16 deletions

View File

@ -956,23 +956,32 @@ public class Editor extends JFrame implements RunnerListener {
return null;
}
protected SketchTextArea createTextArea() throws IOException {
SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
textArea.requestFocusInWindow();
textArea.setMarkOccurrences(true);
textArea.setMarginLineEnabled(false);
textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.codefolding"));
textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
// textArea.setClearWhitespaceLinesEnabled(false);
textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
textArea.setEditorListener(new EditorListener(this));
ToolTipManager.sharedInstance().registerComponent(textArea);
configurePopupMenu(textArea);
return textArea;
SketchTextArea textArea = new SketchTextArea(base.getPdeKeywords());
textArea.requestFocusInWindow();
textArea.setMarkOccurrences(true);
textArea.setMarginLineEnabled(false);
textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.codefolding"));
textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
textArea.setEditorListener(new EditorListener(this));
textArea.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
try {
base.getPlatform().openURL(hyperlinkEvent.getURL().toExternalForm());
} catch (Exception e) {
Base.showWarning(e.getMessage(), e.getMessage(), e);
}
}
});
ToolTipManager.sharedInstance().registerComponent(textArea);
configurePopupMenu(textArea);
return textArea;
}
protected JMenuItem createToolMenuItem(String className) {

View File

@ -112,6 +112,7 @@ public class SketchTextArea extends RSyntaxTextArea {
setUseSelectedTextColor(false);
setSelectionColor(processing.app.Theme.getColor("editor.selection.color"));
setMatchedBracketBorderColor(processing.app.Theme.getColor("editor.brackethighlight.color"));
setHyperlinkForeground((Color) processing.app.Theme.getStyledFont("url", getFont()).get("color"));
setSyntaxTheme(TokenTypes.DATA_TYPE, "data_type");
setSyntaxTheme(TokenTypes.FUNCTION, "function");