#REFACTORING by exept draft
authorClaus Gittinger <cg@exept.de>
Sun, 08 Sep 2019 15:37:49 +0200
changeset 3757 cc41088a39df
parent 3756 7fad458b3706
child 3758 6ef532a58380
#REFACTORING by exept class: DirectoryView changed: #fileDoubleClicked #fileSelected #readMonitoringDirectory #selectedFileFilter: (send #argumentCount instead of #numArgs)
DirectoryView.st
--- a/DirectoryView.st	Sun Sep 08 14:59:55 2019 +0200
+++ b/DirectoryView.st	Sun Sep 08 15:37:49 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997 by eXept Software AG
               All Rights Reserved
@@ -357,37 +359,35 @@
 !DirectoryView methodsFor:'callbacks'!
 
 fileDoubleClicked
-      
-    (fileDoubleClickAction notNil and: [self selectionOfFile value notNil]) 
-    ifTrue: 
-    [
-        fileDoubleClickAction numArgs = 0
-        ifTrue:
-        [
-            fileDoubleClickAction value
-        ].
-        fileDoubleClickAction numArgs = 1
-        ifTrue:
-        [                
-            fileDoubleClickAction value: (directory asFilename construct: self selectionOfFile value baseName) name
+    |numArgs selectedFile|
+
+    fileDoubleClickAction notNil ifTrue:[
+        (selectedFile := self selectionOfFile value) notNil ifTrue:[
+            numArgs := fileDoubleClickAction argumentCount.
+            numArgs == 0 ifTrue:[
+                fileDoubleClickAction value
+            ] ifFalse:[
+                numArgs = 1 ifTrue:[                
+                    fileDoubleClickAction value: (directory asFilename construct:selectedFile baseName) name
+                ]
+            ]
         ]
     ]
 !
 
 fileSelected
-      
-    (fileSelectAction notNil and: [self selectionOfFile value notNil]) 
-    ifTrue: 
-    [
-        fileSelectAction numArgs = 0
-        ifTrue:
-        [
-            fileSelectAction value
-        ].
-        fileSelectAction numArgs = 1
-        ifTrue:
-        [
-            fileSelectAction value: (directory asFilename construct: self selectionOfFile value baseName) name
+    |numArgs selectedFile|
+
+    fileSelectAction notNil ifTrue:[
+        (selectedFile := self selectionOfFile value) notNil ifTrue:[
+            numArgs := fileSelectAction argumentCount.
+            numArgs == 0 ifTrue:[
+                fileSelectAction value
+            ] ifFalse:[
+                numArgs == 1 ifTrue:[
+                    fileSelectAction value: (directory asFilename construct:selectedFile baseName) name
+                ]
+            ]
         ]
     ]
 ! !
@@ -537,7 +537,7 @@
                         "/ how stupid is that?
                         nearestFileRow := listOfFiles indexOf: (listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil).
                         "/ nearestFileRow := listOfFiles findFirst:[:fileRow | fileRow baseName > fileName baseName].
-                        nearestFileRow = 0
+                        nearestFileRow == 0
                             ifTrue: [listOfFiles add: newRow]
                             ifFalse: [listOfFiles add: newRow beforeIndex: nearestFileRow].
                         "/ r is uninitialized - therefore selection is lost
@@ -590,15 +590,14 @@
     selectedFileFilter := aString.
 
     ((listOfFileFilters includes: selectedFileFilter) not
-    and:[selectedFileFilter notEmpty])
-    ifTrue: [
+      and:[selectedFileFilter notEmpty]
+    ) ifTrue: [
         listOfFileFilters addFirst: selectedFileFilter
     ].
     ((listOfFileFilters includes: selectedFileFilter)
-    and:[fileFilterSelectAction notNil]) 
-    ifTrue: [
-        (nArgs := fileFilterSelectAction numArgs) == 0
-        ifTrue: [
+      and:[fileFilterSelectAction notNil]
+    ) ifTrue: [
+        (nArgs := fileFilterSelectAction argumentCount) == 0 ifTrue: [
             fileFilterSelectAction value
         ] ifFalse:[
             nArgs == 1 ifTrue:[