ProjectV.st
changeset 272 9eeb8aa5d1d7
parent 265 3b1d5710e4a5
child 278 9d33deca396c
equal deleted inserted replaced
271:16d2d5f9c31c 272:9eeb8aa5d1d7
    29  inclusion of the above copyright notice.   This software may not
    29  inclusion of the above copyright notice.   This software may not
    30  be provided or otherwise made available to, or used by, any
    30  be provided or otherwise made available to, or used by, any
    31  other person.  No title to or ownership of the software is
    31  other person.  No title to or ownership of the software is
    32  hereby transferred.
    32  hereby transferred.
    33 "
    33 "
       
    34 !
       
    35 
       
    36 documentation
       
    37 "
       
    38     ProjectViews basically offer two functionalities:
       
    39 
       
    40       - keep a group of windows in order to organize the desktop
       
    41 	(I am not sure, if this is really a useful feature, now that we
       
    42 	 have modern windowManagers which have multiple desktops as well).
       
    43 
       
    44 	All views as created while some project was active are remembered
       
    45 	and can be hidden/shown altogether.
       
    46 	(this has nothing to do with windowGroups)
       
    47 
       
    48 	Also, it is possible to close down all those windows (by destroying the project).
       
    49 
       
    50       - keep defaults for various system activities:
       
    51 		- the fileOut directory (i.e. where the SystemBrowser creates fileOut sources)
       
    52 
       
    53 		- keep the source module/package
       
    54 		    thats the default offered when classes are checkedIn the very first time
       
    55 
       
    56 		- keep a default package-identifier assigned when classes/methods are created/modified.
       
    57 		    thats mostly useful to browse all classes/methods that have been touched
       
    58 		    in a projects context
       
    59 
       
    60 		- keep a per-project changeList
       
    61 "
    34 ! !
    62 ! !
    35 
    63 
    36 !ProjectView class methodsFor:'instance creation'!
    64 !ProjectView class methodsFor:'instance creation'!
    37 
    65 
    38 for:aProject
    66 for:aProject
    76 
   104 
    77 initializeMenu
   105 initializeMenu
    78     |labels selectors|
   106     |labels selectors|
    79 
   107 
    80     SourceCodeManager isNil ifTrue:[
   108     SourceCodeManager isNil ifTrue:[
    81         labels := #(
   109 	labels := #(
    82                         'rename ...'
   110 			'rename ...'
    83                         '-'
   111 			'-'
    84                         'changes'
   112 			'changes'
    85                         'browse'
   113 			'browse'
    86                         '-'
   114 			'-'
    87                         'fileOut directory ...'
   115 			'fileOut directory ...'
    88                         'package name ...'
   116 			'package name ...'
    89                         '-'
   117 			'-'
    90                         'show'
   118 			'show'
    91                         'hide'
   119 			'hide'
    92                         '-'
   120 			'-'
    93                         'remove package classes/methods'
   121 			'remove package classes/methods'
    94                         'destroy'
   122 			'destroy'
    95                    ).
   123 		   ).
    96 
   124 
    97          selectors := #(        
   125 	 selectors := #(        
    98                         renameProject
   126 			renameProject
    99                         nil
   127 			nil
   100                         browseChanges
   128 			browseChanges
   101                         browsePackage
   129 			browsePackage
   102                         nil
   130 			nil
   103                         projectDirectory
   131 			projectDirectory
   104                         projectPackage
   132 			projectPackage
   105                         nil
   133 			nil
   106                         showProject
   134 			showProject
   107                         hideProject
   135 			hideProject
   108                         nil
   136 			nil
   109                         removePackage
   137 			removePackage
   110                         destroy
   138 			destroy
   111                     )
   139 		    )
   112     ] ifFalse:[
   140     ] ifFalse:[
   113         labels := #(
   141 	labels := #(
   114                         'rename ...'
   142 			'rename ...'
   115                         '-'
   143 			'-'
   116                         'changes'
   144 			'changes'
   117                         'browse'
   145 			'browse'
   118                         '-'
   146 			'-'
   119                         'fileOut directory ...'
   147 			'fileOut directory ...'
   120                         'repository module ...'
   148 			'repository module ...'
   121                         'repository directory ...'
   149 			'repository directory ...'
   122                         'package name ...'
   150 			'package name ...'
   123 "/                        '-'
   151 "/                        '-'
   124 "/                        'save project code'
   152 "/                        'save project code'
   125 "/                        'build'
   153 "/                        'build'
   126                         '-'
   154 			'-'
   127                         'show'
   155 			'show'
   128                         'hide'
   156 			'hide'
   129                         '-'
   157 			'-'
   130                         'remove package code'
   158 			'remove package code'
   131                         'destroy'
   159 			'destroy'
   132                    ).
   160 		   ).
   133 
   161 
   134          selectors := #(        
   162 	 selectors := #(        
   135                         renameProject
   163 			renameProject
   136                         nil
   164 			nil
   137                         browseChanges
   165 			browseChanges
   138                         browsePackage
   166 			browsePackage
   139                         nil
   167 			nil
   140                         projectDirectory
   168 			projectDirectory
   141                         projectModule
   169 			projectModule
   142                         projectRepository
   170 			projectRepository
   143                         projectPackage
   171 			projectPackage
   144 "/                        nil
   172 "/                        nil
   145 "/                        saveProjectFiles
   173 "/                        saveProjectFiles
   146 "/                        buildProject
   174 "/                        buildProject
   147                         nil
   175 			nil
   148                         showProject
   176 			showProject
   149                         hideProject
   177 			hideProject
   150                         nil
   178 			nil
   151                         removePackage
   179 			removePackage
   152                         destroy
   180 			destroy
   153                     )
   181 		    )
   154     ].
   182     ].
   155 
   183 
   156     toggle middleButtonMenu:(
   184     toggle middleButtonMenu:(
   157         PopUpMenu
   185 	PopUpMenu
   158                 labels:labels
   186 		labels:labels
   159                 selectors:selectors
   187 		selectors:selectors
   160                 receiver:self
   188 		receiver:self
   161     )
   189     )
   162 
   190 
   163     "Created: 25.11.1995 / 18:06:32 / cg"
   191     "Created: 25.11.1995 / 18:06:32 / cg"
   164     "Modified: 10.12.1995 / 00:05:41 / cg"
   192     "Modified: 10.12.1995 / 00:05:41 / cg"
   165 ! !
   193 ! !
   175 
   203 
   176 browsePackage
   204 browsePackage
   177     "launch browsers for all classes/methods which are defined in this package"
   205     "launch browsers for all classes/methods which are defined in this package"
   178 
   206 
   179     self topView withWaitCursorDo:[
   207     self topView withWaitCursorDo:[
   180         |classes packageName methods methodList|
   208 	|classes packageName methods methodList|
   181 
   209 
   182         packageName := myProject packageName.
   210 	packageName := myProject packageName.
   183         classes := myProject classes.
   211 	classes := myProject classes.
   184         (classes notNil and:[classes notEmpty]) ifTrue:[
   212 	(classes notNil and:[classes notEmpty]) ifTrue:[
   185             SystemBrowser browseClasses:classes
   213 	    SystemBrowser browseClasses:classes
   186                                   title:'classes in package ' , packageName.
   214 				  title:'classes in package ' , packageName.
   187 
   215 
   188             classes := classes asIdentitySet.
   216 	    classes := classes asIdentitySet.
   189             classes addAll:(classes collect:[:c | c class]).
   217 	    classes addAll:(classes collect:[:c | c class]).
   190         ] ifFalse:[
   218 	] ifFalse:[
   191             classes := #()
   219 	    classes := #()
   192         ].
   220 	].
   193 "/        SystemBrowser browseMethodsWhere:[:cls :mthd :sel |
   221 "/        SystemBrowser browseMethodsWhere:[:cls :mthd :sel |
   194 "/                                    mthd package = packageName
   222 "/                                    mthd package = packageName
   195 "/                                    and:[(classes includes:cls) not]
   223 "/                                    and:[(classes includes:cls) not]
   196 "/                                  ] 
   224 "/                                  ] 
   197 "/                            title:'individual methods in package ' , packageName.
   225 "/                            title:'individual methods in package ' , packageName.
   198 
   226 
   199         methods := myProject individualMethods.
   227 	methods := myProject individualMethods.
   200         methodList := methods collect:[:m | 
   228 	methodList := methods collect:[:m | 
   201                                         |who|
   229 					|who|
   202 
   230 
   203                                         who := m who.
   231 					who := m who.
   204                                         (who at:1) name , ' ' , (who at:2)
   232 					(who at:1) name , ' ' , (who at:2)
   205                                       ].
   233 				      ].
   206         methodList notEmpty ifTrue:[
   234 	methodList notEmpty ifTrue:[
   207             SystemBrowser browseMethods:methodList
   235 	    SystemBrowser browseMethods:methodList
   208                                   title:'individual methods in package ' , packageName.
   236 				  title:'individual methods in package ' , packageName.
   209         ]
   237 	]
   210     ]
   238     ]
   211 
   239 
   212     "Created: 10.12.1995 / 00:08:58 / cg"
   240     "Created: 10.12.1995 / 00:08:58 / cg"
   213 !
   241 !
   214 
   242 
   308 
   336 
   309     box := FilenameEnterBox new.
   337     box := FilenameEnterBox new.
   310     box directoriesOnly.
   338     box directoriesOnly.
   311     box title:(resources string:'Module in repository (new source containers / packages will go there):').
   339     box title:(resources string:'Module in repository (new source containers / packages will go there):').
   312     (d := myProject repositoryModule) notNil ifTrue:[
   340     (d := myProject repositoryModule) notNil ifTrue:[
   313         box initialText:d
   341 	box initialText:d
   314     ].
   342     ].
   315     box action:[:dirName |
   343     box action:[:dirName |
   316         myProject repositoryModule:dirName
   344 	myProject repositoryModule:dirName
   317     ].
   345     ].
   318     box showAtPointer
   346     box showAtPointer
   319 
   347 
   320     "Created: 25.11.1995 / 18:07:51 / cg"
   348     "Created: 25.11.1995 / 18:07:51 / cg"
   321     "Modified: 10.12.1995 / 00:01:25 / cg"
   349     "Modified: 10.12.1995 / 00:01:25 / cg"
   322 !
   350 !
   323 
   351 
   324 projectPackage
   352 projectPackage
   325     self topView withWaitCursorDo:[
   353     self topView withWaitCursorDo:[
   326         |box p existingPackages allClasses|
   354 	|box p existingPackages allClasses|
   327 
   355 
   328         existingPackages := Set new.
   356 	existingPackages := Set new.
   329         (allClasses := Smalltalk allClasses) do:[:aClass |
   357 	(allClasses := Smalltalk allClasses) do:[:aClass |
   330             |p|
   358 	    |p|
   331 
   359 
   332             (p := aClass package) notNil ifTrue:[
   360 	    (p := aClass package) notNil ifTrue:[
   333                 existingPackages add:(p asString)
   361 		existingPackages add:(p asString)
   334             ].
   362 	    ].
   335             aClass methodArray do:[:aMethod |
   363 	    aClass methodArray do:[:aMethod |
   336                 (p := aMethod package) notNil ifTrue:[
   364 		(p := aMethod package) notNil ifTrue:[
   337                     existingPackages add:(p asString)
   365 		    existingPackages add:(p asString)
   338                 ]
   366 		]
   339             ].
   367 	    ].
   340             aClass class methodArray do:[:aMethod |
   368 	    aClass class methodArray do:[:aMethod |
   341                 (p := aMethod package) notNil ifTrue:[
   369 		(p := aMethod package) notNil ifTrue:[
   342                     existingPackages add:(p asString)
   370 		    existingPackages add:(p asString)
   343                 ]
   371 		]
   344             ].
   372 	    ].
   345         ].
   373 	].
   346 
   374 
   347         box := ListSelectionBox title:'Package (new classes/methods will be put into that):'.
   375 	box := ListSelectionBox title:'Package (new classes/methods will be put into that):'.
   348         box list:(existingPackages asOrderedCollection sort).
   376 	box list:(existingPackages asOrderedCollection sort).
   349         (p := myProject packageName) notNil ifTrue:[
   377 	(p := myProject packageName) notNil ifTrue:[
   350             box initialText:p
   378 	    box initialText:p
   351         ].
   379 	].
   352         box action:[:packageName |
   380 	box action:[:packageName |
   353             |someClass module directory|
   381 	    |someClass module directory|
   354 
   382 
   355             "/ (try) to extract the module & repository directory from someClass which
   383 	    "/ (try) to extract the module & repository directory from someClass which
   356             "/ is already contained in that package
   384 	    "/ is already contained in that package
   357 
   385 
   358             Smalltalk allClasses 
   386 	    Smalltalk allClasses 
   359                 detect:[:cls | 
   387 		detect:[:cls | 
   360                                 |info|
   388 				|info|
   361 
   389 
   362                                 (cls package = packageName) ifTrue:[
   390 				(cls package = packageName) ifTrue:[
   363                                     (info := cls packageSourceCodeInfo) notNil ifTrue:[
   391 				    (info := cls packageSourceCodeInfo) notNil ifTrue:[
   364                                         module := info at:#module ifAbsent:nil.
   392 					module := info at:#module ifAbsent:nil.
   365                                         directory := info at:#directory ifAbsent:nil.
   393 					directory := info at:#directory ifAbsent:nil.
   366                                     ]
   394 				    ]
   367                                 ].
   395 				].
   368                                 module notNil and:[directory notNil].
   396 				module notNil and:[directory notNil].
   369                         ]
   397 			]
   370                 ifNone:nil.
   398 		ifNone:nil.
   371 
   399 
   372             module notNil ifTrue:[
   400 	    module notNil ifTrue:[
   373                 myProject repositoryModule:module
   401 		myProject repositoryModule:module
   374             ].
   402 	    ].
   375             directory notNil ifTrue:[
   403 	    directory notNil ifTrue:[
   376                 myProject repositoryDirectory:directory
   404 		myProject repositoryDirectory:directory
   377             ].
   405 	    ].
   378             myProject packageName:packageName.
   406 	    myProject packageName:packageName.
   379 
   407 
   380         ].
   408 	].
   381         box showAtPointer
   409 	box showAtPointer
   382     ]
   410     ]
   383 
   411 
   384     "Created: 9.12.1995 / 16:50:45 / cg"
   412     "Created: 9.12.1995 / 16:50:45 / cg"
   385     "Modified: 10.12.1995 / 00:10:04 / cg"
   413     "Modified: 10.12.1995 / 00:10:04 / cg"
   386 !
   414 !
   388 projectRepository
   416 projectRepository
   389     |box d|
   417     |box d|
   390 
   418 
   391     box := FilenameEnterBox new.
   419     box := FilenameEnterBox new.
   392     box directoriesOnly.
   420     box directoriesOnly.
   393     box title:(resources string:'Relative path of repository (new source containers will go there):').
   421     box title:(resources string:'Relative path of package in repository (new source containers will go there):').
   394     (d := myProject repositoryDirectory) notNil ifTrue:[
   422     (d := myProject repositoryDirectory) notNil ifTrue:[
   395         box initialText:d
   423 	box initialText:d
   396     ].
   424     ].
   397     box action:[:dirName |
   425     box action:[:dirName |
   398         myProject repositoryDirectory:dirName
   426 	myProject repositoryDirectory:dirName
   399     ].
   427     ].
   400     box showAtPointer
   428     box showAtPointer
   401 
   429 
   402     "Created: 25.11.1995 / 18:07:51 / cg"
   430     "Created: 25.11.1995 / 18:07:51 / cg"
   403     "Modified: 10.12.1995 / 00:00:33 / cg"
   431     "Modified: 11.12.1995 / 13:46:53 / cg"
   404 !
   432 !
   405 
   433 
   406 removePackage
   434 removePackage
   407     "remove all classes and individual methods from the system.
   435     "remove all classes and individual methods from the system.
   408      Currently, this cannot fully restore the state to before
   436      Currently, this cannot fully restore the state to before
   544 ! !
   572 ! !
   545 
   573 
   546 !ProjectView class methodsFor:'documentation'!
   574 !ProjectView class methodsFor:'documentation'!
   547 
   575 
   548 version
   576 version
   549 ^ '$Header: /cvs/stx/stx/libtool/Attic/ProjectV.st,v 1.23 1995-12-09 23:12:24 cg Exp $'! !
   577 ^ '$Header: /cvs/stx/stx/libtool/Attic/ProjectV.st,v 1.24 1995-12-12 12:23:08 cg Exp $'! !