Editor theme: read styles from theme object rather than from preferences themselves
For backward compatibility, if no theme object is returned,
use preferences objects.
--- a/tools/GroovySourceHighlighter.st Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/GroovySourceHighlighter.st Tue Dec 05 22:04:46 2017 +0000
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1996-2015 by Claus Gittinger
@@ -161,12 +159,16 @@
formatClassDefinition:source in:class
preferences isNil ifTrue:[
- preferences := UserPreferences current.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
].
^ self format: source
"Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 02-10-2013 / 14:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:15:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatClassDefinition:source in:class elementsInto: els
@@ -180,12 +182,16 @@
formatExpression:source in:class
preferences isNil ifTrue:[
- preferences := UserPreferences current.
- ].
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+ ].
^ self format: source
"Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-10-2013 / 14:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:15:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatExpression:source in:class elementsInto: els
@@ -199,21 +205,33 @@
formatMethod:mth source:source in:class using: prefs
preferences := prefs.
preferences isNil ifTrue:[
- preferences := UserPreferences current.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
].
^ self format: source
"Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-10-2013 / 14:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:15:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatMethod:mth source:source in:class using: prefs elementsInto: els
preferences := prefs.
+ preferences isNil ifTrue:[
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+ ].
sourceIndex := els.
^self formatMethod:mth source:source in:class using: prefs
"Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:16:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
@@ -224,18 +242,22 @@
sourceText := line asText.
preferences := syntaxPreferences.
preferences isNil ifTrue:[
- preferences := UserPreferences current.
- ].
+ preferences isNil ifTrue:[
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+ ]. ].
scanner := Scanner for: line asString.
scanner highlighter: self.
- [
+ Error ignoreIn:[
[ scanner nextToken ~~ #EOF ] whileTrue.
- ] on: Error do:[
-
].
^ sourceText
"Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:16:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GroovySourceHighlighter methodsFor:'formatting-private'!
--- a/tools/JavaAbstractLexicalHighlighter.st Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/JavaAbstractLexicalHighlighter.st Tue Dec 05 22:04:46 2017 +0000
@@ -1,5 +1,7 @@
"{ Package: 'stx:libjava/tools' }"
+"{ NameSpace: Smalltalk }"
+
JavaAbstractSourceHighlighter subclass:#JavaAbstractLexicalHighlighter
instanceVariableNames:''
classVariableNames:''
@@ -69,8 +71,12 @@
sourceText := line asText.
preferences := syntaxPreferences.
preferences isNil ifTrue:[
- preferences := UserPreferences current.
- ].
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+ ].
scanner := self scannerClass for: line asString.
scanner highlighter: self.
[
@@ -81,7 +87,7 @@
^ sourceText
"Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 25-06-2014 / 12:48:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaAbstractLexicalHighlighter methodsFor:'formatting-private'!
@@ -91,7 +97,11 @@
| scanner token lastValue0 lastPosition0 |
preferences isNil ifTrue:[
- preferences := UserPreferences current.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
].
sourceText := source asText.
scanner := self scannerClass for: source string.
@@ -113,7 +123,7 @@
^ sourceText
"Created: / 03-10-2013 / 20:19:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 25-06-2014 / 12:02:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:17:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaAbstractLexicalHighlighter class methodsFor:'documentation'!
--- a/tools/JavaAbstractSourceHighlighter.st Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/JavaAbstractSourceHighlighter.st Tue Dec 05 22:04:46 2017 +0000
@@ -125,10 +125,18 @@
formatMethod:mth source:source in:class using: prefs elementsInto: els
preferences := prefs.
+ preferences isNil ifTrue:[
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
+ ].
sourceIndex := els.
^self formatMethod:mth source:source in:class using: prefs
"Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
--- a/tools/JavaLexicalHighlighter.st Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/JavaLexicalHighlighter.st Tue Dec 05 22:04:46 2017 +0000
@@ -1,5 +1,7 @@
"{ Package: 'stx:libjava/tools' }"
+"{ NameSpace: Smalltalk }"
+
JavaAbstractLexicalHighlighter subclass:#JavaLexicalHighlighter
instanceVariableNames:''
classVariableNames:''
@@ -40,11 +42,12 @@
line isEmptyOrNil ifTrue:[ ^ nil ].
- sourceText := line asText.
- preferences := UserPreferences current.
- preferences isNil ifTrue:[
- preferences := UserPreferences current.
- ].
+ sourceText := line asText.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
scanner := self scannerClass for: line asString.
scanner highlighter: self.
[
@@ -55,6 +58,7 @@
^ sourceText
"Created: / 12-08-2014 / 13:36:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:18:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaLexicalHighlighter::HighlightingScanner methodsFor:'accessing'!
--- a/tools/JavaSyntaxHighlighter.st Thu Oct 26 22:38:06 2017 +0100
+++ b/tools/JavaSyntaxHighlighter.st Tue Dec 05 22:04:46 2017 +0000
@@ -20,6 +20,8 @@
"
"{ Package: 'stx:libjava/tools' }"
+"{ NameSpace: Smalltalk }"
+
JavaAbstractSourceHighlighter subclass:#JavaSyntaxHighlighter
instanceVariableNames:''
classVariableNames:''
@@ -109,7 +111,11 @@
often same same source is to be highlighted"
preferences isNil ifTrue:[
- preferences := UserPreferences current.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
].
(JavaVM booted not or: [self doLexicalHighlightingOnly]) ifTrue:[
^ self format: source string.
@@ -177,7 +183,7 @@
]
"Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 12-12-2014 / 03:04:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatClassDefinition: code line: line number: lineNr in: cls
@@ -189,7 +195,11 @@
formatMethod:mth source:source in:class using: prefs
preferences := prefs.
preferences isNil ifTrue:[
- preferences := UserPreferences current.
+ "/ The `...codeViewThene ? UserPreferences current` trick below is
+ "/ there to make this code working with both old and editor-thene-aware
+ "/ code. Will wanish as soon as editor thene support will be
+ "/ integrated.
+ preferences := UserPreferences current codeViewTheme ? UserPreferences current.
].
JavaMethod showFullSource ifTrue:[
@@ -229,7 +239,7 @@
^ sourceText
"Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (format): / 26-11-2013 / 23:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-12-2017 / 21:19:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
@@ -291,7 +301,6 @@
"Modified: / 17-09-2013 / 01:33:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaSyntaxHighlighter::Indexer methodsFor:'accessing'!
index
@@ -468,7 +477,6 @@
"Modified: / 11-09-2013 / 01:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-
!JavaSyntaxHighlighter::Marker methodsFor:'accessing'!
highlighter:aJavaSourceHighlighter