Tools__ChangeSetDiffTool.st
branchjv
changeset 12192 15f47901fb64
parent 12179 47f98e7d6de1
child 12198 414e7b69ecda
--- a/Tools__ChangeSetDiffTool.st	Fri Mar 16 23:23:39 2012 +0000
+++ b/Tools__ChangeSetDiffTool.st	Sat Mar 17 10:21:50 2012 +0000
@@ -585,9 +585,10 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
-     MenuEditor new openOnClass:SVN::DiffBrowser andSelector:#listMenu
-     (Menu new fromLiteralArrayEncoding:(SVN::DiffBrowser listMenu)) startUp
+     MenuEditor new openOnClass:Tools::ChangeSetDiffTool andSelector:#listMenu
+     (Menu new fromLiteralArrayEncoding:(Tools::ChangeSetDiffTool listMenu)) startUp
     "
 
     <resource: #menu>
@@ -621,10 +622,33 @@
             label: '-'
           )
          (MenuItem
-            enabled: hasSelection
-            label: 'Inspect'
-            itemValue: listMenuInspect
+            label: 'Open in...'
             translateLabel: true
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  enabled: hasSelection
+                  label: 'Inspector'
+                  itemValue: listMenuInspect
+                  translateLabel: true
+                )
+               (MenuItem
+                  label: 'kdiff3'
+                  itemValue: listMenuOpenInExternal:
+                  translateLabel: true
+                  argument: 'kdiff3'
+                )
+               (MenuItem
+                  label: 'meld'
+                  itemValue: listMenuOpenInExternal:
+                  translateLabel: true
+                  argument: 'meld'
+                )
+               )
+              nil
+              nil
+            )
           )
          )
         nil
@@ -1318,6 +1342,37 @@
         [:diff|diff versionB apply]
 
     "Modified: / 09-12-2009 / 23:10:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+listMenuOpenInExternal: command
+
+    (OperatingSystem canExecuteCommand: command) ifFalse:[
+        Dialog warn: 'Sorry. ', command , ' is not installed or not in PATH'
+    ].
+
+    self selection do:[:item|
+        | base a b cmd |
+        item versionBase notNil ifTrue:[
+            base := Filename newTemporary.
+            base writingFileDo:[:s|s nextPutAll: item versionBase source].
+        ].
+        a := Filename newTemporary.
+        a writingFileDo:[:s|s nextPutAll: item versionA source].
+        b := Filename newTemporary.
+        b writingFileDo:[:s|s nextPutAll: item versionB source].
+
+        base isNil ifTrue:[
+            cmd := '%1 %2 %3' bindWith: command with: a pathName with: b pathName
+        ] ifFalse:[
+            cmd := '%1 %4 %2 %3 ' bindWith: command with: a pathName with: b pathName with: base pathName.
+        ].
+        [ OperatingSystem executeCommand: cmd.
+        a remove.
+        b remove.
+        base notNil ifTrue:[base remove]. ] fork
+    ]
+
+    "Modified: / 17-03-2012 / 08:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ChangeSetDiffTool methodsFor:'queries'!
@@ -1726,5 +1781,5 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__ChangeSetDiffTool.st 7925 2012-03-16 17:08:17Z vranyj1 $'
+    ^ '$Id: Tools__ChangeSetDiffTool.st 7938 2012-03-17 10:21:50Z vranyj1 $'
 ! !