class: Tools::NavigatorModel
authorClaus Gittinger <cg@exept.de>
Sat, 22 Feb 2014 13:40:43 +0100
changeset 13979 c02caf1da75f
parent 13978 f4adc42d7354
child 13980 90e63c4b49d8
class: Tools::NavigatorModel changed: #commonPreBuild #environment: #initialize workaround against environment-fetching from topApp, which breaks the browser to be used as a component inside expecco MUST BE FIXED - not just hacked.
Tools_NavigatorModel.st
--- a/Tools_NavigatorModel.st	Fri Feb 21 22:51:51 2014 +0100
+++ b/Tools_NavigatorModel.st	Sat Feb 22 13:40:43 2014 +0100
@@ -371,19 +371,29 @@
 !
 
 environment:env
+    self assert:env notNil.
     environment := env.
 ! !
 
 !NavigatorModel methodsFor:'hooks'!
 
 commonPreBuild
-    | topApp |
+    | topApp envFromTopApp |
 
     super commonPreBuild.
     topApp := self topApplication.
     (topApp notNil and:[topApp ~~ self]) ifTrue:[
         "Fetch the environment from the top application, fallback to previous environment"
-        self environment: (topApp perform:#environment ifNotUnderstood:[environment])
+        "/ HACK alert: it is very bad if a component fetches info from its container itself,
+        "/ instead of being passed down explicitely.And especially bad, if it is done in the way below
+        "/ noone would ever know, that environment is now part of a contract with the component.
+        "/ THIS needs change!!
+
+        envFromTopApp := topApp perform:#environment ifNotUnderstood:[environment].
+        "/ fails if the topApp does sth. different with environmen!!!!!!!!
+        (envFromTopApp isNameSpace or:[envFromTopApp == Smalltalk]) ifTrue:[
+            self environment: envFromTopApp
+        ]
     ]
 
     "Created: / 03-09-2013 / 16:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -394,8 +404,8 @@
 
 initialize
 
+    environment := environment ? Smalltalk.
     super initialize.
-    environment := Smalltalk.
 
     "Created: / 03-09-2013 / 15:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -425,11 +435,11 @@
 !NavigatorModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.27 2014-02-21 15:21:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.28 2014-02-22 12:40:43 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.27 2014-02-21 15:21:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.28 2014-02-22 12:40:43 cg Exp $'
 !
 
 version_HG
@@ -438,7 +448,7 @@
 !
 
 version_SVN
-    ^ '$Id: Tools_NavigatorModel.st,v 1.27 2014-02-21 15:21:04 cg Exp $'
+    ^ '$Id: Tools_NavigatorModel.st,v 1.28 2014-02-22 12:40:43 cg Exp $'
 ! !