*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 20 Aug 1999 12:14:35 +0200
changeset 2346 a4ffb45a53ea
parent 2345 ac8a951e07e9
child 2347 1164de5147ea
*** empty log message ***
FBrowser.st
FileBrowser.st
--- a/FBrowser.st	Fri Aug 20 12:07:33 1999 +0200
+++ b/FBrowser.st	Fri Aug 20 12:14:35 1999 +0200
@@ -21,7 +21,8 @@
 		showingBigImagePreview imagePreviewView imageRenderProcess
 		dosEOLMode doAutoUpdate'
 	classVariableNames:'DirectoryHistory DirectoryHistoryWhere HistorySize DefaultIcon
-		CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix'
+		CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix
+		DefaultCommandPerMIME'
 	poolDictionaries:''
 	category:'Interface-Browsers'
 !
@@ -125,6 +126,20 @@
 
 !FileBrowser class methodsFor:'class initialization'!
 
+initializeDefaultCommands
+    DefaultCommandPerMIME := Dictionary new.
+
+    DefaultCommandPerMIME at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
+    DefaultCommandPerMIME at:'application/pdf'              put:'acroread %1'.
+
+    "
+     self initializeDefaultCommands
+    "
+
+    "Modified: / 1.8.1998 / 17:39:27 / cg"
+
+!
+
 initializeIcons
     |resources|
 
@@ -4588,81 +4603,87 @@
             ^ self
         ].
 
