Tools__CodeHighlightingService.st
branchjv
changeset 13180 64a4186ddfce
parent 13178 c9bf900fe729
parent 13107 4ecaa66dabd8
child 13250 0decde6c459d
equal deleted inserted replaced
13179:b5d9725e479a 13180:64a4186ddfce
    26 "{ Package: 'stx:libtool' }"
    26 "{ Package: 'stx:libtool' }"
    27 
    27 
    28 "{ NameSpace: Tools }"
    28 "{ NameSpace: Tools }"
    29 
    29 
    30 BackgroundSourceProcessingService subclass:#CodeHighlightingService
    30 BackgroundSourceProcessingService subclass:#CodeHighlightingService
    31 	instanceVariableNames:''
    31 	instanceVariableNames:'syntaxPreferences'
    32 	classVariableNames:''
    32 	classVariableNames:''
    33 	poolDictionaries:''
    33 	poolDictionaries:''
    34 	category:'Interface-CodeView'
    34 	category:'Interface-CodeView'
    35 !
    35 !
    36 
    36 
    65 ! !
    65 ! !
    66 
    66 
    67 !CodeHighlightingService class methodsFor:'accessing'!
    67 !CodeHighlightingService class methodsFor:'accessing'!
    68 
    68 
    69 label
    69 label
    70 
    70     "Answers a short label - for UI"
    71     "Answers short label - for UI"
       
    72 
    71 
    73     ^'Syntax Highlighting'
    72     ^'Syntax Highlighting'
    74 
    73 
    75     "Created: / 07-03-2010 / 14:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    74     "Created: / 07-03-2010 / 14:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    76 ! !
    75 ! !
    77 
    76 
    78 !CodeHighlightingService methodsFor:'accessing'!
    77 !CodeHighlightingService methodsFor:'accessing'!
       
    78 
       
    79 preferences:preferences
       
    80     "must be able to set those - otherwise, it uses a different coloring scheme in
       
    81      expecco"
       
    82 
       
    83     syntaxPreferences := preferences.
       
    84 !
    79 
    85 
    80 syntaxHighlighter
    86 syntaxHighlighter
    81     | app lang highlighter |
    87     | app lang highlighter |
    82 
    88 
    83     "First, ask application..."
    89     "First, ask application..."
   214                             
   220                             
   215                             elements := ParseTreeIndex new.
   221                             elements := ParseTreeIndex new.
   216                             newCode := oldCode asText.
   222                             newCode := oldCode asText.
   217                             codeAspect := codeView codeAspect.
   223                             codeAspect := codeView codeAspect.
   218                             codeAspect == SyntaxHighlighter codeAspectMethod ifTrue:[
   224                             codeAspect == SyntaxHighlighter codeAspectMethod ifTrue:[
   219                                 highlighterClasses do:[:e|newCode := e formatMethod:mthd source:newCode in:cls using: nil elementsInto: elements].
   225                                 highlighterClasses do:[:e|newCode := e formatMethod:mthd source:newCode in:cls using:syntaxPreferences elementsInto: elements].
   220                             ] ifFalse:[
   226                             ] ifFalse:[
   221                                 codeAspect == (SyntaxHighlighter codeAspectExpression) ifTrue:[
   227                                 codeAspect == (SyntaxHighlighter codeAspectExpression) ifTrue:[
   222                                     highlighterClasses do:[:e|newCode := e formatExpression:newCode in:cls elementsInto: elements].
   228                                     highlighterClasses do:[:e|newCode := e formatExpression:newCode in:cls elementsInto: elements].
   223                                 ] ifFalse:[
   229                                 ] ifFalse:[
   224                                     codeView codeAspect == #classDefinition ifTrue:[
   230                                     codeView codeAspect == #classDefinition ifTrue:[
   358 ! !
   364 ! !
   359 
   365 
   360 !CodeHighlightingService class methodsFor:'documentation'!
   366 !CodeHighlightingService class methodsFor:'documentation'!
   361 
   367 
   362 version
   368 version
   363     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeHighlightingService.st,v 1.39 2013-06-30 08:08:39 cg Exp $'
   369     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeHighlightingService.st,v 1.41 2013-07-04 19:28:47 cg Exp $'
   364 !
   370 !
   365 
   371 
   366 version_CVS
   372 version_CVS
   367     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeHighlightingService.st,v 1.39 2013-06-30 08:08:39 cg Exp $'
   373     ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeHighlightingService.st,v 1.41 2013-07-04 19:28:47 cg Exp $'
   368 !
   374 !
   369 
   375 
   370 version_HG
   376 version_HG
   371 
   377 
   372     ^ '$Changeset: <not expanded> $'
   378     ^ '$Changeset: <not expanded> $'
   373 !
   379 !
   374 
   380 
   375 version_SVN
   381 version_SVN
   376     ^ '$Id: Tools__CodeHighlightingService.st,v 1.39 2013-06-30 08:08:39 cg Exp $'
   382     ^ '$Id: Tools__CodeHighlightingService.st,v 1.41 2013-07-04 19:28:47 cg Exp $'
   377 ! !
   383 ! !
   378 
   384