VersionDiffBrowser.st
changeset 19440 4970cf19ac71
parent 19351 b6350f5d7ae3
child 19463 33e02e0e9711
equal deleted inserted replaced
19439:3f67162018e1 19440:4970cf19ac71
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2000 by eXept Software AG
     4  COPYRIGHT (c) 2000 by eXept Software AG
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   326              name: 'InfoLabel'
   328              name: 'InfoLabel'
   327              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   329              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   328              uuid: '90e47868-7175-11e9-a23a-b8f6b1108e05'
   330              uuid: '90e47868-7175-11e9-a23a-b8f6b1108e05'
   329              level: -1
   331              level: -1
   330              translateLabel: true
   332              translateLabel: true
   331              labelChannel: infoHolder
   333              labelChannel: informationHolder
   332              adjust: left
   334              adjust: left
   333            )
   335            )
   334           )
   336           )
   335         
   337         
   336        )
   338        )
   608              name: 'InfoLabel'
   610              name: 'InfoLabel'
   609              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   611              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   610              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
   612              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
   611              level: -1
   613              level: -1
   612              translateLabel: true
   614              translateLabel: true
   613              labelChannel: infoHolder
   615              labelChannel: informationHolder
   614              adjust: left
   616              adjust: left
   615            )
   617            )
   616           )
   618           )
   617         
   619         
   618        )
   620        )
   869              name: 'InfoLabel'
   871              name: 'InfoLabel'
   870              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   872              layout: (LayoutFrame 0 0 -25 1 0 1 0 1)
   871              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
   873              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
   872              level: -1
   874              level: -1
   873              translateLabel: true
   875              translateLabel: true
   874              labelChannel: infoHolder
   876              labelChannel: informationHolder
   875              adjust: left
   877              adjust: left
   876            )
   878            )
   877           )
   879           )
   878         
   880         
   879        )
   881        )
  2283     ^ infoHolder.
  2285     ^ infoHolder.
  2284 
  2286 
  2285     "Modified: / 08-05-2019 / 11:05:10 / Claus Gittinger"
  2287     "Modified: / 08-05-2019 / 11:05:10 / Claus Gittinger"
  2286 !
  2288 !
  2287 
  2289 
       
  2290 informationHolder
       
  2291     ^ infoHolder.
       
  2292 
       
  2293     "Modified: / 08-05-2019 / 11:05:10 / Claus Gittinger"
       
  2294 !
       
  2295 
  2288 methodText
  2296 methodText
  2289     "aspect for the text in the method text view"
  2297     "aspect for the text in the method text view"
  2290 
  2298 
  2291     ^ methodText.
  2299     ^ methodText.
  2292 
  2300 
  2658         changeB := (methodsChangedFiltered at:sel) second.
  2666         changeB := (methodsChangedFiltered at:sel) second.
  2659         self withReadCursorDo:[
  2667         self withReadCursorDo:[
  2660             |info|
  2668             |info|
  2661 
  2669 
  2662             info := self shortChangeInfoFor:changeA and:changeB.
  2670             info := self shortChangeInfoFor:changeA and:changeB.
  2663             info notNil ifTrue:[
  2671             self information:(info ? 'Methods are different').    
  2664                 self infoHolder value:info
       
  2665             ].    
       
  2666             self diffTextView
  2672             self diffTextView
  2667                 text1:(changeA prettyPrintedSource) 
  2673                 text1:(changeA prettyPrintedSource) 
  2668                 text2:(changeB prettyPrintedSource)        
  2674                 text2:(changeB prettyPrintedSource)        
  2669         ].
  2675         ].
  2670         self showDiffTextView.
  2676         self showDiffTextView.
  2695         self methodsChangedSelection value:nil.
  2701         self methodsChangedSelection value:nil.
  2696         change := methodsOnlyInAFiltered "self changeSetA" at:sel.
  2702         change := methodsOnlyInAFiltered "self changeSetA" at:sel.
  2697         self methodText value:(change prettyPrintedSource).
  2703         self methodText value:(change prettyPrintedSource).
  2698         self showSingleTextView.
  2704         self showSingleTextView.
  2699         (versionA := diffTextLabelA value) notEmptyOrNil ifTrue:[
  2705         (versionA := diffTextLabelA value) notEmptyOrNil ifTrue:[
  2700             self infoHolder value:('Method removed from version: ',versionA).
  2706             self information:'Method removed from %1' with:versionA.
  2701         ].    
  2707         ] ifFalse:[
       
  2708             self information:'Method removed'.
       
  2709         ].
  2702     ] ifFalse:[
  2710     ] ifFalse:[
  2703         self showVersionInfoIfNothingSelected
  2711         self showVersionInfoIfNothingSelected
  2704     ].
  2712     ].
  2705 
  2713 
  2706     "Modified: / 05-02-2017 / 12:08:07 / cg"
  2714     "Modified: / 05-02-2017 / 12:08:07 / cg"
  2711     "the selection in the list of the 'method only in version B' changed.
  2719     "the selection in the list of the 'method only in version B' changed.
  2712      Reset the selection of the two other lists and show the method in
  2720      Reset the selection of the two other lists and show the method in
  2713      the text view.
  2721      the text view.
  2714      <return: self>"
  2722      <return: self>"
  2715 
  2723 
  2716     |change sel versionA|
  2724     |change sel versionB|
  2717 
  2725 
  2718     "/ self information:''.
  2726     "/ self information:''.
  2719 
  2727 
  2720     sel := self methodsOnlyInBSelection value.
  2728     sel := self methodsOnlyInBSelection value.
  2721     sel notNil ifTrue:[
  2729     sel notNil ifTrue:[
  2722         self methodsOnlyInASelection value:nil.
  2730         self methodsOnlyInASelection value:nil.
  2723         self methodsChangedSelection value:nil.
  2731         self methodsChangedSelection value:nil.
  2724         change := methodsOnlyInBFiltered "self changeSetB" at:sel.
  2732         change := methodsOnlyInBFiltered "self changeSetB" at:sel.
  2725         self methodText value:(change prettyPrintedSource).
  2733         self methodText value:(change prettyPrintedSource).
  2726         self showSingleTextView.
  2734         self showSingleTextView.
  2727         (versionA := diffTextLabelA value) notEmptyOrNil ifTrue:[
  2735         (versionB := diffTextLabelB value) notEmptyOrNil ifTrue:[
  2728             self infoHolder value:('Method added to version: ',versionA).
  2736             self information:'Method added to %1' with:versionB.
       
  2737         ] ifFalse:[
       
  2738             self information:'Method added'.
  2729         ].    
  2739         ].    
  2730     ] ifFalse:[
  2740     ] ifFalse:[
  2731         self showVersionInfoIfNothingSelected
  2741         self showVersionInfoIfNothingSelected
  2732     ].
  2742     ].
  2733 
  2743 
  2881                     (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
  2891                     (treeA semanticallyEqualTo:treeB withMapping:(Dictionary  new)) ifTrue:[
  2882                         ^ 'Methods seem to do the same'.
  2892                         ^ 'Methods seem to do the same'.
  2883                     ].
  2893                     ].
  2884                     ^ 'Methods are different'.
  2894                     ^ 'Methods are different'.
  2885                 ].
  2895                 ].
  2886                 self infoHolder value:'ParseError while comparing - please check the code'.
  2896                 self information:'ParseError while comparing - please check the code'.
  2887                 ^ nil
  2897                 ^ nil
  2888             ].
  2898             ].
  2889 
  2899 
  2890             changeA isClassDefinitionChange ifTrue:[
  2900             changeA isClassDefinitionChange ifTrue:[
  2891                 changeB isClassDefinitionChange ifFalse:[^ 'Different change types'].
  2901                 changeB isClassDefinitionChange ifFalse:[^ 'Different change types'].
  4298         v menuHolder:mGen.
  4308         v menuHolder:mGen.
  4299         v menuMessage:#value.
  4309         v menuMessage:#value.
  4300     ]
  4310     ]
  4301 !
  4311 !
  4302 
  4312 
  4303 informationUntranslated:msg
       
  4304     self infoHolder value:msg
       
  4305 
       
  4306     "Created: / 09-08-2018 / 15:40:52 / Claus Gittinger"
       
  4307 !
       
  4308 
       
  4309 printStringForChange:aChange
  4313 printStringForChange:aChange
  4310     "generate a print string for a change."
  4314     "generate a print string for a change."
  4311 
  4315 
  4312     |m changeClassName classOrMetaString useChangesString selectorString
  4316     |m changeClassName classOrMetaString useChangesString selectorString
  4313      singleComparedClass singleComparedClassesName singleComparedMetaclassesName
  4317      singleComparedClass singleComparedClassesName singleComparedMetaclassesName
  4369                 m := m originalMethodIfWrapped.
  4373                 m := m originalMethodIfWrapped.
  4370                 selectorString := m printStringForBrowserWithSelector:aChange changeSelector inClass:aChange changeClass.
  4374                 selectorString := m printStringForBrowserWithSelector:aChange changeSelector inClass:aChange changeClass.
  4371             ].
  4375             ].
  4372         ].
  4376         ].
  4373         changeClassName notEmptyOrNil ifTrue:[
  4377         changeClassName notEmptyOrNil ifTrue:[
  4374             selectorString := ' » ',selectorString
  4378             selectorString := ' » ',selectorString
  4375         ]
  4379         ]
  4376     ].
  4380     ].
  4377 
  4381 
  4378     printString := changeClassName,classOrMetaString,selectorString.
  4382     printString := changeClassName,classOrMetaString,selectorString.
  4379     aChange isMethodCategoryChange ifTrue:[
  4383     aChange isMethodCategoryChange ifTrue:[