-        suffix := path suffix.
-        (suffix = 'C') ifTrue:[
-            cmd := 'g++ -c %1'.
-            select := 6.
-        ] ifFalse:[
-            suffix := suffix asLowercase.
-            (suffix = 'taz') ifTrue:[
-                aBox initialText:'zcat %1 | tar tvf -'.
-                select := false.
-            ].
-            (suffix = 'tar') ifTrue:[
-                cmd := 'tar tvf %1'.
-                select := 7.
-            ].
-            (suffix = 'zoo') ifTrue:[
-                cmd := 'zoo -list %1'.
-                select := 9.
-            ].
-            (suffix = 'zip') ifTrue:[
-                cmd := 'unzip -l %1'.
-                select := 8.
-            ].
-            (suffix = 'jar') ifTrue:[
-                cmd := 'unzip -l %1'.
-                select := 8.
-            ].
-            (suffix = 'z') ifTrue:[
-                (fileName asLowercase endsWith:'tar.z') ifTrue:[
-                    cmd := 'zcat %1 | tar tvf -'.
-                    select := false.
-                ] ifFalse:[
-                    cmd := 'uncompress %1'
-                ].
-            ].
-            (suffix = 'gz') ifTrue:[
-                (fileName asLowercase endsWith:'tar.gz') ifTrue:[
-                    cmd := ('gunzip < %1 | tar tvf -' ).
-                    select := false.
-                ] ifFalse:[
-                    cmd := 'gunzip %1'.
-                ].
-            ].
-            (suffix = 'tgz') ifTrue:[
-                cmd := ('gunzip < %1 | tar tvf -' ).
-                select := false.
-            ].
-            (suffix = 'html') ifTrue:[
-                cmd := 'netscape %1'
-            ].
-            (suffix = 'htm') ifTrue:[
-                cmd := 'netscape %1'
-            ].
-            (suffix = 'uue') ifTrue:[
-                cmd := 'uudecode %1'
-            ].
-            (suffix = 'pdf') ifTrue:[
-                cmd := 'acroread %1'
-            ].
-            (suffix = 'c') ifTrue:[
-                cmd := 'cc -c %1'.
-                select := 5.
-            ].
-            (suffix = 'cc') ifTrue:[
+        DefaultCommandPerMIME isNil ifTrue:[
+            self class initializeDefaultCommands
+        ].
+
+        cmd := DefaultCommandPerMIME at:mime ifAbsent:nil.
+        cmd notNil ifTrue:[
+            select := false
+        ].
+
+        cmd isNil ifTrue:[
+
+            suffix := path suffix.
+            (suffix = 'C') ifTrue:[
                 cmd := 'g++ -c %1'.
                 select := 6.
-            ].
-            (suffix = 'xbm') ifTrue:[
-                cmd := 'bitmap %1'
-            ].
-            (suffix = 'ps') ifTrue:[
-                cmd := 'ghostview %1'
-            ].
-            ((suffix = '1') or:[suffix = 'man']) ifTrue:[
-                cmd := 'nroff -man %1'.
-                select := 10.
+            ] ifFalse:[
+                suffix := suffix asLowercase.
+
+                (suffix = 'taz') ifTrue:[
+                    aBox initialText:'zcat %1 | tar tvf -'.
+                    select := false.
+                ].
+                (suffix = 'tar') ifTrue:[
+                    cmd := 'tar tvf %1'.
+                    select := 7.
+                ].
+                (suffix = 'zoo') ifTrue:[
+                    cmd := 'zoo -list %1'.
+                    select := 9.
+                ].
+                (suffix = 'zip') ifTrue:[
+                    cmd := 'unzip -l %1'.
+                    select := 8.
+                ].
+                (suffix = 'jar') ifTrue:[
+                    cmd := 'unzip -l %1'.
+                    select := 8.
+                ].
+                (suffix = 'z') ifTrue:[
+                    (fileName asLowercase endsWith:'tar.z') ifTrue:[
+                        cmd := 'zcat %1 | tar tvf -'.
+                        select := false.
+                    ] ifFalse:[
+                        cmd := 'uncompress %1'
+                    ].
+                ].
+                (suffix = 'gz') ifTrue:[
+                    (fileName asLowercase endsWith:'tar.gz') ifTrue:[
+                        cmd := ('gunzip < %1 | tar tvf -' ).
+                        select := false.
+                    ] ifFalse:[
+                        cmd := 'gunzip %1'.
+                    ].
+                ].
+                (suffix = 'html') ifTrue:[
+                    cmd := 'netscape %1'
+                ].
+                (suffix = 'htm') ifTrue:[
+                    cmd := 'netscape %1'
+                ].
+                (suffix = 'uue') ifTrue:[
+                    cmd := 'uudecode %1'
+                ].
+                (suffix = 'c') ifTrue:[
+                    cmd := 'cc -c %1'.
+                    select := 5.
+                ].
+                (suffix = 'cc') ifTrue:[
+                    cmd := 'g++ -c %1'.
+                    select := 6.
+                ].
+                (suffix = 'xbm') ifTrue:[
+                    cmd := 'bitmap %1'
+                ].
+                (suffix = 'ps') ifTrue:[
+                    cmd := 'ghostview %1'
+                ].
+                ((suffix = '1') or:[suffix = 'man']) ifTrue:[
+                    cmd := 'nroff -man %1'.
+                    select := 10.
+                ].
             ].
         ].
 
@@ -6754,5 +6775,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.340 1999-08-20 10:07:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.341 1999-08-20 10:14:35 cg Exp $'
 ! !
--- a/FileBrowser.st	Fri Aug 20 12:07:33 1999 +0200
+++ b/FileBrowser.st	Fri Aug 20 12:14:35 1999 +0200
@@ -21,7 +21,8 @@
 		showingBigImagePreview imagePreviewView imageRenderProcess
 		dosEOLMode doAutoUpdate'
 	classVariableNames:'DirectoryHistory DirectoryHistoryWhere HistorySize DefaultIcon
-		CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix'
+		CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix
+		DefaultCommandPerMIME'
 	poolDictionaries:''
 	category:'Interface-Browsers'
 !
@@ -125,6 +126,20 @@
 
 !FileBrowser class methodsFor:'class initialization'!
 
+initializeDefaultCommands
+    DefaultCommandPerMIME := Dictionary new.
+
+    DefaultCommandPerMIME at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
+    DefaultCommandPerMIME at:'application/pdf'              put:'acroread %1'.
+
+    "
+     self initializeDefaultCommands
+    "
+
+    "Modified: / 1.8.1998 / 17:39:27 / cg"
+
+!
+
 initializeIcons
     |resources|
 
@@ -4588,81 +4603,87 @@
             ^ self
         ].
 
-        suffix := path suffix.
-        (suffix = 'C') ifTrue:[
-            cmd := 'g++ -c %1'.
-            select := 6.
-        ] ifFalse:[
-            suffix := suffix asLowercase.
-            (suffix = 'taz') ifTrue:[
-                aBox initialText:'zcat %1 | tar tvf -'.
-                select := false.
-            ].
-            (suffix = 'tar') ifTrue:[
-                cmd := 'tar tvf %1'.
-                select := 7.
-            ].
-            (suffix = 'zoo') ifTrue:[
-                cmd := 'zoo -list %1'.
-                select := 9.
-            ].
-            (suffix = 'zip') ifTrue:[
-                cmd := 'unzip -l %1'.
-                select := 8.
-            ].
-            (suffix = 'jar') ifTrue:[
-                cmd := 'unzip -l %1'.
-                select := 8.
-            ].
-            (suffix = 'z') ifTrue:[
-                (fileName asLowercase endsWith:'tar.z') ifTrue:[
-                    cmd := 'zcat %1 | tar tvf -'.
-                    select := false.
-                ] ifFalse:[
-                    cmd := 'uncompress %1'
-                ].
-            ].
-            (suffix = 'gz') ifTrue:[
-                (fileName asLowercase endsWith:'tar.gz') ifTrue:[
-                    cmd := ('gunzip < %1 | tar tvf -' ).
-                    select := false.
-                ] ifFalse:[
-                    cmd := 'gunzip %1'.
-                ].
-            ].
-            (suffix = 'tgz') ifTrue:[
-                cmd := ('gunzip < %1 | tar tvf -' ).
-                select := false.
-            ].
-            (suffix = 'html') ifTrue:[
-                cmd := 'netscape %1'
-            ].
-            (suffix = 'htm') ifTrue:[
-                cmd := 'netscape %1'
-            ].
-            (suffix = 'uue') ifTrue:[
-                cmd := 'uudecode %1'
-            ].
-            (suffix = 'pdf') ifTrue:[
-                cmd := 'acroread %1'
-            ].
-            (suffix = 'c') ifTrue:[
-                cmd := 'cc -c %1'.
-                select := 5.
-            ].
-            (suffix = 'cc') ifTrue:[
+        DefaultCommandPerMIME isNil ifTrue:[
+            self class initializeDefaultCommands
+        ].
+
+        cmd := DefaultCommandPerMIME at:mime ifAbsent:nil.
+        cmd notNil ifTrue:[
+            select := false
+        ].
+
+        cmd isNil ifTrue:[
+
+            suffix := path suffix.
+            (suffix = 'C') ifTrue:[
                 cmd := 'g++ -c %1'.
                 select := 6.
-            ].
-            (suffix = 'xbm') ifTrue:[
-                cmd := 'bitmap %1'
-            ].
-            (suffix = 'ps') ifTrue:[
-                cmd := 'ghostview %1'
-            ].
-            ((suffix = '1') or:[suffix = 'man']) ifTrue:[
-                cmd := 'nroff -man %1'.
-                select := 10.
+            ] ifFalse:[
+                suffix := suffix asLowercase.
+
+                (suffix = 'taz') ifTrue:[
+                    aBox initialText:'zcat %1 | tar tvf -'.
+                    select := false.
+                ].
+                (suffix = 'tar') ifTrue:[
+                    cmd := 'tar tvf %1'.
+                    select := 7.
+                ].
+                (suffix = 'zoo') ifTrue:[
+                    cmd := 'zoo -list %1'.
+                    select := 9.
+                ].
+                (suffix = 'zip') ifTrue:[
+                    cmd := 'unzip -l %1'.
+                    select := 8.
+                ].
+                (suffix = 'jar') ifTrue:[
+                    cmd := 'unzip -l %1'.
+                    select := 8.
+                ].
+                (suffix = 'z') ifTrue:[
+                    (fileName asLowercase endsWith:'tar.z') ifTrue:[
+                        cmd := 'zcat %1 | tar tvf -'.
+                        select := false.
+                    ] ifFalse:[
+                        cmd := 'uncompress %1'
+                    ].
+                ].
+                (suffix = 'gz') ifTrue:[
+                    (fileName asLowercase endsWith:'tar.gz') ifTrue:[
+                        cmd := ('gunzip < %1 | tar tvf -' ).
+                        select := false.
+                    ] ifFalse:[
+                        cmd := 'gunzip %1'.
+                    ].
+                ].
+                (suffix = 'html') ifTrue:[
+                    cmd := 'netscape %1'
+                ].
+                (suffix = 'htm') ifTrue:[
+                    cmd := 'netscape %1'
+                ].
+                (suffix = 'uue') ifTrue:[
+                    cmd := 'uudecode %1'
+                ].
+                (suffix = 'c') ifTrue:[
+                    cmd := 'cc -c %1'.
+                    select := 5.
+                ].
+                (suffix = 'cc') ifTrue:[
+                    cmd := 'g++ -c %1'.
+                    select := 6.
+                ].
+                (suffix = 'xbm') ifTrue:[
+                    cmd := 'bitmap %1'
+                ].
+                (suffix = 'ps') ifTrue:[
+                    cmd := 'ghostview %1'
+                ].
+                ((suffix = '1') or:[suffix = 'man']) ifTrue:[
+                    cmd := 'nroff -man %1'.
+                    select := 10.
+                ].
             ].
         ].
 
@@ -6754,5 +6775,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.340 1999-08-20 10:07:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.341 1999-08-20 10:14:35 cg Exp $'
 ! !