Tools__TextDiff2Tool.st
branchjv
changeset 15724 c2b9162d087d
parent 15566 184cea584be5
parent 15721 eb434c1f91f4
child 16733 4a33c1b47bc3
equal deleted inserted replaced
15720:cbf8e19959fc 15724:c2b9162d087d
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2006 by eXept Software AG
     4  COPYRIGHT (c) 2006 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   459 !
   461 !
   460 
   462 
   461 update:something with:aParameter from:changedObject
   463 update:something with:aParameter from:changedObject
   462     "Invoked when an object that I depend upon sends a change notification."
   464     "Invoked when an object that I depend upon sends a change notification."
   463 
   465 
       
   466     |realDiffView|
       
   467 
   464     (changedObject == showDiffHolder) ifTrue:[
   468     (changedObject == showDiffHolder) ifTrue:[
   465         self updateViews.            
   469         self updateViews.            
   466         ^ self.
   470         ^ self.
   467     ].
   471     ].
   468     diffView notNil ifTrue:[
   472     diffView notNil ifTrue:[
   469         (diffView respondsTo:#leftTextView) ifTrue:[
   473         "/ otherwise, respondsTo does not work.
       
   474         realDiffView := diffView scrolledView.
       
   475         (realDiffView respondsTo:#leftTextView) ifTrue:[
   470             ((changedObject == diffView leftTextView modifiedChannel) 
   476             ((changedObject == diffView leftTextView modifiedChannel) 
   471             or:[changedObject == diffView rightTextView modifiedChannel]) ifTrue:[
   477             or:[changedObject == diffView rightTextView modifiedChannel]) ifTrue:[
   472                 self enqueueMessage:#updateDiffFromChangedText for:self arguments:#().
   478                 self enqueueMessage:#updateDiffFromChangedText for:self arguments:#().
   473                 ^ self.    
   479                 ^ self.    
   474             ]
   480             ]
   500     prevCursorCol1 := leftView cursorCol.
   506     prevCursorCol1 := leftView cursorCol.
   501     prevCursorLine2 := rightView cursorLine.
   507     prevCursorLine2 := rightView cursorLine.
   502     prevCursorCol2 := rightView cursorCol.
   508     prevCursorCol2 := rightView cursorCol.
   503 
   509 
   504         
   510         
   505     self textAHolder value:(leftView contents).
   511     self textA:(leftView contents).
   506     self textBHolder value:(rightView contents).
   512     self textB:(rightView contents).
   507     leftView modifiedChannel setValue:false.
   513     leftView modifiedChannel setValue:false.
   508     rightView modifiedChannel setValue:false.
   514     rightView modifiedChannel setValue:false.
   509 
   515 
   510     self updateViews.    
   516     self updateViews.    
   511     leftView cursorLine:prevCursorLine1 col:prevCursorCol1.
   517     leftView cursorLine:prevCursorLine1 col:prevCursorCol1.
   513 !
   519 !
   514 
   520 
   515 updateViews
   521 updateViews
   516     | a b |
   522     | a b |
   517 
   523 
   518     a := self textAHolder value.
   524     a := self textA.
   519     b := self textBHolder value.
   525     b := self textB.
   520 
   526 
   521     self showDiffHolder value ifFalse:[
   527     self showDiffHolder value ifFalse:[
   522         self showTextOnly.
   528         self showTextOnly.
   523         ^ self
   529         ^ self
   524     ].
   530     ].
   551 
   557 
   552     "Created: / 19-07-2011 / 10:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   558     "Created: / 19-07-2011 / 10:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   553 !
   559 !
   554 
   560 
   555 postBuildDiffView:aScrollableView
   561 postBuildDiffView:aScrollableView
       
   562     |textA textB|
   556 
   563 
   557     super postBuildDiffView:aScrollableView.
   564     super postBuildDiffView:aScrollableView.
       
   565 
   558     diffView notNil ifTrue:[
   566     diffView notNil ifTrue:[
   559        (self textAHolder value notNil and:[self textBHolder value notNil]) ifTrue:[
   567         textA := self textA.
       
   568         textB := self textB.
       
   569        (textA notNil and:[textB notNil]) ifTrue:[
   560             diffView scrolledView
   570             diffView scrolledView
   561                 text1: self textAHolder value
   571                 text1: textA
   562                 text2: self textBHolder value
   572                 text2: textB
   563         ].
   573         ].
   564         diffView textViews do:[:each | each modifiedChannel addDependent:self].    
   574         diffView textViews do:[:each | each modifiedChannel addDependent:self].    
   565     ].
   575     ].
   566 
   576 
   567     "Created: / 16-03-2012 / 13:30:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   577     "Created: / 16-03-2012 / 13:30:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   585     self contentSpecHolder value: #diffSpec.
   595     self contentSpecHolder value: #diffSpec.
   586     
   596     
   587     diffView isNil ifTrue:[^self].
   597     diffView isNil ifTrue:[^self].
   588     (scrolledView := diffView scrolledView) isNil ifTrue:[^self].
   598     (scrolledView := diffView scrolledView) isNil ifTrue:[^self].
   589     scrolledView
   599     scrolledView
   590         text1: self textAHolder value
   600         text1: self textA
   591         text2: self textBHolder value
   601         text2: self textB
   592 
   602 
   593     "Created: / 19-07-2011 / 10:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   603     "Created: / 19-07-2011 / 10:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   594     "Modified: / 18-11-2011 / 15:01:12 / cg"
   604     "Modified: / 18-11-2011 / 15:01:12 / cg"
   595     "Modified: / 16-03-2012 / 13:21:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   605     "Modified: / 16-03-2012 / 13:21:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   596 !
   606 !
   632 ! !
   642 ! !
   633 
   643 
   634 !TextDiff2Tool class methodsFor:'documentation'!
   644 !TextDiff2Tool class methodsFor:'documentation'!
   635 
   645 
   636 version
   646 version
   637     ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
   647     ^ '$Header$'
   638 !
   648 !
   639 
   649 
   640 version_CVS
   650 version_CVS
   641     ^ '$Id: Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
   651     ^ '$Id$'
   642 !
   652 !
   643 
   653 
   644 version_HG
   654 version_HG
   645 
   655 
   646     ^ '$Changeset: <not expanded> $'
   656     ^ '$Changeset: <not expanded> $'
   647 !
   657 !
   648 
   658 
   649 version_SVN
   659 version_SVN
   650     ^ '$Id: Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
   660     ^ '$Id$'
   651 ! !
   661 ! !
   652 
   662