Tools__DiffCodeView2.st
author Jan Vrany <jan.vrany@labware.com>
Wed, 07 Sep 2022 15:27:34 +0100
branchjv
changeset 19640 9001c87bacbe
parent 18532 cccb41254edf
permissions -rw-r--r--
Use `allTestSelectors includes:` instead of `isTestSelector:` ...as the latter is Smalltalk/X specific so overriding it won't work with portable code. Indeed, this is much slower for large classes. Will see.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10074
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     3
              All Rights Reserved
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10074
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     5
Permission is hereby granted, free of charge, to any person
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     6
obtaining a copy of this software and associated documentation
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     7
files (the 'Software'), to deal in the Software without
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     8
restriction, including without limitation the rights to use,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    10
copies of the Software, and to permit persons to whom the
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    11
Software is furnished to do so, subject to the following
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    12
conditions:
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    13
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    14
The above copyright notice and this permission notice shall be
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    15
included in all copies or substantial portions of the Software.
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    16
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
TwoColumnTextView subclass:#DiffCodeView2
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	instanceVariableNames:''
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
	classVariableNames:''
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	category:'Interface-CodeView'
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
Object subclass:#DiffData
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
	instanceVariableNames:'text1 text2 inserted deleted changed'
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
	classVariableNames:''
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
	poolDictionaries:''
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
	privateIn:DiffCodeView2
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
!DiffCodeView2 class methodsFor:'documentation'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
copyright
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
"
10074
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    48
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    49
              All Rights Reserved
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    50
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    51
Permission is hereby granted, free of charge, to any person
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    52
obtaining a copy of this software and associated documentation
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    53
files (the 'Software'), to deal in the Software without
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    54
restriction, including without limitation the rights to use,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    55
copy, modify, merge, publish, distribute, sublicense, and/or sell
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    56
copies of the Software, and to permit persons to whom the
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    57
Software is furnished to do so, subject to the following
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    58
conditions:
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
10074
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    60
The above copyright notice and this permission notice shall be
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    61
included in all copies or substantial portions of the Software.
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    62
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    63
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    64
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    65
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    66
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    67
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    68
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    69
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5c6c66fa40d1 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9978
diff changeset
    70
OTHER DEALINGS IN THE SOFTWARE.
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!DiffCodeView2 class methodsFor:'defaults'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
textViewClass
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    "return the type of the synced subViews.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
     Can be redefined in subclasses"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    ^ Tools::CodeView2
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    "Created: / 06-03-2010 / 10:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
!DiffCodeView2 methodsFor:'accessing'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
10331
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    87
classHolder: aValueModel
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    88
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    89
    textViews do:[:each|each classHolder: aValueModel].
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    90
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    91
    "Created: / 19-07-2011 / 12:55:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    92
!
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
    93
11707
8215ef54f2a1 added: #codeAspect:
Claus Gittinger <cg@exept.de>
parents: 11679
diff changeset
    94
codeAspect:aSymbol
14639
457ed8f2bbde class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14370
diff changeset
    95
    "tell the textViews what is shown, so they can adjust their
457ed8f2bbde class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14370
diff changeset
    96
     syntaxhighlighters.
457ed8f2bbde class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14370
diff changeset
    97
     See SyntaxHighlighter codeAspectXXX for possible aspects."
457ed8f2bbde class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14370
diff changeset
    98
457ed8f2bbde class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14370
diff changeset
    99
     textViews do:[:each|each codeAspect:aSymbol].
11707
8215ef54f2a1 added: #codeAspect:
Claus Gittinger <cg@exept.de>
parents: 11679
diff changeset
   100
8215ef54f2a1 added: #codeAspect:
Claus Gittinger <cg@exept.de>
parents: 11679
diff changeset
   101
    "Created: / 27-07-2012 / 23:24:46 / cg"
8215ef54f2a1 added: #codeAspect:
Claus Gittinger <cg@exept.de>
parents: 11679
diff changeset
   102
!
8215ef54f2a1 added: #codeAspect:
Claus Gittinger <cg@exept.de>
parents: 11679
diff changeset
   103
10331
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   104
languageHolder: aValueModel
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   105
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   106
    textViews do:[:each|each languageHolder: aValueModel].
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   107
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   108
    "Created: / 19-07-2011 / 12:55:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   109
!
395bdb2d4575 Improvements in diffing tools
vrany
parents: 10074
diff changeset
   110
13808
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   111
modeHolder: aValueModel
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   112
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   113
    textViews do:[:each|each modeHolder: aValueModel].
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   114
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   115
    "Created: / 26-07-2012 / 19:19:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   116
