packages/PackageManager.st
author james
Fri, 09 May 2003 14:24:57 +0200
changeset 1268 9dc8d1b8ce9b
parent 1244 93e70ae3c90f
child 1279 95a37d60edd8
permissions -rw-r--r--
Lots and lots of changes... I hope now that any changes to Smalltalk does not result in inconsistancy in the packages. I still need to redesign the class Package as it does too much. More of the responsibilities need to be put on PackagedClass and PackagedMethod. The PackageBrowser has got some nice package pictures!
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     1
"{ Package: 'stx:libbasic3' }"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     2
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     3
"{ NameSpace: Packages }"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     4
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     5
AbstractPackageManager subclass:#PackageManager
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
     6
	instanceVariableNames:'workingPackage defaultPackage'
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     7
	classVariableNames:''
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     8
	poolDictionaries:''
2f3a15bfac92 initial checkin
james
parents:
diff changeset
     9
	category:'Package-Managers'
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    10
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    11
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    12
PackageManager class instanceVariableNames:'currentPackage currentManager imageChanges'
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    13
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    14
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    15
 No other class instance variables are inherited by this class.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    16
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    17
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    18
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    19
!PackageManager class methodsFor:'documentation'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    20
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    21
documentation
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    22
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    23
    PackageManager smalltalkPackageManager
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    24
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    25
    [author:]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    26
         (james@miraculix)
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    27
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    28
    [instance variables:]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    29
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    30
    [class variables:]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    31
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    32
    [see also:]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    33
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    34
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    35
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    36
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    37
documentation_exceptions
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    38
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    39
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    40
    ClassDescription fileOutErrorSignal 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    41
            can occur when a class within a package is autoloaded. Handle in application
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    42
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    43
    [author:]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    44
         (james@miraculix)
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    45
    
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    46
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    47
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    48
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    49
examples
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    50
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    51
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    52
  more examples to be added:
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    53
                                                                [exBegin]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    54
    ... add code fragment for 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    55
    ... executable example here ...
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    56
                                                                [exEnd]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    57
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    58
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    59
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    60
history
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    61
    "Created: / 27.1.2003 / 13:57:50 / james"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    62
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    63
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    64
!PackageManager class methodsFor:'instance creation'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    65
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    66
initialize
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    67
    "Uninitialize Singleton"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    68
    currentManager ifNotNil:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    69
        currentManager uninitialize.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    70
        currentManager := nil.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    71
        currentPackage := nil.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    72
    ]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    73
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    74
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    75
    self initialize
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    76
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    77
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    78
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    79
newManagerOfCurrentImage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    80
    | anInstance |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    81
    anInstance := self new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    82
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    83
    self basicPackagesInImage do:[:aPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    84
        package isInstalled:true.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    85
        anInstance addPackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    86
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    87
    ^ anInstance
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    88
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    89
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    90
currentManager := self newManagerOfCurrentImage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    91
"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    92
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
    93
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    94
!PackageManager class methodsFor:'* As yet uncategorized *'!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    95
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    96
basePackageNames
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    97
    ^ #(
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    98
            #'__NoProject__'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
    99
            #'stx:clients/AddrBook'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   100
            #'stx:clients/Animation'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   101
            #'stx:clients/Clock'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   102
            #'stx:clients/Demos'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   103
            #'stx:clients/DirView'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   104
            #'stx:clients/DocTool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   105
            #'stx:clients/DrawTool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   106
            #'stx:clients/GLdemos'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   107
            #'stx:clients/GuessingGame'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   108
            #'stx:clients/LogicTool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   109
            #'stx:clients/MailTool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   110
            #'stx:clients/NewsTool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   111
            #'stx:clients/PingPong'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   112
            #'stx:clients/Tetris'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   113
            #'stx:clients/TicTacToe'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   114
            #'stx:clients/TicTacToe3D'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   115
            #'stx:clients/Tools'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   116
            #'stx:goodies'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   117
            #'stx:goodies/benchmarks'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   118
            #'stx:goodies/benchmarks/deltaBlue'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   119
            #'stx:goodies/benchmarks/dhrystones'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   120
            #'stx:goodies/benchmarks/misc'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   121
            #'stx:goodies/benchmarks/richards'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   122
            #'stx:goodies/benchmarks/self'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   123
            #'stx:goodies/communication'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   124
            #'stx:goodies/dhbNumeric'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   125
            #'stx:goodies/distributions'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   126
            #'stx:goodies/glorp'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   127
            #'stx:goodies/lisp'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   128
            #'stx:goodies/math/fibonacci'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   129
            #'stx:goodies/measurement'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   130
            #'stx:goodies/minneStore'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   131
            #'stx:goodies/obsolete'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   132
            #'stx:goodies/persistency'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   133
            #'stx:goodies/postscript'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   134
            #'stx:goodies/prolog'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   135
            #'stx:goodies/rdoit'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   136
            #'stx:goodies/refactoryBrowser'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   137
            #'stx:goodies/regex'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   138
            #'stx:goodies/remoteObjects'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   139
            #'stx:goodies/screenSavers'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   140
            #'stx:goodies/sif'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   141
            #'stx:goodies/smaCC'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   142
            #'stx:goodies/soap'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   143
            #'stx:goodies/soap/examples'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   144
            #'stx:goodies/soap/opera'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   145
            #'stx:goodies/soap/splash'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   146
            #'stx:goodies/soap/spray'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   147
            #'stx:goodies/soap/wsdl'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   148
            #'stx:goodies/soap/xe'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   149
            #'stx:goodies/soap/xmlsig'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   150
            #'stx:goodies/sound'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   151
            #'stx:goodies/stmath'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   152
            #'stx:goodies/stxInExternalWindow'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   153
            #'stx:goodies/sunit'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   154
            #'stx:goodies/swazoo'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   155
            #'stx:goodies/tgen'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   156
            #'stx:goodies/webServer'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   157
            #'stx:goodies/webServer/pwsSwiki'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   158
            #'stx:goodies/xml-indelv'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   159
            #'stx:goodies/xml-vw'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   160
            #'stx:goodies/xml-yaxo'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   161
            #'stx:libbasic'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   162
            #'stx:libbasic2'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   163
            #'stx:libbasic3'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   164
            #'stx:libboss'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   165
            #'stx:libcomp'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   166
            #'stx:libcompat'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   167
            #'stx:libhtml'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   168
            #'stx:libjava'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   169
            #'stx:libjava/examples'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   170
            #'stx:libjavascript'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   171
            #'stx:libodbc'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   172
            #'stx:libopengl'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   173
            #'stx:libsnmp'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   174
            #'stx:libtable'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   175
            #'stx:libtool'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   176
            #'stx:libtool2'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   177
            #'stx:libui'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   178
            #'stx:libview'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   179
            #'stx:libview2'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   180
            #'stx:libwidg'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   181
            #'stx:libwidg2'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   182
            #'stx:libwidg3'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   183
    )
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   184
! !
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   185
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   186
!PackageManager class methodsFor:'accessing'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   187
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   188
changes
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   189
    imageChanges ifNil:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   190
        imageChanges := OrderedCollection new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   191
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   192
    ^ imageChanges
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   193
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   194
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   195
smalltalkPackageManager
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   196
    "/ to clear the singleton for the moment
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   197
     | workingPackage packagesInImage|
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   198
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   199
    "/    self initialize.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   200
    currentManager 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   201
        ifNil:[ 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   202
            currentManager := self new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   203
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   204
            packagesInImage := self basicPackagesInImage.
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   205
            workingPackage := packagesInImage removeKey:#'__NoProject__'. 
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   206
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   207
            currentManager addPackages:(packagesInImage). 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   208
            currentManager defaultPackage:workingPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   209
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   210
    ^ currentManager
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   211
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   212
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   213
!PackageManager class methodsFor:'defaults'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   214
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   215
defaultPackages
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   216
    ^ DictionaryStack new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   217
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   218
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   219
!PackageManager class methodsFor:'factory'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   220
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   221
defaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   222
    ^ (Packages::Package named:#'__NoProject__')
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   223
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   224
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   225
packageClass
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   226
    ^ Package
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   227
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   228
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   229
!PackageManager class methodsFor:'temporary'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   230
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   231
basicPackagesInImage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   232
    "builds up dictionary of the packages in the system taking the information of the classes and
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   233
    methods so we have a complete picture but without the prerequisite information.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   234
    returns the dictionary"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   235
    | packagesInImage extentions clsPkg |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   236
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   237
    packagesInImage := Dictionary new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   238
    extentions := Dictionary new.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   239
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   240
    "collect the classes and mark where the extentions are"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   241
    Smalltalk allClasses do:[:aClass |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   242
            aClass isNameSpace ifFalse:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   243
                clsPkg := aClass package.
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   244
                ((packagesInImage at: clsPkg 
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   245
                                 ifAbsentPut:[clsPkg == #'__NoProject__' ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   246
                                    (Package named:clsPkg)
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   247
                                 ] ifFalse:[(Package named:clsPkg)
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   248
                                 ].         ])
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   249
                    addedClass:aClass).
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   250
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   251
"/                aClass hasExtensions ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   252
                    aClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   253
                        |mthdPkg|
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   254
                        mthdPkg := mthd package.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   255
                        mthdPkg ~= clsPkg ifTrue:[| methodPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   256
                            "this is found out when you add a class!!"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   257
"/                            (packagesInImage at: clsPkg) removeMethod:mthd. "does not belong to the package"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   258
                            methodPackage := 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   259
                                    (packagesInImage at: mthdPkg ifAbsentPut:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   260
                                        mthdPkg == #'__NoProject__' ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   261
                                            (Package named:mthdPkg)
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   262
                                         ] ifFalse:[(Package named:mthdPkg)
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   263
                                         ].         
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   264
                                     ]).
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   265
                             methodPackage  addedMethod:mthd
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   266
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   267
                        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   268
"/                    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   269
                ] 
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   270
            ]
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   271
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   272
"/    packagesInImage removeKey:#''.    "remove namespaces"
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   273
    packagesInImage do:[:aPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   274
        aPackage initializeInstalled.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   275
    ].
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   276
    "the following is needed in a fresh image!!"
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   277
    packagesInImage at:#'__NoProject__' ifAbsentPut:[(Package named:#'__NoProject__')].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   278
    ^ packagesInImage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   279
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   280
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   281
!PackageManager methodsFor:'accessing'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   282
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   283
allClassCategories
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   284
    | allClassCategories |  
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   285
    allClassCategories := SortedCollection new.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   286
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   287
    self packagesDo:[:aPackage |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   288
        allClassCategories addAll:aPackage classCategories
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   289
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   290
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   291
    ^ allClassCategories
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   292
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   293
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   294
allPackageCategories
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   295
    ^ (self packages collect:[:aPackage | aPackage category]) asSet.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   296
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   297
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   298
changes
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   299
    ^ self class changes
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   300
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   301
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   302
defaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   303
    "return the value of the instance variable 'defaultPackage' (automatically generated)"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   304
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   305
    ^ defaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   306
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   307
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   308
defaultPackage:something
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   309
    "set the value of the instance variable 'defaultPackage' if the current default package
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   310
    is also the working package. Change the working package "
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   311
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   312
    workingPackage == defaultPackage ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   313
        workingPackage := something.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   314
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   315
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   316
    defaultPackage := something.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   317
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   318
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   319
packageNamed:anIdentifier
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   320
    ^ self packageNamed:anIdentifier ifAbsent:[nil]
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   321
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   322
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   323
packageNamed:anIdentifier ifAbsent:aBlock
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   324
    anIdentifier ifNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   325
        ^ aBlock value
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   326
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   327
    defaultPackage name == anIdentifier ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   328
        ^ defaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   329
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   330
    ^ packages atKey:anIdentifier ifAbsent:aBlock
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   331
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   332
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   333
packagesAtCategoryName:aCategoryName 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   334
    ^ self packages select:[:aPackage |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   335
        (aPackage isInCategoryNamed:aCategoryName)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   336
    ].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   337
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   338
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   339
packagesNamed:aCollectionOfPackageNames 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   340
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   341
    ^ (aCollectionOfPackageNames collect:[:aName |
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   342
        self packageNamed:aName
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   343
    ]).
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   344
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   345
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   346
workingPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   347
    "return the value of the instance variable 'workingPackage' (automatically generated)"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   348
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   349
    ^ workingPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   350
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   351
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   352
workingPackage:aPackage
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   353
    ((aPackage == defaultPackage) or:[self includesPackage:aPackage]) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   354
        self error:'Trying to make a package that i do not know about the workingPackage!!'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   355
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   356
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   357
    workingPackage removeDependent:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   358
    workingPackage:= aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   359
    workingPackage addDependent:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   360
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   361
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   362
!PackageManager methodsFor:'adding & removing'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   363
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   364
addChange:aChange
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   365
    ^ self class changes add:aChange.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   366
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   367
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   368
addPackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   369
    "the reciever needs to be dependent on the packages just in case they change"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   370
    aPackage addDependent:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   371
    self basicAddPackage:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   372
    self changed:#addPackage: with:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   373
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   374
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   375
addPackages:aPackages
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   376
    "the reciever needs to be dependent on the packages just in case they change"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   377
    aPackages do:[:aPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   378
        self basicAddPackage:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   379
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   380
    self changed:#addPackages: with:aPackages
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   381
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   382
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   383
basicAddPackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   384
    "the reciever needs to be dependent on the packages just in case they change"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   385
    packages push:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   386
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   387
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   388
basicRemovePackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   389
    ^ packages removeKey:aPackage name
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   390
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   391
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   392
removeChange:aChange
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   393
    ^ self class changes remove:aChange.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   394
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   395
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   396
removePackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   397
    "the reciever needs to be dependent on the packages just in case they change"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   398
    aPackage removeDependent:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   399
    self basicRemovePackage:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   400
    self changed:#removePackage: with:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   401
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   402
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   403
removePackageNamed:aPackageName
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   404
    | aPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   405
    aPackage := (packages removeKey:aPackageName).
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   406
    aPackage removeDependent:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   407
    self changed:#removePackage: with:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   408
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   409
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   410
!PackageManager methodsFor:'api'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   411
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   412
addClass:aClass toPackage:newPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   413
    "A manager type of the method which should not be called from Smalltalk changes"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   414
    | oldPackageName oldPackage |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   415
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   416
    (self includesPackage:newPackage) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   417
        self error:'The package manager does not know of the package ', newPackage name.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   418
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   419
    oldPackageName := aClass package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   420
    oldPackage := self packageNamed:oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   421
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   422
    (oldPackageName == newPackage name) ifTrue:["error??"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   423
        newPackage addedClass:aClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   424
        ^ self  
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   425
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   426
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   427
    self setClass:aClass toPackage:newPackage. 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   428
    PackageError handle:[:ex |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   429
        self setClass:aClass toPackage:oldPackage. 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   430
        ex raise.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   431
    ] do:[   
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   432
        newPackage addedClass:aClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   433
        oldPackage overrideClassNamed:aClass name byPackageNamed:newPackage name.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   434
    ].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   435
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   436
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   437
addMethod:aMethod toPackage:newPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   438
    | oldPackageName oldPackage|
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   439
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   440
    (self includesPackage:newPackage) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   441
        self error:'The package manager does not know of the package ', newPackage name.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   442
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   443
"/    self moveClass:aClass toPackage:newPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   444
    oldPackageName := aMethod package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   445
    oldPackage := self packageNamed:oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   446
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   447
    (oldPackageName == newPackage name) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   448
        newPackage addedMethod:aMethod.            
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   449
        ^ self  "error??"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   450
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   451
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   452
    aMethod setPackage:newPackage name. 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   453
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   454
    newPackage addedMethod:aMethod.            
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   455
    oldPackage overrideMethod:aMethod byPackageNamed:newPackage name.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   456
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   457
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   458
installPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   459
    "installs a package that the receiver is aware of into the image if not raise an error
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   460
    for the sender to catch so it is able to handle it"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   461
    (self includesPackage:aPackage) ifFalse:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   462
        self error:'The package manager does not know of the package ', aPackage name,' so it cannot be installed!!'
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   463
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   464
    ^ (self getPackageHandlerForPackage:aPackage) installPackageIn:self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   465
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   466
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   467
loadPackageFromFile:aFilename 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   468
    "install a starter package which comes from a file. This is the
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   469
    a state where the package has not yet entered the image but it
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   470
    is a package that the receiver is aware of and has some initial
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   471
    information about. Return the installed Package"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   472
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   473
    ^ (self getPackageReaderForFile:aFilename) loadPackageIn:self .
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   474
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   475
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   476
moveClass:aClass toPackage:newOwnerPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   477
    "i have the responsibilty to set aClasses new variable (newOwnerPackage name) and
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   478
    all the methods in aClass with the same package name!!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   479
    "
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   480
    | oldOwnerPackage|
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   481
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   482
    oldOwnerPackage := self packageNamed:aClass package.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   483
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   484
    oldOwnerPackage ifNil:[
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   485
        "error handling - if a package has accidentially been removed
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   486
        and i do not know about it. Fake it and put it in the default package"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   487
       oldOwnerPackage := defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   488
       self setClass:aClass toPackage:defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   489
       (defaultPackage includesPackagedClassNamed:aClass name) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   490
           defaultPackage removedClassNamed:aClass name.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   491
       ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   492
       defaultPackage addedClass:aClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   493
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   494
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   495
    oldOwnerPackage == newOwnerPackage ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   496
        (oldOwnerPackage includesPackagedClassNamed:aClass name) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   497
            oldOwnerPackage addedClass:aClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   498
        ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   499
        ^ self.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   500
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   501
    "change the value of package to the new name... not sure if this is the correct place for this"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   502
    (oldOwnerPackage notNil
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   503
        and:[aClass package == oldOwnerPackage name]) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   504
            self setClass:aClass toPackage:newOwnerPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   505
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   506
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   507
    self moveClassNamed:aClass name fromPackage:oldOwnerPackage toPackage:newOwnerPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   508
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   509
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   510
moveClassNamed:aClassName fromPackage:fromPackage toPackage:newOwnerPackage 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   511
    "i have the responsibilty to set aClasses new variable (newOwnerPackage name) and
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   512
    all the methods in aClass with the same package name!!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   513
    "
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   514
    | oldOwnerPackage oldOwnerPackageIncludesMovingClass oldPackageMovingClass newPackagedClass |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   515
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   516
    oldOwnerPackage := fromPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   517
    oldPackageMovingClass := (oldOwnerPackage packagedClassNamed:aClassName).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   518
    oldOwnerPackageIncludesMovingClass := oldPackageMovingClass notNil.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   519
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   520
    oldOwnerPackageIncludesMovingClass ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   521
        self error:'Error ', fromPackage name, ' does not know this class!!'.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   522
        ^ self.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   523
    ].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   524
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   525
    (oldOwnerPackage == newOwnerPackage) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   526
        "Mmm interesting. There is not much to do here. oldOwnerPackage knows the class already"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   527
        ^ self
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   528
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   529
    (newPackagedClass := newOwnerPackage packagedClassNamed:aClassName) ifNotNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   530
        PackageError raiseErrorString:newOwnerPackage name,  ' already knows a class with this name. Remove this class from here first!!'.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   531
        ^ self.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   532
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   533
    oldOwnerPackage movedClassNamed:aClassName toPackage:newOwnerPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   534
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   535
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   536
moveMethod:aMethod toPackage:newOwnerPackage 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   537
    |oldOwnerPackage|
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   538
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   539
    aMethod mclass ifNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   540
        self error:'Cannot move a method without an owning class!!'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   541
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   542
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   543
    oldOwnerPackage := self packageNamed:aMethod package ifAbsent:[defaultPackage].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   544
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   545
    self setMethod:aMethod toPackage:newOwnerPackage. 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   546
    (oldOwnerPackage definesSelector:aMethod name forClassNamed:aMethod mclass name) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   547
        newOwnerPackage addedMethod:aMethod.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   548
        ^ self
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   549
    ].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   550
    oldOwnerPackage movedMethod:aMethod toPackage:newOwnerPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   551
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   552
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   553
removeClassNamed:aClass fromPackage:fromPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   554
    ^ self removeClassNamed:aClass fromPackage:fromPackage moveToDefaultPackage:true.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   555
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   556
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   557
removeClassNamed:removeClassName fromPackage:fromPackage moveToDefaultPackage:moveToDefaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   558
    "this is different from removing a class from a system. If you want to do that do
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   559
    aClass removeFromSystem and the package manager will react!!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   560
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   561
    This is an administration remove on the packages and just moves aClass to the responsibility
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   562
    of the package manager's default class and removes all responsibilites from fromPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   563
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   564
    "
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   565
    | overriddingPackage overriddingPackageName removingPackagedClass |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   566
    removingPackagedClass :=  (fromPackage packagedClassNamed:removeClassName).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   567
    (self includesPackage:fromPackage) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   568
        self error:'The package manager does not know of the package ', fromPackage name.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   569
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   570
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   571
    fromPackage == defaultPackage ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   572
        "when the packaged class is in the defaultClass it is removed from the system!!!!"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   573
        ^ removingPackagedClass removeFromSystem.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   574
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   575
    "if the fromPackage has been overridden all that needs to be done is that the
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   576
    packages that the fromPackage has overridden needs to be swapped to the package that
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   577
    the fromPackage has been overridden by. Then it can be removed from the fromPackage"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   578
    removingPackagedClass isInSmalltalk ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   579
        overriddingPackageName := (fromPackage overriddingPackageNameAtClassName:removeClassName).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   580
        overriddingPackage := self packageNamed:overriddingPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   581
        overriddingPackage ifNotNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   582
            self packagesDo:[:aPackage |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   583
                (fromPackage ~= aPackage and:[aPackage ~= defaultPackage]) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   584
                    ((aPackage overriddenClassNamesByPackage:fromPackage) includes:removeClassName) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   585
                        "to keep class in smalltalk"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   586
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   587
                        aPackage changePackageOverrideFromPackage:fromPackage toPackage:overriddingPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   588
                            forClassNamed:removeClassName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   589
                    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   590
                ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   591
            ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   592
            ^ removingPackagedClass removeFromPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   593
        ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   594
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   595
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   596
    "when we are here the fromPackage holds the currentRepresentation of the class in Smalltalk"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   597
    moveToDefaultPackage ifTrue:[ | return |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   598
        self setClass:removingPackagedClass classInSmalltalk toPackage:defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   599
        self packagesDo:[:aPackage |  
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   600
            ((aPackage overriddenClassNamesByPackage:fromPackage) includes:removeClassName) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   601
                "to keep class in smalltalk"  
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   602
                aPackage changePackageOverrideFromPackage:fromPackage toPackage:defaultPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   603
                    forClassNamed:removeClassName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   604
            ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   605
        ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   606
        return := removingPackagedClass removeFromPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   607
        removingPackagedClass package:defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   608
        defaultPackage addedPackagedClass:removingPackagedClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   609
        ^ return
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   610
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   611
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   612
    ^ removingPackagedClass removeFromSystem.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   613
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   614
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   615
removeMethod:aMethod fromPackage:aPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   616
    "add method to a package. At this point it is determined to be a loose method or not"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   617
    (self includesPackage:aPackage) ifFalse:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   618
        self error:'The package manager does not know of the package ', aPackage name.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   619
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   620
    aPackage removedMethod:aMethod
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   621
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   622
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   623
savePackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   624
    self savePackage:aPackage as:aPackage filename.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   625
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   626
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   627
savePackage:aPackage as:aFilename
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   628
    "saves a package that the receiver is aware of if not raise an error
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   629
    for the sender to catch so it is able to handle it"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   630
    (self includesPackage:aPackage) ifFalse:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   631
        self error:'This package manager is not responsible of the package ', aPackage name,' so it cannot be saved!!'
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   632
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   633
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   634
    (self getPackageHandlerForPackage:aPackage) savePackageAs:aFilename.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   635
    ^ aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   636
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   637
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   638
uninstallPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   639
    "need to include the restoration of packages aPackage has overridden!!!!!!!!"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   640
    (self includesPackage:aPackage) ifFalse:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   641
        self error:'The package manager does not know of the package ', aPackage name,' so it cannot be uninstalled!!'
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   642
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   643
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   644
    (self isBasePackage:aPackage) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   645
        self error:aPackage name asString, ' is a base package and cannot be uninstalled!!'.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   646
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   647
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   648
    aPackage uninstallFromManager:self.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   649
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   650
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   651
unloadPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   652
    "unloads the package from the receiver.Does not need to
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   653
     make any checks here as it is not installed."
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   654
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   655
    (self includesPackage:aPackage) ifFalse:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   656
        self error:'The package manager does not know of the package ', aPackage name.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   657
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   658
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   659
    (self isBasePackage:aPackage) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   660
        self error:aPackage name asString, ' is a base package and cannot be unloaded!!'.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   661
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   662
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   663
    aPackage isInstalled ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   664
        self uninstallPackage:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   665
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   666
    self removePackage:aPackage.
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   667
    self changed:#unloadPackage: with:aPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   668
    ^ aPackage.
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   669
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   670
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   671
unloadPackageNamed:aPackageName 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   672
    "unloads the package from the receiver.Does not need to
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   673
     make any checks here as it is not installed."
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   674
    | aPackage |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   675
    (self includesPackageNamed:aPackageName) ifFalse:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   676
        self error:'The package manager does not know of the package ', aPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   677
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   678
    aPackage := self packageNamed:aPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   679
    aPackage == workingPackage ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   680
        PackageNotification raiseUnloadingWorkingPackage:aPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   681
        workingPackage := defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   682
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   683
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   684
    self unloadPackage:aPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   685
! !
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   686
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   687
!PackageManager methodsFor:'basic admin'!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   688
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   689
setClass:aClass toPackage:newOwnerPackage 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   690
    "sets the variable package in both class and methods belonging to the class
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   691
     but only with the same name as the classes old package"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   692
    |oldOwnerPackageName newOwnerPackageName|
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   693
    newOwnerPackageName := newOwnerPackage name.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   694
    oldOwnerPackageName := aClass package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   695
    aClass setPackage:newOwnerPackageName. 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   696
    aClass methodDictionary copy keysAndValuesDo:[:aMethodName :aMethod |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   697
        aMethod package == oldOwnerPackageName ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   698
            aMethod setPackage:newOwnerPackageName    
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   699
        ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   700
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   701
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   702
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   703
setMethod:aMethod toPackage:newOwnerPackage 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   704
    "sets the variable package"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   705
    aMethod setPackage:newOwnerPackage name. 
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   706
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   707
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   708
!PackageManager methodsFor:'change & update'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   709
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   710
changeSetChanged:something with:aChange from:changedObject
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   711
    "find out what type of change it is and send the packages the corresponding
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   712
     message to is if they are affected. If they are they should (if they are behaving)
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   713
    send me a change notification to inform me about it(see packageChanged:with:from:)!!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   714
    "
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   715
    | classNameOfChange packageName changeClass changeMethod |
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   716
    aChange isCollection ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   717
        "happens after checking in"
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   718
        ^ self "do i need to do anything???"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   719
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   720
    (aChange isClassChange) ifFalse:[
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   721
        self error:' What is this???'.
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   722
    ].           
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   723
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   724
    (aChange isKindOf:self methodPackageChangeClass) ifTrue:[| aMethod methodOwnedClass oldPackageName |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   725
        aMethod := aChange previousVersion.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   726
        methodOwnedClass := aChange changeClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   727
        oldPackageName := aChange oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   728
        self methodPackageChange:aMethod class:methodOwnedClass oldPackageName:oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   729
        ^ self
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   730
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   731
    (aChange isKindOf:self classPackageChangeClass) ifTrue:[| classToMove oldPackageName |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   732
        classToMove := aChange changeClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   733
        oldPackageName := aChange oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   734
        self classPackageChange:classToMove oldPackageName:oldPackageName.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   735
        ^ self
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   736
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   737
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   738
    (aChange isMethodCategoryChange) ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   739
        self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   740
             "(aPackage isDependentOnMethodNamed:aChange selector forClassNamed:aChange className)" false ifTrue:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   741
                aPackage methodCategoryChange:aChange.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   742
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   743
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   744
        ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   745
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   746
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   747
    "the following is similar to the one above"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   748
    (aChange isMethodCategoryRenameChange) ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   749
        self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   750
            "(aPackage isDependentOnMethodNamed:aChange selector forClassNamed:aChange className)"  false ifTrue:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   751
                aPackage methodCategoryRenameChange:aChange.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   752
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   753
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   754
        ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   755
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   756
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   757
    (aChange isMethodRemoveChange) ifTrue:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   758
        self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   759
            (aPackage isDependentOnMethodNamed:aChange selector forClassNamed:aChange className) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   760
                aChange previousVersion ifNotNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   761
                    aPackage methodRemoveChange:aChange.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   762
                ].
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   763
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   764
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   765
        ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   766
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   767
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   768
    (aChange isMethodChange) ifTrue:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   769
        "A new created method or a modified method"
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   770
        changeMethod := aChange changeMethod.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   771
        packageName := changeMethod package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   772
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   773
        self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   774
            (Switch new)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   775
                if:[(aPackage name == packageName)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   776
                ] then:[self addMethod:changeMethod toPackage:aPackage];
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   777
                if:[(aPackage isDependentOnMethodNamed:aChange selector forClassNamed:aChange className) 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   778
                ] then:[aPackage methodChanged:aChange]; 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   779
                value.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   780
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   781
        ].                                                    
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   782
        ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   783
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   784
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   785
    aChange isClassChange ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   786
        (aChange isClassRemoveChange) ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   787
            "results in one package being overridden by Smalltalk"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   788
            classNameOfChange := aChange className.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   789
            self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   790
                (Switch new)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   791
                    if:[(aPackage isDependentOnClassNamed:classNameOfChange) 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   792
                    ] then:[aPackage classRemoveChange:aChange]; 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   793
                    value.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   794
                ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   795
            ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   796
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   797
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   798
        (aChange isClassDefinitionChange) ifTrue:[        
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   799
            "This change is not added to the working class"
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   800
            "changes to instance variables, classVariableNames, poolDictionaries, category"
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   801
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   802
            classNameOfChange := aChange className.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   803
            changeClass := aChange changeClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   804
            packageName := changeClass package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   805
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   806
            self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   807
                (Switch new)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   808
                    if:[(aPackage name == packageName)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   809
                    ] then:[(aPackage definesClassNamed:classNameOfChange) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   810
                                 aPackage removedClassNamed:classNameOfChange.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   811
                            ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   812
                            aPackage addedClass:changeClass];
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   813
                    if:[(aPackage isDependentOnClassNamed:classNameOfChange) 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   814
                    ] then:[aPackage classDefinitionChange:aChange]; 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   815
                    value.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   816
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   817
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   818
            ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   819
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   820
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   821
        (aChange isClassInstVarDefinitionChange)  ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   822
            "This change is not added to the working class"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   823
            "changes to instance variables, classVariableNames, poolDictionaries, category"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   824
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   825
            classNameOfChange := aChange className.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   826
            changeClass := aChange changeClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   827
            packageName := changeClass package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   828
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   829
            self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   830
                (Switch new)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   831
                    if:[(aPackage name == packageName)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   832
                    ] then:[aPackage addedClass:changeClass];
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   833
                    if:[(aPackage isDependentOnClassNamed:classNameOfChange) 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   834
                    ] then:[aPackage classInstVarDefinitionChange:aChange].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   835
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   836
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   837
            ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   838
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   839
        (aChange isClassRenameChange) ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   840
            "This change is not added to the working class"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   841
            classNameOfChange := aChange className.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   842
            changeClass := aChange changeClass.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   843
            packageName := changeClass package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   844
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   845
            self packagesDo:[:aPackage |
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   846
                (Switch new)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   847
                    if:[(aPackage name == packageName)
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   848
                    ] then:[aPackage addedClass:changeClass];
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   849
                    if:[(aPackage isDependentOnClassNamed:classNameOfChange) 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   850
                    ] then:[aPackage classRenameChange:aChange]; 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   851
                    value.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   852
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   853
            ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   854
            ^ self
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   855
        ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   856
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   857
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   858
        self breakPoint:''.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   859
    ].
1244
93e70ae3c90f *** empty log message ***
james
parents: 1242
diff changeset
   860
    self breakPoint:''.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   861
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   862
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   863
classPackageChange:classToOverride oldPackageName:oldPackageName
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   864
    "reacts to a class package change
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   865
    Assertion:
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   866
        aClass package ~= oldPackageName
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   867
    "
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   868
    
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   869
    self setClass:classToOverride toPackage:(self packageNamed:oldPackageName). 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   870
    self error:'Sorry, this function is no longer available other than within the packageBrowser. ', Character cr asString,
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   871
        Character cr asString, ' This action has done nothing!!'.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   872
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   873
"/    | newPackageName newOwnerPackage|
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   874
"/    newPackageName := classToOverride package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   875
"/    newOwnerPackage := self packageNamed:newPackageName ifAbsent:[self newPackageNamed:newPackageName].     
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   876
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   877
"/    "fake this... maybe this is a kludge..."
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   878
"/    self setClass:classToOverride toPackage:(self packageNamed:oldPackageName). 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   879
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   880
"/    self addClass:classToOverride toPackage:newOwnerPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   881
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   882
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   883
methodPackageChange:aMethod class:methodOwnedClass oldPackageName:oldPackageName
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   884
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   885
    self setMethod:aMethod toPackage:(self packageNamed:oldPackageName). 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   886
    self error:'Sorry, this function is no longer available other than within the packageBrowser. ', Character cr asString,
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   887
        Character cr asString, ' This action has done nothing!!'.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   888
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   889
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   890
"/    | newPackageName oldOwnerPackage newOwnerPackage|
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   891
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   892
"/    newPackageName := aMethod package.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   893
"/    oldOwnerPackage :=(self packageNamed:oldPackageName).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   894
"/    newOwnerPackage := (self packageNamed:newPackageName).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   895
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   896
"/    newOwnerPackage ifNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   897
"/        PackageError raiseErrorString:'The package ', newPackageName, ' is not known',
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   898
"/            ' to this packageManager', ' and so cannot realise this methodPackageChange'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   899
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   900
"/    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   901
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   902
"/    oldOwnerPackage ifNil:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   903
"/        PackageError raiseErrorString:'The package ', oldPackageName, ' is not known',
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   904
"/            ' to this packageManager', ' and so cannot realise this methodPackageChange'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   905
"/    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   906
"/
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   907
"/    oldOwnerPackage movedMethod:aMethod toPackage:newOwnerPackage
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   908
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   909
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   910
packageChanged:something with:aParameter from:changedObject
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   911
   "maybe send a change notification for views here???"
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   912
"/    self halt.
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   913
    self addChange:aParameter.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   914
    self changed:#packagedChanged with:changedObject
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   915
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   916
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   917
update:something with:aParameter from:changedObject
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   918
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   919
    (self includesPackage:changedObject) ifTrue:[
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   920
        self packageChanged:something with:aParameter from:changedObject.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   921
        ^ self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   922
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   923
    (changedObject == ChangeSet current) ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   924
        self changeSetChanged:something with:aParameter from:changedObject.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   925
        ^ self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   926
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   927
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   928
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   929
!PackageManager methodsFor:'checks'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   930
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   931
canLoadPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   932
    ""
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   933
    (self includesPackage:aPackage) ifTrue:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   934
        Notification raise.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   935
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   936
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   937
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   938
!PackageManager methodsFor:'enumarating'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   939
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   940
packagesDo:aOneArgBlock
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   941
    "should this or should this not include the defaultPackage??? should it
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   942
    be treated seperately?"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   943
    aOneArgBlock value:defaultPackage.  
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   944
    super packagesDo:aOneArgBlock.
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   945
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   946
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   947
packagesSelect:aOneArgBlock
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   948
    "should this or should this not include the defaultPackage??? should it
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   949
    be treated seperately?"
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   950
    | selectedPackages |
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   951
    selectedPackages := (self packages select:aOneArgBlock).
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   952
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   953
    (aOneArgBlock value:defaultPackage) ifTrue:[
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   954
        selectedPackages add:defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   955
    ].
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   956
    ^ selectedPackages
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   957
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   958
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   959
!PackageManager methodsFor:'errors'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   960
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   961
recoveryHandlerDo:aBlock forException:packageErrorClass
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   962
    "an atomic action is about to happen. This should succeed or
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   963
    fail and return to the previous state."
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   964
    
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   965
    "to do - this could be done by an extra class.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   966
    could save the state of the receiver before this action is done
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   967
    along with a 'transaction number' held in the receivers class to make
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   968
    sure we are consistant. The hard copy could then be the backup. This
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   969
    all depends on how long it takes to make the backup and how often
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   970
    we are going to do this.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   971
    "
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   972
    packageErrorClass handle:[:ex |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   973
        Transcript show:ex errorString.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   974
    ] do:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   975
        aBlock value
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   976
    ]
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   977
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   978
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   979
!PackageManager methodsFor:'factory'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   980
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   981
classPackageChangeClass
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   982
    ^ Smalltalk classNamed:#'Packages::ChangeFaker::ClassPackageChange'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   983
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   984
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   985
getPackageSaverForPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   986
    ^ StxPackageFileWriter forPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   987
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   988
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   989
methodPackageChangeClass
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   990
    ^ Smalltalk classNamed:#'Packages::ChangeFaker::MethodPackageChange'
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   991
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   992
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   993
newPackageNamed:aString 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   994
    | newPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   995
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   996
    (self includesPackageNamed:aString) ifTrue:[
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
   997
        PackageError raiseCannotAddAsPackageManagerAlreadyIncludesPackageNamed:aString
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   998
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
   999
    
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1000
    newPackage := self packageClass named:aString addToManager:self.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1001
    newPackage initializeInstalled.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1002
    ^ newPackage
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1003
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1004
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1005
packageClass
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1006
    ^ Package
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1007
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1008
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1009
!PackageManager methodsFor:'initialization'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1010
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1011
initialize
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1012
    defaultPackage := self class defaultPackage.
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1013
    workingPackage := defaultPackage.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1014
    super initialize.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1015
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1016
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1017
uninitialize
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1018
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1019
    self packagesDo:[:aPackage |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1020
        self removeDependent:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1021
    ].
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1022
    defaultPackage removeDependent:self.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1023
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1024
    packages := nil.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1025
    super uninitialize.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1026
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1027
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1028
!PackageManager methodsFor:'private-opening'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1029
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1030
getPackageHandlerForPackage:aPackage 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1031
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1032
    | aPackageHandler |
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1033
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1034
    (aPackageHandler := aPackage packageHandler) ifNil:[
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1035
        aPackageHandler := PackageHandler forPackage:aPackage.
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1036
    ].
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1037
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1038
    ^ aPackageHandler
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1039
!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1040
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1041
getPackageReaderForFile:aFilename 
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1042
    ^ StxPackageFileReader forFilename:aFilename
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1043
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1044
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1045
!PackageManager methodsFor:'queries'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1046
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1047
includesPackage:anObject 
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1048
    ^ ((packages includes:anObject)or:[defaultPackage == anObject])
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1049
!
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1050
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1051
isBasePackage:aPackage
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1052
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1053
    ^ self class basePackageNames includes:aPackage name.
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1054
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1055
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1056
!PackageManager class methodsFor:'documentation'!
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1057
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1058
version
1268
9dc8d1b8ce9b Lots and lots of changes...
james
parents: 1244
diff changeset
  1059
    ^ '$Header: /cvs/stx/stx/libbasic3/packages/PackageManager.st,v 1.4 2003-05-09 12:23:54 james Exp $'
1231
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1060
! !
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1061
2f3a15bfac92 initial checkin
james
parents:
diff changeset
  1062
PackageManager initialize!