added addToJava/removeFromJava classPath.
authorClaus Gittinger <cg@exept.de>
Tue, 22 Sep 1998 13:22:47 +0200
changeset 1893 1d91f4092152
parent 1892 47f737ca330d
child 1894 b7b2f4b09bf0
added addToJava/removeFromJava classPath.
FBrowser.st
FileBrowser.st
--- a/FBrowser.st	Fri Sep 18 15:55:06 1998 +0200
+++ b/FBrowser.st	Tue Sep 22 13:22:47 1998 +0200
@@ -615,6 +615,24 @@
                       )
                        #(#MenuItem
                           #label: '-'
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: 'Add to Java ClassPath'
+                          #translateLabel: true
+                          #value: #fileAddToJavaClassPath
+                          #enabled: #canAddToClassPath
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: 'Remove from Java ClassPath'
+                          #translateLabel: true
+                          #value: #fileRemoveFromJavaClassPath
+                          #enabled: #canRemoveToClassPath
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: '-'
                       )
                        #(#MenuItem
                           #label: 'Spawn'
@@ -840,11 +858,45 @@
           nil
       )
 
-    "Modified: / 7.9.1998 / 15:13:52 / cg"
+    "Modified: / 9.11.1998 / 05:51:40 / cg"
 ! !
 
 !FileBrowser methodsFor:'aspects'!
 
+canAddToClassPath
+    ^ [ |f|
+
+        f := self getSelectedFileName.
+        f notNil ifTrue:[
+            f := currentDirectory asFilename construct:f
+        ].
+        f notNil
+        and:[(Java classPath includes:f pathName) not
+        and:[f isDirectory
+             or:[(f hasSuffix:'jar')
+             or:[(f hasSuffix:'zip')]]]]
+      ]
+
+    "Modified: / 9.11.1998 / 05:54:02 / cg"
+!
+
+canRemoveToClassPath
+    ^ [ |f|
+
+        f := self getSelectedFileName.
+        f notNil ifTrue:[
+            f := currentDirectory asFilename construct:f
+        ].
+        f notNil
+        and:[(Java classPath includes:f pathName)
+        and:[f isDirectory
+             or:[(f hasSuffix:'jar')
+             or:[(f hasSuffix:'zip')]]]]
+      ]
+
+    "Modified: / 9.11.1998 / 05:54:15 / cg"
+!
+
 currentDirectoryIsNotTop
     ^ [currentDirectory notNil and:[currentDirectory isRootDirectory not]]
 
@@ -879,6 +931,13 @@
     "Modified: / 26.8.1998 / 16:33:05 / cg"
 !
 
+javaSupportLoaded
+    ^ [ JavaClassReader notNil 
+        and:[JavaClassReader isLoaded]]
+
+    "Created: / 9.11.1998 / 05:33:17 / cg"
+!
+
 showingDetails
     ^ showingDetails
 
@@ -2760,6 +2819,40 @@
     "Modified: 14.12.1996 / 15:37:47 / cg"
 !
 
+fileAddToJavaClassPath
+    "add the current path to javas classPath
+     (only available with ST/J System"
+
+    |f|
+
+    f := self getSelectedFileName.
+    f isNil ifTrue:[
+        ^ self addDirToJavaClassPath
+    ].
+    f := currentDirectory asFilename construct:f.
+    Java addToClassPath:(f pathName)
+
+    "Created: / 9.11.1998 / 05:41:34 / cg"
+    "Modified: / 9.11.1998 / 05:56:00 / cg"
+!
+
+fileRemoveFromJavaClassPath
+    "remove the current path from javas classPath
+     (only available with ST/J System"
+
+    |f|
+
+    f := self getSelectedFileName.
+    f isNil ifTrue:[
+        ^ self removeDirToJavaClassPath
+    ].
+    f := currentDirectory asFilename construct:f.
+    Java removeFromClassPath:(f pathName)
+
+    "Created: / 9.11.1998 / 05:42:05 / cg"
+    "Modified: / 9.11.1998 / 05:56:14 / cg"
+!
+
 labelMenu
     "return the popUpMenu for the path label"
 
@@ -5269,5 +5362,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.258 1998-09-10 12:47:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.259 1998-09-22 11:22:47 cg Exp $'
 ! !
--- a/FileBrowser.st	Fri Sep 18 15:55:06 1998 +0200
+++ b/FileBrowser.st	Tue Sep 22 13:22:47 1998 +0200
@@ -615,6 +615,24 @@
                       )
                        #(#MenuItem
                           #label: '-'
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: 'Add to Java ClassPath'
+                          #translateLabel: true
+                          #value: #fileAddToJavaClassPath
+                          #enabled: #canAddToClassPath
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: 'Remove from Java ClassPath'
+                          #translateLabel: true
+                          #value: #fileRemoveFromJavaClassPath
+                          #enabled: #canRemoveToClassPath
+                          #isVisible: #javaSupportLoaded
+                      )
+                       #(#MenuItem
+                          #label: '-'
                       )
                        #(#MenuItem
                           #label: 'Spawn'
