Tools__NavigatorModel.st
branchjv
changeset 13530 2269bce1636d
parent 12431 9f0c59c742d5
child 15566 184cea584be5
--- a/Tools__NavigatorModel.st	Fri Sep 06 12:08:37 2013 +0100
+++ b/Tools__NavigatorModel.st	Fri Sep 06 15:49:08 2013 +0100
@@ -14,7 +14,7 @@
 "{ NameSpace: Tools }"
 
 ApplicationModel subclass:#NavigatorModel
-	instanceVariableNames:''
+	instanceVariableNames:'environment'
 	classVariableNames:'AllEntry SuperSendEntry UncommentedEntry'
 	poolDictionaries:''
 	category:'Interface-Browsers-New'
@@ -34,6 +34,31 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+!
+
+documentation
+"
+    A base abstract superclass for all tools browsing the code.
+
+    The `environment` instvar should be used to access the code elements
+    (classes, packages, namespace). The tool should never access Smalltalk
+    directly, but the `environment`. By default, the `environment` is 
+    initialized to Smalltalk. The `environment` could be whatever object
+    you like, but it MUST be polymorph with Smalltalk. Also, all classes-like
+    objects it returns MUST be polymorph with Class. Otherwise, expect
+    a lot of DNUs.
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+        environment         
+
+    [class variables:]
+
+    [see also:]
+
+"
 ! !
 
 !NavigatorModel class methodsFor:'initialization'!
@@ -329,6 +354,50 @@
     "Created: / 06-04-2010 / 11:09:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 07-09-2011 / 10:45:45 / cg"
     "Modified: / 19-01-2012 / 10:43:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isAbstract
+    ^ self == Tools::NavigatorModel
+
+    "Created: / 03-09-2013 / 15:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!NavigatorModel methodsFor:'accessing'!
+
+environment
+    ^ environment
+
+    "Created: / 03-09-2013 / 19:19:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+environment:env
+    environment := env.
+! !
+
+!NavigatorModel methodsFor:'hooks'!
+
+commonPreBuild
+    | topApp |
+
+    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])
+    ]
+
+    "Created: / 03-09-2013 / 16:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 03-09-2013 / 18:31:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!NavigatorModel methodsFor:'initialization'!
+
+initialize
+
+    super initialize.
+    environment := Smalltalk.
+
+    "Created: / 03-09-2013 / 15:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !NavigatorModel methodsFor:'misc'!
@@ -356,11 +425,11 @@
 !NavigatorModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.23 2012/11/07 13:57:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.24 2013-09-05 10:46:11 vrany Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.23 2012/11/07 13:57:05 cg Exp §'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_NavigatorModel.st,v 1.24 2013-09-05 10:46:11 vrany Exp $'
 !
 
 version_HG
@@ -369,7 +438,7 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__NavigatorModel.st 8083 2013-01-14 11:48:37Z vranyj1 $'
+    ^ '§Id: Tools__NavigatorModel.st 7802 2011-07-05 18:33:36Z vranyj1 §'
 ! !