# HG changeset patch # User Claus Gittinger # Date 1365077989 -7200 # Node ID d146b5bb962dc60408ec40a971438dec83463f0c # Parent e9075c4812683453ff4f91994f24a5e854882d73 class: ProjectDefinition added: #excludeMethodFor:inClassNamed:usingCompiler: changed: #excludeMethods:usingCompiler: diff -r e9075c481268 -r d146b5bb962d ProjectDefinition.st --- a/ProjectDefinition.st Thu Apr 04 13:50:52 2013 +0200 +++ b/ProjectDefinition.st Thu Apr 04 14:19:49 2013 +0200 @@ -875,6 +875,33 @@ "Created: / 30-08-2007 / 18:28:28 / cg" ! +excludeMethodFor:selector inClassNamed:className usingCompiler:compilerOrNil + "exclude (remove from extensionList) a method by name. + Because this requires compilation of my extensionMethodNames-method, a compiler can be passed in, + which has to do the job. + This is used by the systembrowser to pass in a CodeGeneratorTool with undo support. + If nil is passed in, the recurlar compiler is used (no undo support)" + + |oldSpec newSpec newCode extensionMethods idx| + + oldSpec := self extensionMethodNames. + newSpec := oldSpec copy. + extensionMethods := self extensionMethods. + + idx := (1 to:newSpec size-1 by:2) + detect:[:i | + ((newSpec at:i) = className) + and:[ (newSpec at:i+1) = selector ]] + ifNone:nil. + idx isNil ifTrue:[ ^ self ]. + + "/ attention: there are two spec-elements per method + newSpec := newSpec removeFromIndex:idx toIndex:idx+1. + + newCode := self extensionMethodNames_code_For:newSpec. + self compile:newCode categorized:'description - contents' using:compilerOrNil +! + excludeMethods:toRemove usingCompiler:compilerOrNil "exclude (remove from extensionList) a number of methods. Because this requires compilation of my extensionMethodNames-method, a compiler can be passed in, @@ -894,11 +921,15 @@ (extensionMethods includes:eachMethodToRemove) ifTrue:[ className := eachMethodToRemove mclass name. selector := eachMethodToRemove selector. - idx := (1 to:newSpec size-1 by:2) detect:[:i | - ((newSpec at:i) = className) - and:[ (newSpec at:i+1) = selector ]]. - - newSpec := newSpec removeFromIndex:idx toIndex:idx+1 + idx := (1 to:newSpec size-1 by:2) + detect:[:i | + ((newSpec at:i) = className) + and:[ (newSpec at:i+1) = selector ]] + ifNone:nil. + idx notNil ifTrue:[ + "/ attention: there are two spec-elements per method + newSpec := newSpec removeFromIndex:idx toIndex:idx+1 + ] ]. ]. @@ -7356,11 +7387,11 @@ !ProjectDefinition class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.453 2013-04-04 11:48:58 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.454 2013-04-04 12:19:49 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.453 2013-04-04 11:48:58 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProjectDefinition.st,v 1.454 2013-04-04 12:19:49 cg Exp $' ! version_SVN