@@ -840,11 +858,45 @@
           nil
       )
 
-    "Modified: / 7.9.1998 / 15:13:52 / cg"
+    "Modified: / 9.11.1998 / 05:51:40 / cg"
 ! !
 
 !FileBrowser methodsFor:'aspects'!
 
+canAddToClassPath
+    ^ [ |f|
+
+        f := self getSelectedFileName.
+        f notNil ifTrue:[
+            f := currentDirectory asFilename construct:f
+        ].
+        f notNil
+        and:[(Java classPath includes:f pathName) not
+        and:[f isDirectory
+             or:[(f hasSuffix:'jar')
+             or:[(f hasSuffix:'zip')]]]]
+      ]
+
+    "Modified: / 9.11.1998 / 05:54:02 / cg"
+!
+
+canRemoveToClassPath
+    ^ [ |f|
+
+        f := self getSelectedFileName.
+        f notNil ifTrue:[
+            f := currentDirectory asFilename construct:f
+        ].
+        f notNil
+        and:[(Java classPath includes:f pathName)
+        and:[f isDirectory
+             or:[(f hasSuffix:'jar')
+             or:[(f hasSuffix:'zip')]]]]
+      ]
+
+    "Modified: / 9.11.1998 / 05:54:15 / cg"
+!
+
 currentDirectoryIsNotTop
     ^ [currentDirectory notNil and:[currentDirectory isRootDirectory not]]
 
@@ -879,6 +931,13 @@
     "Modified: / 26.8.1998 / 16:33:05 / cg"
 !
 
+javaSupportLoaded
+    ^ [ JavaClassReader notNil 
+        and:[JavaClassReader isLoaded]]
+
+    "Created: / 9.11.1998 / 05:33:17 / cg"
+!
+
 showingDetails
     ^ showingDetails
 
@@ -2760,6 +2819,40 @@
     "Modified: 14.12.1996 / 15:37:47 / cg"
 !
 
+fileAddToJavaClassPath
+    "add the current path to javas classPath
+     (only available with ST/J System"
+
+    |f|
+
+    f := self getSelectedFileName.
+    f isNil ifTrue:[
+        ^ self addDirToJavaClassPath
+    ].
+    f := currentDirectory asFilename construct:f.
+    Java addToClassPath:(f pathName)
+
+    "Created: / 9.11.1998 / 05:41:34 / cg"
+    "Modified: / 9.11.1998 / 05:56:00 / cg"
+!
+
+fileRemoveFromJavaClassPath
+    "remove the current path from javas classPath
+     (only available with ST/J System"
+
+    |f|
+
+    f := self getSelectedFileName.
+    f isNil ifTrue:[
+        ^ self removeDirToJavaClassPath
+    ].
+    f := currentDirectory asFilename construct:f.
+    Java removeFromClassPath:(f pathName)
+
+    "Created: / 9.11.1998 / 05:42:05 / cg"
+    "Modified: / 9.11.1998 / 05:56:14 / cg"
+!
+
 labelMenu
     "return the popUpMenu for the path label"
 
@@ -5269,5 +5362,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.258 1998-09-10 12:47:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.259 1998-09-22 11:22:47 cg Exp $'
 ! !