--- a/Workspace.st Mon Oct 23 19:04:44 2017 +0200
+++ b/Workspace.st Wed Nov 01 11:27:56 2017 +0100
@@ -1396,77 +1396,90 @@
or other exception while the evaluation is performed.
(restore cursor, selectionColors etc.)"
- |selLine selCol endLine endCol cLine cCol cleanUp executeBlock|
+ |selLine selCol endLine endCol cLine cCol cleanUp executeBlock savedBackground|
code notNil ifTrue:[
- code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
-
- codeStartPosition := self characterPositionOfSelection.
-
- "
- remember selection for later - if there is an error,
- the notification method will highlight it.
- thus destroying the current selection
- "
- selLine := selectionStartLine.
- selCol := selectionStartCol.
- endLine := selectionEndLine.
- endCol := selectionEndCol.
- cCol := cursorCol.
- cLine := cursorLine.
-
- "
- cleanup: restore previous selection and cursor positions
- "
- cleanUp := [
- self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
- cLine notNil ifTrue:[
- self cursorLine:cLine col:cCol
- ].
- ].
-
- "
- perform the action.
- Be careful to release the reference to the value;
- otherwise, we could keep lots of garbage from being freed
- until the view gets closed
- "
- executeBlock := [
- [
- AbortOperationRequest handle:[:ex |
- "/ aBlock value:'** Abortsignal caught **'.
- ex return
- ] do:[
- |value|
-
- doItAction notNil ifTrue:[
- value := doItAction value:(code asString).
- cleanUp value. cleanUp := nil.
- aBlock notNil ifTrue:[
- aBlock value:value.
- ].
- value := nil.
- self class rememberDoIt:code.
- ]
- ]
- ] ensure:[
- cleanUp notNil ifTrue:[
- cleanUp value. cleanUp := nil
- ].
- ]
- ].
- aBlock isNil ifTrue:[
- "no action is performed with the result - give the user a visible
- feedback, that something has been done"
- self topView withVisibleCursor:Cursor execute do:executeBlock.
- ] ifFalse:[
- self topView withCursor:Cursor execute do:executeBlock.
- ].
+ code asString withoutSeparators isEmpty ifTrue:[ ^ self ].
+
+ codeStartPosition := self characterPositionOfSelection.
+
+ "
+ remember selection for later - if there is an error,
+ the notification method will highlight it.
+ thus destroying the current selection
+ "
+ selLine := selectionStartLine.
+ selCol := selectionStartCol.
+ endLine := selectionEndLine.
+ endCol := selectionEndCol.
+ cCol := cursorCol.
+ cLine := cursorLine.
+
+ "
+ cleanup: restore previous selection and cursor positions
+ "
+ cleanUp :=
+ [
+ self selectFromLine:selLine col:selCol toLine:endLine col:endCol.
+ cLine notNil ifTrue:[
+ self cursorLine:cLine col:cCol
+ ].
+ savedBackground notNil ifTrue:[
+ self backgroundColor:savedBackground.
+ self invalidate.
+ ].
+ ].
+
+ "
+ perform the action.
+ Be careful to release the reference to the value;
+ otherwise, we could keep lots of garbage from being freed
+ until the view gets closed
+ "
+ executeBlock :=
+ [
+ [
+ |busyColor|
+
+ (busyColor := UserPreferences current busyBackgroundColorInDoits) notNil ifTrue:[
+ savedBackground := self backgroundColor.
+ self backgroundColor:busyColor.
+ self invalidateRepairNow:true.
+ ].
+
+ AbortOperationRequest handle:[:ex |
+ "/ aBlock value:'** Abortsignal caught **'.
+ ex return
+ ] do:[
+ |value|
+
+ doItAction notNil ifTrue:[
+ value := doItAction value:(code asString).
+ cleanUp value. cleanUp := nil.
+ aBlock notNil ifTrue:[
+ aBlock value:value.
+ ].
+ value := nil.
+ self class rememberDoIt:code.
+ ]
+ ]
+ ] ensure:[
+ cleanUp notNil ifTrue:[
+ cleanUp value. cleanUp := nil
+ ].
+ ]
+ ].
+ aBlock isNil ifTrue:[
+ "no action is performed with the result - give the user a visible
+ feedback, that something has been done"
+ self topView withVisibleCursor:Cursor execute do:executeBlock.
+ ] ifFalse:[
+ self topView withCursor:Cursor execute do:executeBlock.
+ ].
]
- "Modified: / 22.4.1998 / 21:56:13 / ca"
- "Created: / 22.4.1998 / 21:57:05 / ca"
- "Modified: / 26.9.2001 / 17:32:59 / cg"
+ "Created: / 22-04-1998 / 21:57:05 / ca"
+ "Modified: / 01-11-2017 / 11:27:26 / cg"
!
executeDoIt:theCode
@@ -1476,34 +1489,33 @@
"JV@2012-03-19: Changed to reflect value of autoDefineVariables"
[
- result := ( compiler := (self compilerClass ? Compiler) new )
- currentNameSpace:namespaceForDoits;
- moreSharedPools:poolsConsideredInDoIts;
- evaluate:theCode
- in:nil
- receiver:simulatedSelf
- notifying:self
- logged:true
- ifFail:nil
- ] on: Parser undefinedVariableNotification do:[:ex|
- (ex parser == compiler and:[autoDefineVariables notNil]) ifTrue:[
- ex proceedWith: #declare
- ] ifFalse:[
- ex proceedWith: nil
- ].
- ] on: Parser askForVariableTypeOfUndeclaredQuery do:[:ex|
- autoDefineVariables == #workspace ifTrue:[
- ex proceedWith:#WorkspaceVariable
- ].
- autoDefineVariables == #doIt ifTrue:[
- ex proceedWith:#DoItTemporary
- ].
- ex pass.
+ compiler := (self compilerClass ? Compiler) new.
+ result := compiler
+ currentNameSpace:namespaceForDoits;
+ moreSharedPools:poolsConsideredInDoIts;
+ evaluate:theCode in:nil
+ receiver:simulatedSelf
+ notifying:self logged:true
+ ifFail:nil
+ ] on:(Parser undefinedVariableNotification) do:[:ex|
+ (ex parser == compiler and:[autoDefineVariables notNil]) ifTrue:[
+ ex proceedWith: #declare
+ ] ifFalse:[
+ ex proceedWith: nil
+ ].
+ ] on:(Parser askForVariableTypeOfUndeclaredQuery) do:[:ex|
+ autoDefineVariables == #workspace ifTrue:[
+ ex proceedWith:#WorkspaceVariable
+ ].
+ autoDefineVariables == #doIt ifTrue:[
+ ex proceedWith:#DoItTemporary
+ ].
+ ex pass.
].
^result
- "Modified: / 27-07-2012 / 09:33:39 / cg"
"Modified: / 24-06-2013 / 15:31:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 01-11-2017 / 11:18:31 / cg"
! !
!Workspace methodsFor:'initialization & release'!