!
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   117
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
text1:t1 text2:t2 
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    |data|
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
    data := self computeDiffDataForText1:t1 text2:t2.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
    (textViews at:1) 
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
        contents:(data text1);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
        deletedLines:(data deleted);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        changedLines:(data changed);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        insertedLines:#();    
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        originDiffText:t1;
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
        emptyLines:(data inserted).
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    (textViews at:2) 
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
        contents:(data text2);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
        deletedLines:#();
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
        changedLines:(data changed);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
        insertedLines:(data inserted);
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
        originDiffText:t2;
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
        emptyLines:(data deleted).
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    "Created: / 06-03-2010 / 10:45:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    "Modified: / 22-06-2010 / 21:36:35 / Jakub <zelenja7@fel.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    "Modified: / 15-07-2010 / 23:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
!DiffCodeView2 methodsFor:'initialization'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
initialize
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    super initialize.
15279
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   148
    textViews do:[:thisView | 
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   149
        thisView diffMode:true.
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   150
        thisView ~= textViews first ifTrue:[
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   151
            thisView showGutterChannel value:false
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   152
        ].
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   153
        textViews do:[:otherView | 
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   154
            thisView == otherView ifFalse:[
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   155
                thisView synchronizeWith:otherView
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   156
            ]
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   157
        ]
e15c49676d90 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 14639
diff changeset
   158
    ].
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    "Created: / 06-04-2010 / 14:15:03 / Jakub <zelenja7@fel.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    "Modified: / 23-06-2010 / 19:36:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!DiffCodeView2 methodsFor:'private'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
computeDiffDataForText1:t1 text2:t2 
11598
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   167
    "created diffText object from two strings
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   168
     This processes the DiffData as returned by the (now internal) Diff-tool"
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    
14370
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   170
    "/ cg: same code as in Diff2CodeView2!!!!!!
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   171
    "/ please refactor and make this a utility method on the class side
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   172
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   173
    |array1 array2 diff change index1 index2 text1 text2 i 
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   174
     diffData deleted inserted helperText addConstant1 addConstant2 changed helper ins del pom
