class: ProjectDefinition
added: #excludeMethodFor:inClassNamed:usingCompiler:
changed: #excludeMethods:usingCompiler:
--- 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