More improvements fixes in diff tools
authorvrany
Tue, 19 Jul 2011 21:25:25 +0200
changeset 10344 956791655804
parent 10343 7a585f786544
child 10345 110c6de006a3
More improvements fixes in diff tools
Tools__TextDiffTool.st
--- a/Tools__TextDiffTool.st	Tue Jul 19 19:06:04 2011 +0200
+++ b/Tools__TextDiffTool.st	Tue Jul 19 21:25:25 2011 +0200
@@ -15,8 +15,8 @@
 
 ApplicationModel subclass:#TextDiffTool
 	instanceVariableNames:'labelAHolder textAHolder labelBHolder textBHolder classHolder
-		languageHolder showDiffHolder diffSpecHolder diffView
-		numChangedTexts codeView'
+		languageHolder codeAspectHolder showDiffHolder diffSpecHolder
+		diffView textAChanged textBChanged codeView'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Diff'
@@ -126,6 +126,44 @@
       )
 !
 
+nothingSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::TextDiffTool andSelector:#nothingSpec
+     Tools::TextDiffTool new openInterface:#nothingSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: nothingSpec
+        window: 
+       (WindowSpec
+          label: 'NewApplication'
+          name: 'NewApplication'
+          bounds: (Rectangle 0 0 300 300)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'Nothing selected...'
+              name: 'Label1'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+              translateLabel: true
+            )
+           )
+         
+        )
+      )
+!
+
 textViewSpec
     "This resource specification was automatically generated
      by the UIPainter of ST/X."
@@ -523,9 +561,10 @@
 
         #classHolder
         #languageHolder
+        #codeAspectHolder
       ).
 
-    "Modified: / 19-07-2011 / 13:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-07-2011 / 19:07:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TextDiffTool methodsFor:'aspects'!
@@ -548,6 +587,23 @@
     "Modified: / 19-07-2011 / 12:54:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+codeAspectHolder
+    "return/create the 'codeAspectHolder' value holder (automatically generated)"
+
+    codeAspectHolder isNil ifTrue:[
+        codeAspectHolder := ValueHolder with: #expression.
+    ].
+    ^ codeAspectHolder
+
+    "Modified: / 19-07-2011 / 19:07:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeAspectHolder:something
+    "set the 'codeAspectHolder' value holder (automatically generated)"
+
+    codeAspectHolder := something.
+!
+
 diffSpecHolder
     "return/create the 'diffSpecHolder' value holder (automatically generated)"
 
@@ -750,30 +806,43 @@
 
 !TextDiffTool methodsFor:'change & update'!
 
+codeAspect
+
+    ^self codeAspectHolder value
+
+    "Created: / 19-07-2011 / 19:07:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 update:something with:aParameter from:changedObject
     "Invoked when an object that I depend upon sends a change notification."
 
 
-    (changedObject == textAHolder or:[changedObject == textBHolder]) ifTrue:[
+    changedObject == textAHolder ifTrue:[
+        textAChanged := true.
         self updateAfterAorBChanged.
         ^ self.
     ].
+    changedObject == textBHolder ifTrue:[
+        textBChanged := true.
+        self updateAfterAorBChanged.
+        ^ self.
+    ].
+
     (changedObject == showDiffHolder) ifTrue:[
         self updateViews.            
         ^self.
     ].
     super update:something with:aParameter from:changedObject
 
-    "Modified: / 19-07-2011 / 11:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-07-2011 / 19:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateAfterAorBChanged
 
-    numChangedTexts := numChangedTexts + 1.
-    numChangedTexts >= 2 ifFalse:[^self].
-    numChangedTexts := 0.
-
-    self updateViews
+    (textAChanged & textBChanged) ifTrue:[
+        textAChanged := textBChanged := false.
+        self updateViews
+    ].
 
     "Created: / 06-07-2011 / 12:12:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -802,7 +871,7 @@
         ^self
     ].
 
-    self breakPoint: #jv.
+   self showNothing.
 
     "Created: / 19-07-2011 / 11:29:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -811,14 +880,18 @@
 
 postBuildCodeView:aScrollableView
 
-    codeView := aScrollableView
+    codeView := aScrollableView.
+    codeView notNil ifTrue:[codeView languageHolder: self languageHolder].
+    codeView notNil ifTrue:[codeView classHolder: self classHolder].
 
     "Created: / 19-07-2011 / 10:17:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 postBuildDiffView:aScrollableView
 
-    diffView := aScrollableView
+    diffView := aScrollableView.
+    diffView notNil ifTrue:[diffView languageHolder: self languageHolder].
+    diffView notNil ifTrue:[diffView classHolder: self classHolder].
 
     "Created: / 30-06-2011 / 20:55:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -828,9 +901,9 @@
 initialize
 
     super initialize.
-    numChangedTexts := 0.
+    textAChanged := textBChanged := false.
 
-    "Modified: / 06-07-2011 / 12:15:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 19-07-2011 / 19:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TextDiffTool methodsFor:'private'!
@@ -848,6 +921,13 @@
     "Created: / 19-07-2011 / 10:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+showNothing
+
+    self diffSpecHolder value: #nothingSpec
+
+    "Created: / 19-07-2011 / 19:34:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 showTextOnly
 
     self diffSpecHolder value: #textViewSpec
@@ -872,7 +952,7 @@
 !TextDiffTool class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiffTool.st,v 1.2 2011-07-19 12:32:56 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiffTool.st,v 1.3 2011-07-19 19:25:25 vrany Exp $'
 !
 
 version_SVN