15474
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   175
     array1Size array2Size cr|
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   176
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   177
    cr := Character cr asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   178
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   179
    "create line arrays from origin text(1 item/row)"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   180
    array1 := self createArray:t1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   181
    array2 := self createArray:t2.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   182
     "inserted,deleted, cahnged lines"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   183
    inserted := OrderedCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   184
    deleted := OrderedCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   185
    changed := OrderedCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   186
     "indicates which row of origin text is added to ne text"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   187
    index1 := 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   188
    index2 := 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   189
     "indicate how much rows were deleted or inserted "
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   190
    addConstant1 := 0.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   191
    addConstant2 := 0.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   192
    text1 := OrderedCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   193
    text2 := OrderedCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   194
    diff := Diff new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   195
    diff a:array1 b:array2.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   196
    change := diff diff:false.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   197
    diffData := DiffData new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   198
    [ change notNil ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   199
        "check first lines which are same"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   200
        (((change line0) > 0) and:[ ((change line1) > 0) ]) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   201
            [
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   202
                index1 <= (change line0)
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   203
            ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   204
                helperText := (array1 at:index1) asText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   205
                text1 add: helperText asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   206
                index1 := index1 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   207
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   208
            [
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   209
                index2 <= (change line1)
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   210
            ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   211
                helperText := (array2 at:index2) asText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   212
                text2 add: helperText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   213
                index2 := index2 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   214
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   215
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   216
        ins := change inserted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   217
        del := change deleted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   218
        index1 := (change line0) + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   219
        index2 := (change line1) + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   220
         "find replaced lines "
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   221
        ((del > 0) and:[ ins > 0 ]) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   222
            helper := del - ins.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   223
            (helper <= 0) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   224
                pom := change deleted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   225
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   226
            (helper > 0) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   227
                pom := change inserted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   228
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   229
             "its same count row"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   230
            i := 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   231
            [ i <= pom ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   232
                changed add:index1 + addConstant1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   233
                text1 add: (array1 at:index1) asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   234
                text2 add: (array2 at:index2) asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   235
                index1 := index1 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   236
                index2 := index2 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   237
                del := del - 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   238
                ins := ins - 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   239
                i := i + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   240
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   241
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   242
         "find deleted lines"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   243
        (del > 0) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   244
            i := 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   245
            [ i <= del ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   246
                deleted add:index1 + addConstant1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   247
                text2 add: cr.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   248
                addConstant2 := addConstant2 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   249
                text1 add: (array1 at:index1) asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   250
                index1 := index1 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   251
                i := i + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   252
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   253
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   254
         "find inserted lines"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   255
        (ins > 0) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   256
            i := 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   257
            [ i <= ins ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   258
                inserted add:index2 + addConstant2.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   259
                text1 add: cr.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   260
                addConstant1 := addConstant1 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   261
                text2 add: (array2 at:index2) asString.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   262
                index2 := index2 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   263
                i := i + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   264
            ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   265
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   266
        change := change nextLink.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   267
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   268
     "kontrola zda nam nechybi posledni znaky"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   269
    array1Size := array1 size.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   270
    (index1 <= array1Size) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   271
        [ index1 <= array1Size ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   272
            helperText := (array1 at:index1) asText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   273
            text1 add: helperText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   274
            index1 := index1 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   275
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   276
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   277
    array2Size := array2 size.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   278
    (index2 <= array2Size) ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   279
        [ index2 <= array2Size ] whileTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   280
            helperText := (array2 at:index2) asText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   281
            text2 add: helperText.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   282
            index2 := index2 + 1.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   283
        ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   284
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   285
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   286
    1 to:(text1 size min:text2 size) do:[:idx |
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   287
        |l1 l2|
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   288
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   289
        l1 := text1 at:idx.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   290
        l2 := text2 at:idx.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   291
        l1 = l2 ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   292
            text1 at:idx put:l1 string.   "/ remove color
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   293
            text2 at:idx put:l2 string.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   294
            changed remove:idx ifAbsent:[].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   295
        ] ifFalse:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   296
            l1 withoutSeparators = l2 withoutSeparators ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   297
                text1 at:idx put:l1 string.     "/ remove color  
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   298
                text2 at:idx put:l2 string.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   299
                changed remove:idx ifAbsent:[].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   300
            ] ifFalse:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   301
                "/ self halt.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   302
            ]
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   303
        ]
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   304
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   305
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   306
    diffData text1:(text1 asStringWith:'').
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   307
    diffData text2:(text2 asStringWith:'').
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   308
    diffData changed:changed.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   309
    diffData inserted:inserted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   310
    diffData deleted:deleted.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   311
    ^ diffData.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   312
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   313
    "Modified: / 22-06-2010 / 21:02:50 / Jakub <zelenja7@fel.cvut.cz>"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   314
    "Modified: / 24-06-2010 / 21:07:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   315
    "Modified: / 17-07-2012 / 18:55:01 / cg"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   316
!
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   317
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   318
createArray:text1
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   319
    "cg: isn't that an obfuscated variation of #asCollectionOfLines ?"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   320
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   321
    "/ ^ text1 asStringCollection. "/ yes, it looks like !! 
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   322
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   323
    "/ JV@2012-07-26: Yes, looks like but it is not!! This version
15723
901522438802 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15474
diff changeset
   324
    "/ keeps CRs in lines. Do not change it back - if you do, DiffCodeView2 
15474
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   325
    "/ will show whole source in a single line.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   326
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   327
    | array src line c |
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   328
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   329
    array := StringCollection new.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   330
    src := text1 readStream.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   331
    line := (String new: 80) writeStream.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   332
    [ src atEnd ] whileFalse:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   333
        c := src next.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   334
        line nextPut: c.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   335
        c == Character cr ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   336
            array add: line contents.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   337
            line reset.
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   338
        ]        
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   339
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   340
    line position ~~ 0 ifTrue:[
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   341
        array add: line contents
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   342
    ].
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   343
    ^array
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   344
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   345
    "Created: / 22-03-2010 / 14:48:27 / Jakub <zelenja7@fel.cvut.cz>"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   346
    "Modified: / 17-07-2012 / 18:55:21 / cg"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   347
    "Modified (comment): / 26-07-2012 / 21:45:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   348
!
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   349
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   350
old_computeDiffDataForText1:t1 text2:t2 
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   351
    "created diffText object from two strings
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   352
     This processes the DiffData as returned by the (now internal) Diff-tool"
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   353
    
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   354
    "/ cg: same code as in Diff2CodeView2!!!!!!
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   355
    "/ please refactor and make this a utility method on the class side
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   356
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   357
    |array1 array2 diff change index1 index2 text1 text2 i 
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   358
     diffData deleted inserted helperText addConstant1 addConstant2 changed helper ins del pom
14370
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   359
     array1Size array2Size|
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
11598
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   361
    "create line arrays from origin text(1 item/row)"
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
    array1 := self createArray:t1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
    array2 := self createArray:t2.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
     "inserted,deleted, cahnged lines"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    inserted := OrderedCollection new.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
    deleted := OrderedCollection new.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
    changed := OrderedCollection new.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
     "indicates which row of origin text is added to ne text"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
    index1 := 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
    index2 := 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
     "indicate how much rows were deleted or inserted "
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
    addConstant1 := 0.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
    addConstant2 := 0.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
    text1 := ''.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
    text2 := ''.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
    diff := Diff new.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
    diff a:array1 b:array2.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    change := diff diff:false.
11598
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   379
    diffData := DiffData new.
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
    [ change notNil ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
        "check first lines which are same"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
        (((change line0) > 0) and:[ ((change line1) > 0) ]) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
            [
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
                index1 <= (change line0)
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
            ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
                helperText := (array1 at:index1) asText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
                text1 := text1 asString , helperText asString.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
                index1 := index1 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
            [
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
                index2 <= (change line1)
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
            ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
                helperText := (array2 at:index2) asText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
                text2 := text2 , helperText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
                index2 := index2 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
        ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
        ins := change inserted.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
        del := change deleted.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
        index1 := (change line0) + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
        index2 := (change line1) + 1.
15474
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   402
         "find replaced lines "
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
        ((del > 0) and:[ ins > 0 ]) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
            helper := del - ins.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
            (helper <= 0) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
                pom := change deleted.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
            (helper > 0) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
                pom := change inserted.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
             "its same count row"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
            i := 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
            [ i <= pom ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
                changed add:index1 + addConstant1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
                text1 := text1 , (array1 at:index1) asString.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
                text2 := text2 , (array2 at:index2) asString.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
                index1 := index1 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
                index2 := index2 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
                del := del - 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
                ins := ins - 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
                i := i + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
        ].
15474
9d8648afebd3 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15279
diff changeset
   424
         "find deleted lines"
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
        (del > 0) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
            i := 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
            [ i <= del ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
                deleted add:index1 + addConstant1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
                text2 := text2 , Character cr.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
                addConstant2 := addConstant2 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
                text1 := text1 , (array1 at:index1) asString.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
                index1 := index1 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
                i := i + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
        ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
         "find inserted lines"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
        (ins > 0) ifTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
            i := 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
            [ i <= ins ] whileTrue:[
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
                inserted add:index2 + addConstant2.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
                text1 := text1 , Character cr.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
                addConstant1 := addConstant1 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
                text2 := text2 , (array2 at:index2) asString.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
                index2 := index2 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
                i := i + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
            ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
        ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
        change := change nextLink.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
     "kontrola zda nam nechybi posledni znaky"
14370
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   451
    array1Size := array1 size.
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   452
    (index1 <= array1Size) ifTrue:[
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   453
        [ index1 <= array1Size ] whileTrue:[
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
            helperText := (array1 at:index1) asText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
            text1 := text1 , helperText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
            index1 := index1 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
        ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
    ].
14370
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   459
    array2Size := array2 size.
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   460
    (index2 <= array2Size) ifTrue:[
bb3f3eec9f1b class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 13808
diff changeset
   461
        [ index2 <= array2Size ] whileTrue:[
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
            helperText := (array2 at:index2) asText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
            text2 := text2 , helperText.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
            index2 := index2 + 1.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
        ].
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
    ].
11598
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   467
    diffData text1:text1.
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   468
    diffData text2:text2.
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   469
    diffData changed:changed.
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   470
    diffData inserted:inserted.
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   471
    diffData deleted:deleted.
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   472
    ^ diffData.
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    "Modified: / 22-06-2010 / 21:02:50 / Jakub <zelenja7@fel.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
    "Modified: / 24-06-2010 / 21:07:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
11598
0350a5f84be7 comment/format in: #computeDiffDataForText1:text2:
Claus Gittinger <cg@exept.de>
parents: 10331
diff changeset
   476
    "Modified: / 17-07-2012 / 18:55:01 / cg"
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
!DiffCodeView2::DiffData methodsFor:'accessing'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
changed
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    ^changed copy
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    "Modified: / 02-05-2010 / 19:31:18 / Jakub <zelenja7@fel.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    "Modified: / 16-07-2010 / 09:35:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
changed:something
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    changed := something.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
deleted
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
    ^ deleted
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
deleted:something
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
    deleted := something.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
inserted
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    ^ inserted
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
inserted:something
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
    inserted := something.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
text1
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
    ^ text1
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
text1:something
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
    text1 := something.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
text2
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
    ^ text2
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
text2:something
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
    text2 := something.
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
! !
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
!DiffCodeView2 class methodsFor:'documentation'!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
version_CVS
15723
901522438802 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15474
diff changeset
   528
    ^ '$Header$'
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
!
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
version_SVN
15723
901522438802 class: Tools::DiffCodeView2
Claus Gittinger <cg@exept.de>
parents: 15474
diff changeset
   532
    ^ '$Id$'
9978
4c863461e5a2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
! !
13808
4f97b7921d6e merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 11707
diff changeset
   534