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