--- a/Workspace.st Fri Nov 17 14:14:36 2006 +0100
+++ b/Workspace.st Tue Nov 28 16:18:57 2006 +0100
@@ -14,7 +14,7 @@
TextCollector subclass:#Workspace
instanceVariableNames:'doItAction codeStartPosition errorFgColor errorBgColor
commentStrings autoDefineWorkspaceVariables simulatedSelf
- autoDefineVariables compilerClass'
+ autoDefineVariables compilerClass allowValueDrop'
classVariableNames:'DefaultViewBackground DefaultErrorForegroundColor
DefaultErrorBackgroundColor DefaultWarningBackgroundColor
DefaultWarningForegroundColor WorkspaceVariables DoItHistory'
@@ -318,6 +318,15 @@
!Workspace methodsFor:'accessing'!
+allowValueDrop:aBoolean
+ "if on (the default), any smalltalk value can be dropped and leads to a workspace variable
+ holding on to that being defined. Can be turned off, if youdont like this (for standAlone apps)"
+
+ allowValueDrop := aBoolean.
+
+ "Created: / 28-11-2006 / 16:13:02 / cg"
+!
+
autoDefineVariables
^ autoDefineVariables
!
@@ -685,39 +694,23 @@
canDrop:aDropContext
"Any object can be dropped into workspace..."
+ allowValueDrop ifFalse:[
+ self isReadOnly ifTrue:[^ false].
+ ^ aDropContext dropObjects
+ contains:[:someObject| (someObject isTextObject or:[ someObject isFileObject ])].
+ ].
+
^ true
"Created: / 16-08-2005 / 22:01:13 / janfrog"
- "Modified: / 18-09-2006 / 20:58:38 / cg"
+ "Modified: / 28-11-2006 / 16:18:51 / cg"
!
doDrop:aDropContext
- "Any object can be dropped into workspace..."
-
- |textObjects|
+self halt.
+ self drop:aDropContext
- aDropContext dropObjects do:[:dropObject|
- (dropObject isTextObject or:[ dropObject isFileObject ]) ifTrue:[
- self dropObjects:(Array with:dropObject)
- "/ self paste:dropObject theObject asStringWithoutFinalCR
- ] ifFalse:[
- name := Dialog
- request:(resources
- string:'Name of new Workspace Variable (refers to the dropped %1):'
- with:dropObject theObject class name allBold
- )
- initialAnswer:'droppedObject'
- okLabel:'Add'
- title:'Enter Variable Name'.
-
- name notEmptyOrNil ifTrue:[
- Workspace addWorkspaceVariable:name.
- (Workspace workspaceVariableAt:name) value:dropObject theObject.
- ].
- ].
- ].
-
- "Created: / 13-10-2006 / 17:09:50 / cg"
+ "Modified: / 28-11-2006 / 16:14:51 / cg"
!
drop:aDropContext
@@ -1058,6 +1051,8 @@
scrollWhenUpdating := #beginOfText.
showMatchingParenthesis := true.
+ allowValueDrop := true.
+
commentStrings := #(
'"/'
('"' '"')
@@ -1066,7 +1061,7 @@
self initializeDoITAction.
self initializeDragAndDrop.
- "Modified: / 18-09-2006 / 20:59:39 / cg"
+ "Modified: / 28-11-2006 / 16:11:55 / cg"
!
initializeDoITAction
@@ -1414,5 +1409,5 @@
!Workspace class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.169 2006-11-17 13:14:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Workspace.st,v 1.170 2006-11-28 15:18:57 cg Exp $'
! !