#REFACTORING by cg
class: SimpleView
changed: #alienDrop:position:
use warn:with:
--- a/SimpleView.st Tue Jul 09 20:21:44 2019 +0200
+++ b/SimpleView.st Wed Jul 10 18:32:37 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -5865,35 +5863,35 @@
"/ how comes ? And what should be done to avoid this ?
checkForAnyNonExisting :=
- [
- anyNonExisting := false.
- aCollectionOfDropObjects do:[:eachDropObject |
- eachDropObject isFileObject ifTrue:[
- eachDropObject isDirectory ifFalse:[
- eachDropObject theObject asFilename exists ifFalse:[
- anyNonExisting := true.
- whichNonExisting := eachDropObject theObject asFilename.
- ]
- ]
- ].
- ].
- anyNonExisting
- ].
+ [
+ anyNonExisting := false.
+ aCollectionOfDropObjects do:[:eachDropObject |
+ eachDropObject isFileObject ifTrue:[
+ eachDropObject isDirectory ifFalse:[
+ eachDropObject theObject asFilename exists ifFalse:[
+ anyNonExisting := true.
+ whichNonExisting := eachDropObject theObject asFilename.
+ ]
+ ]
+ ].
+ ].
+ anyNonExisting
+ ].
self withWaitCursorDo:[
- tDelayed := 0.
- checkForAnyNonExisting doWhile:[
- anyNonExisting ifTrue:[
- Delay waitForSeconds:0.3.
- tDelayed := tDelayed + 0.3.
- ].
- anyNonExisting and:[ tDelayed <= 3].
- ].
+ tDelayed := 0.
+ checkForAnyNonExisting doWhile:[
+ anyNonExisting ifTrue:[
+ Delay waitForSeconds:0.3.
+ tDelayed := tDelayed + 0.3.
+ ].
+ anyNonExisting and:[ tDelayed <= 3].
+ ].
].
(anyNonExisting and:[checkForAnyNonExisting value]) ifTrue:[
- Dialog warn:('Dropfile not present: %1' bindWith:whichNonExisting pathName).
- ^ self
+ Dialog warn:'Dropfile not present: %1' with:whichNonExisting pathName.
+ ^ self
].
view := self.
@@ -5901,35 +5899,36 @@
app := view application.
app notNil ifTrue:[
- (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[
- app dropObjects:aCollectionOfDropObjects in:view at:positionInView.
- ^ self.
- ].
+ (app canDropObjects:aCollectionOfDropObjects in:view at:positionInView) ifTrue:[
+ app dropObjects:aCollectionOfDropObjects in:view at:positionInView.
+ ^ self.
+ ].
].
[view notNil] whileTrue:[
- "new mechanism to get a dropTarget"
- target := view dropTarget.
- target notNil ifTrue:[
- dropContext := DropContext new.
- dropContext dropObjects:aCollectionOfDropObjects.
- dropContext dropTarget:target.
-
- (target canDrop:dropContext) ifTrue:[
- target drop:dropContext.
- ^ self.
- ].
- ].
-
- (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[
- view dropObjects:aCollectionOfDropObjects at:positionInView.
- ^ self.
- ].
- view := view superView.
- positionInView := nil.
+ "new mechanism to get a dropTarget"
+ target := view dropTarget.
+ target notNil ifTrue:[
+ dropContext := DropContext new.
+ dropContext dropObjects:aCollectionOfDropObjects.
+ dropContext dropTarget:target.
+
+ (target canDrop:dropContext) ifTrue:[
+ target drop:dropContext.
+ ^ self.
+ ].
+ ].
+
+ (view canDropObjects:aCollectionOfDropObjects at:positionInView) ifTrue:[
+ view dropObjects:aCollectionOfDropObjects at:positionInView.
+ ^ self.
+ ].
+ view := view superView.
+ positionInView := nil.
]
"Modified: / 17-10-2006 / 18:00:46 / cg"
+ "Modified: / 10-07-2019 / 18:30:48 / Claus Gittinger"
!
buttonMotion:state x:x y:y