# HG changeset patch # User Stefan Vogel # Date 1365670424 -7200 # Node ID 2e0905efe84211d77f32b3f5278daa4b15ac7a99 # Parent 1606aca78699209c0370a49b17b6bcc1560c7082 class: ProjectBrowser changed: #loadProjectCode diff -r 1606aca78699 -r 2e0905efe842 ProjectBrowser.st --- a/ProjectBrowser.st Thu Apr 04 16:16:39 2013 +0200 +++ b/ProjectBrowser.st Thu Apr 11 10:53:44 2013 +0200 @@ -4947,94 +4947,94 @@ project := self currentProject. ns := project defaultNameSpace. ns isSymbol ifTrue:[ - ns := NameSpace name:ns + ns := NameSpace name:ns ]. self withReadCursorDo:[ - filesToLoad := OrderedCollection new. - - "/ load all classes ... - project classInfo do:[:aClassInfo | - |className fileToLoad cls| - - className := aClassInfo className. - fileToLoad := aClassInfo classFileName. - cls := ns at:className asSymbol. - cls notNil ifTrue:[ - cls isBehavior ifFalse:[ - (self confirm:('Attention: a global named ' , className , ' exists, but is not a class.\\Load anyway ?') withCRs) - ifFalse:[ - fileToLoad := nil - ] - ] ifTrue:[ - cls isLoaded ifTrue:[ - fileToLoad := nil - ] - ] - ]. - fileToLoad notNil ifTrue:[ - filesToLoad add:fileToLoad - ]. - ]. - - anyPatchClassMissing := false. - anyPatches := false. - project methodInfo do:[:aMethodInfo | - |className methodName mthd cls| - - className := aMethodInfo className. - methodName := aMethodInfo methodName. - cls := Smalltalk at:className asSymbol. - (cls isNil or:[cls isBehavior not or:[cls isLoaded not]]) ifTrue:[ - self warn:('Missing class: ' , className , ' (required for patches)'). - anyPatchClassMissing := anyPatches := true. - ] ifFalse:[ - "/ already present ? - (cls compiledMethodAt:methodName asSymbol) isNil ifTrue:[ - anyPatches := true. - ] - ] - ]. - - (methodsFile := project propertyAt:#methodsFile) notNil ifTrue:[ - anyPatches ifTrue:[ - anyPatchClassMissing ifTrue:[ - self warn:('Cannot load patches & extensions, due to missing class(es)') - ] ifFalse:[ - filesToLoad add:methodsFile - ] - ] - ] ifFalse:[ - anyPatches ifTrue:[ - self warn:('No file for methods (patches & extensions) is defined in project') - ]. - ]. - - filesToLoad size == 0 ifTrue:[ - self information:'Projects code is already loaded.' - ] ifFalse:[ - "/ load as long as superclasses are missing - "/ (since the load order could be incorrect) - prevNMissingSuper := nil. - nMissingSuper := 1. - [nMissingSuper > 0 and:[nMissingSuper ~~ prevNMissingSuper]] - whileTrue:[ - nMissingSuper := 0. - Parser::UndefinedSuperclassError handle:[:ex | - nMissingSuper := nMissingSuper + 1. - ex proceed - ] do:[ - Class packageQuerySignal answer:project package asSymbol - do:[ - filesToLoad do:[:fileToLoad | - Smalltalk fileIn:(project directory asFilename construct:fileToLoad) pathName - ] - ] - ]. - prevNMissingSuper := nMissingSuper. - ]. - ]. - project isLoaded:true. - self readAspectsFromProject + filesToLoad := OrderedCollection new. + + "/ load all classes ... + project classInfo do:[:aClassInfo | + |className fileToLoad cls| + + className := aClassInfo className. + fileToLoad := aClassInfo classFileName. + cls := ns at:className asSymbol. + cls notNil ifTrue:[ + cls isBehavior ifFalse:[ + (self confirm:('Attention: a global named ' , className , ' exists, but is not a class.\\Load anyway ?') withCRs) + ifFalse:[ + fileToLoad := nil + ] + ] ifTrue:[ + cls isLoaded ifTrue:[ + fileToLoad := nil + ] + ] + ]. + fileToLoad notNil ifTrue:[ + filesToLoad add:fileToLoad + ]. + ]. + + anyPatchClassMissing := false. + anyPatches := false. + project methodInfo do:[:aMethodInfo | + |className methodName mthd cls| + + className := aMethodInfo className. + methodName := aMethodInfo methodName. + cls := Smalltalk at:className asSymbol. + (cls isNil or:[cls isBehavior not or:[cls isLoaded not]]) ifTrue:[ + self warn:('Missing class: ' , className , ' (required for patches)'). + anyPatchClassMissing := anyPatches := true. + ] ifFalse:[ + "/ already present ? + (cls compiledMethodAt:methodName asSymbol) isNil ifTrue:[ + anyPatches := true. + ] + ] + ]. + + (methodsFile := project propertyAt:#methodsFile) notNil ifTrue:[ + anyPatches ifTrue:[ + anyPatchClassMissing ifTrue:[ + self warn:('Cannot load patches & extensions, due to missing class(es)') + ] ifFalse:[ + filesToLoad add:methodsFile + ] + ] + ] ifFalse:[ + anyPatches ifTrue:[ + self warn:('No file for methods (patches & extensions) is defined in project') + ]. + ]. + + filesToLoad size == 0 ifTrue:[ + self information:'Projects code is already loaded.' + ] ifFalse:[ + "/ load as long as superclasses are missing + "/ (since the load order could be incorrect) + prevNMissingSuper := nil. + nMissingSuper := 1. + [nMissingSuper > 0 and:[nMissingSuper ~~ prevNMissingSuper]] + whileTrue:[ + nMissingSuper := 0. + UndefinedSuperclassError handle:[:ex | + nMissingSuper := nMissingSuper + 1. + ex proceed + ] do:[ + Class packageQuerySignal answer:project package asSymbol + do:[ + filesToLoad do:[:fileToLoad | + Smalltalk fileIn:(project directory asFilename construct:fileToLoad) pathName + ] + ] + ]. + prevNMissingSuper := nMissingSuper. + ]. + ]. + project isLoaded:true. + self readAspectsFromProject ] ! @@ -6455,4 +6455,5 @@ ^ '$Header$' ! ! + ProjectBrowser initialize!