src/tools/JavaSettingsApplication.st
branchjk_new_structure
changeset 1586 45694b771d99
parent 1571 8e7dc83b87e4
child 1590 b977644c9b69
--- a/src/tools/JavaSettingsApplication.st	Thu Aug 02 20:57:54 2012 +0000
+++ b/src/tools/JavaSettingsApplication.st	Thu Aug 02 21:00:10 2012 +0000
@@ -489,6 +489,12 @@
     "Created: / 30-07-2012 / 19:39:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+javaClassPathLiteralArray
+    ^self javaClassPathHolder value asOrderedCollection literalArrayEncoding
+
+    "Created: / 02-08-2012 / 10:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 javaSourceDirectoriesEffective
     | rel |
 
@@ -500,6 +506,12 @@
     ]
 
     "Created: / 30-07-2012 / 19:39:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+javaSourcePathLiteralArray
+    ^self javaSourceDirectoriesHolder value asOrderedCollection literalArrayEncoding
+
+    "Created: / 02-08-2012 / 10:04:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSettingsApplication methodsFor:'actions'!
@@ -674,9 +686,11 @@
         currentUserPrefs javaReleaseSelector:  self javaReleaseHolder value selector.
     ] ifFalse:[
         currentUserPrefs javaReleaseSelector: nil.
-    ]
+    ].
+    currentUserPrefs javaClassPath: self javaClassPathLiteralArray.
+    currentUserPrefs javaSourcePath: self javaSourcePathLiteralArray.
 
-    "Modified: / 27-07-2012 / 10:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-08-2012 / 10:05:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 helpFilename
@@ -723,10 +737,10 @@
 
     currentPath size ~~ originalPath size ifTrue:[ ^ true ].
 
-    1 to: currentPath size do:[:i|
-        (currentPath at:i) ~= (originalPath at:i) ifTrue:[ ^ true ].
+    currentPath with: originalPath do:[:current :original|
+        current ~= original ifTrue:[ ^ true ]
     ].
-    ^true
+    ^false
 
     "Created: / 30-07-2012 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -767,6 +781,7 @@
               hasHorizontalScrollBar: true
               hasVerticalScrollBar: true
               listModel: treeList
+              useIndex: false
               highlightMode: line
               useDefaultIcons: false
               postBuildCallback: postBuildTreeView:
@@ -838,8 +853,6 @@
          
         )
       )
-
-    "Modified: / 30-07-2012 / 14:21:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSettingsApplication::PathEditor class methodsFor:'plugIn spec'!
@@ -856,12 +869,11 @@
      (if this app is embedded in a subCanvas)."
 
     ^ #(
+        #pathListEffectiveHolder
         #pathListHolder
-        #pathListEffectiveHolder
         #selectionHolder
       ).
 
-    "Modified: / 30-07-2012 / 19:30:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSettingsApplication::PathEditor methodsFor:'actions'!
@@ -893,18 +905,10 @@
 !
 
 actionMoveDown
-    <resource: #uiCallback>
-
-    "automatically generated by UIPainter..."
+    | sel |
+    sel := self selectionHolder value.
 
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be defined here..."
-
-    Transcript showCR:self class name, ': action for actionMoveDown ...'.
+    "Modified: / 02-08-2012 / 16:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 actionMoveUp
@@ -923,33 +927,13 @@
 !
 
 actionRemove
-    <resource: #uiCallback>
-
-    "automatically generated by UIPainter..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be defined here..."
-
-    Transcript showCR:self class name, ': action for actionRemove ...'.
-!
+    | sel |
+    sel := self selectionHolder value.
+    self selectionHolder value: nil.
+    sel isNil ifTrue:[ ^ self ].
+    self path remove: sel element.
 
-doAdd
-    <resource: #uiCallback>
-
-    "automatically generated by UIPainter..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be defined here..."
-
-    Transcript showCR:self class name, ': action for doAdd ...'.
+    "Modified: / 02-08-2012 / 09:58:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSettingsApplication::PathEditor methodsFor:'aspects'!
@@ -1079,6 +1063,46 @@
     "Created: / 27-07-2012 / 18:36:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!JavaSettingsApplication::PathEditor methodsFor:'aspects-queries'!
+
+canEditHolder
+
+    ^BlockValue 
+        with:[:sel|
+            sel notNil 
+                and:[sel isPathElementItem
+                    and:[sel origin == JavaPathElement originUser]].
+        ] argument: self selectionHolder
+
+    "Created: / 02-08-2012 / 16:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+canMoveDownHolder
+
+    ^BlockValue 
+        with:[:sel|
+            sel notNil 
+                and:[sel isPathElementItem
+                    and:[sel origin == JavaPathElement originUser
+                        and:[sel parent children last ~~ sel]]]
+        ] argument: self selectionHolder
+
+    "Created: / 02-08-2012 / 16:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+canMoveUpHolder
+
+    ^BlockValue 
+        with:[:sel|
+            sel notNil 
+                and:[sel isPathElementItem
+                    and:[sel origin == JavaPathElement originUser
+                        and:[sel parent children first ~~ sel]]]
+        ] argument: self selectionHolder
+
+    "Created: / 02-08-2012 / 16:13:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !JavaSettingsApplication::PathEditor methodsFor:'change & update'!
 
 update:something with:aParameter from:changedObject
@@ -1098,6 +1122,10 @@
             self treeList updateAfterInsertAt: aParameter.
             ^self.
         ].
+        something == #removeFrom: ifTrue:[
+            self treeList updateAfterRemoveFrom: aParameter first to: aParameter second.
+            ^self.
+        ].
         something == #value ifTrue:[
             self updateTree.
             ^self.
@@ -1108,7 +1136,7 @@
     ].
     super update:something with:aParameter from:changedObject
 
-    "Modified: / 30-07-2012 / 20:12:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-08-2012 / 09:55:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateModifiedChannel
@@ -1235,13 +1263,22 @@
 !JavaSettingsApplication::PathEditor::PathElementList methodsFor:'change & update'!
 
 updateAfterInsertAt: index
-    | el |
+    | el item |
 
     el := self userElements at: index.
     self assert: el origin = JavaPathElement originUser.
-    userCategory add: (self buildElement: el) beforeIndex: index.
+    userCategory add: (item := self buildElement: el) beforeIndex: index.
+    item parent expand.
+    self application selectionHolder value: item.
 
     "Created: / 30-07-2012 / 19:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateAfterRemoveFrom: start to: stop
+
+    userCategory removeFromIndex:start toIndex: stop
+
+    "Created: / 02-08-2012 / 09:56:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSettingsApplication::PathEditor::PathElementList::Category methodsFor:'accessing'!