ClassDescription.st
changeset 3596 d19a2f605da3
parent 3583 5b0111ca8692
child 3603 ba736c503cb9
equal deleted inserted replaced
3595:5fbfb33cd373 3596:d19a2f605da3
    12 
    12 
    13 Behavior subclass:#ClassDescription
    13 Behavior subclass:#ClassDescription
    14 	instanceVariableNames:'instvars'
    14 	instanceVariableNames:'instvars'
    15 	classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
    15 	classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
    16 		CatchMethodRedefinitions MethodRedefinitionSignal
    16 		CatchMethodRedefinitions MethodRedefinitionSignal
       
    17 		CatchClassRedefinitions ClassRedefinitionSignal
    17 		UpdateChangeFileQuerySignal TryLocalSourceFirst
    18 		UpdateChangeFileQuerySignal TryLocalSourceFirst
    18 		ChangeFileAccessLock NameSpaceQuerySignal PackageQuerySignal
    19 		ChangeFileAccessLock NameSpaceQuerySignal PackageQuerySignal
    19 		UsedNameSpaceQuerySignal CreateNameSpaceQuerySignal
    20 		UsedNameSpaceQuerySignal CreateNameSpaceQuerySignal
    20 		FileOutNameSpaceQuerySignal
    21 		FileOutNameSpaceQuerySignal
    21 		ChangeDefaultApplicationNotificationSignal
    22 		ChangeDefaultApplicationNotificationSignal
   131         MethodRedefinitionSignal := QuerySignal new.
   132         MethodRedefinitionSignal := QuerySignal new.
   132         MethodRedefinitionSignal nameClass:self message:#methodRedefinitionSignal.
   133         MethodRedefinitionSignal nameClass:self message:#methodRedefinitionSignal.
   133         MethodRedefinitionSignal notifierString:'attempt to redefine method from different package'.
   134         MethodRedefinitionSignal notifierString:'attempt to redefine method from different package'.
   134         MethodRedefinitionSignal defaultAnswer:#keep.
   135         MethodRedefinitionSignal defaultAnswer:#keep.
   135 
   136 
       
   137         ClassRedefinitionSignal := QuerySignal new.
       
   138         ClassRedefinitionSignal nameClass:self message:#classRedefinitionSignal.
       
   139         ClassRedefinitionSignal notifierString:'attempt to redefine class from different package'.
       
   140         ClassRedefinitionSignal defaultAnswer:#keep.
       
   141 
   136         UpdateChangeFileQuerySignal := QuerySignal new.
   142         UpdateChangeFileQuerySignal := QuerySignal new.
   137         UpdateChangeFileQuerySignal nameClass:self message:#updateChangeFileQuerySignal.
   143         UpdateChangeFileQuerySignal nameClass:self message:#updateChangeFileQuerySignal.
   138         UpdateChangeFileQuerySignal notifierString:'asking if changeFile update is wanted'.
   144         UpdateChangeFileQuerySignal notifierString:'asking if changeFile update is wanted'.
   139         UpdateChangeFileQuerySignal handlerBlock:[:ex | ex proceedWith:UpdatingChanges].
   145         UpdateChangeFileQuerySignal handlerBlock:[:ex | ex proceedWith:UpdatingChanges].
   140 
   146 
   181     "
   187     "
   182      ClassDescription initialize
   188      ClassDescription initialize
   183     "
   189     "
   184 
   190 
   185     "Created: / 2.4.1997 / 17:27:40 / stefan"
   191     "Created: / 2.4.1997 / 17:27:40 / stefan"
   186     "Modified: / 15.6.1998 / 21:38:44 / cg"
   192     "Modified: / 17.6.1998 / 10:12:31 / cg"
   187 ! !
   193 ! !
   188 
   194 
   189 !ClassDescription class methodsFor:'Signal constants'!
   195 !ClassDescription class methodsFor:'Signal constants'!
   190 
   196 
   191 changeDefaultApplicationNotificationSignal
   197 changeDefaultApplicationNotificationSignal
   199      Transcript showCR:Class changeDefaultApplicationNotificationSignal raise
   205      Transcript showCR:Class changeDefaultApplicationNotificationSignal raise
   200     "
   206     "
   201 
   207 
   202     "Modified: / 5.11.1996 / 20:08:38 / cg"
   208     "Modified: / 5.11.1996 / 20:08:38 / cg"
   203     "Created: / 15.6.1998 / 18:29:57 / cg"
   209     "Created: / 15.6.1998 / 18:29:57 / cg"
       
   210 !
       
   211 
       
   212 classRedefinitionSignal
       
   213     "return the signal raised when a class is about to be redefined
       
   214      differently from an existing class and the packages are not
       
   215      equal. This helps when filing in alien code, to prevent existing
       
   216      classes from being redefined by incompatible classes
       
   217      (classVars, classInstVars or inheritance)."
       
   218 
       
   219     ^ ClassRedefinitionSignal
       
   220 
       
   221     "Created: / 17.6.1998 / 10:13:44 / cg"
   204 !
   222 !
   205 
   223 
   206 createNameSpaceQuerySignal
   224 createNameSpaceQuerySignal
   207     "return the signal used as an upQuery if a new nameSpace should be
   225     "return the signal used as an upQuery if a new nameSpace should be
   208      silently created without user confirmation.
   226      silently created without user confirmation.
   311     "Created: 19.12.1996 / 23:57:27 / cg"
   329     "Created: 19.12.1996 / 23:57:27 / cg"
   312 ! !
   330 ! !
   313 
   331 
   314 !ClassDescription class methodsFor:'accessing - flags'!
   332 !ClassDescription class methodsFor:'accessing - flags'!
   315 
   333 
       
   334 catchClassRedefinitions
       
   335     "return the class-redefinition catching flag."
       
   336 
       
   337     ^ CatchClassRedefinitions
       
   338 
       
   339     "Created: / 17.6.1998 / 10:30:01 / cg"
       
   340 !
       
   341 
       
   342 catchClassRedefinitions:aBoolean
       
   343     "turn on/off class redefinition catching. 
       
   344      If on, redefining classes from another package will show a
       
   345      warning dialog. Useful, when filing in alien code to avoid defefinition
       
   346      of system methods.
       
   347      Return the prior value of the flag."
       
   348 
       
   349     |prev|
       
   350 
       
   351     prev := CatchClassRedefinitions.
       
   352     CatchClassRedefinitions := aBoolean.
       
   353     ^ prev
       
   354 
       
   355     "Created: / 17.6.1998 / 10:31:19 / cg"
       
   356 !
       
   357 
   316 catchMethodRedefinitions
   358 catchMethodRedefinitions
   317     "return the redefinition catching flag."
   359     "return the method-redefinition catching flag."
   318 
   360 
   319     ^ CatchMethodRedefinitions
   361     ^ CatchMethodRedefinitions
       
   362 
       
   363     "Modified: / 17.6.1998 / 10:30:10 / cg"
   320 !
   364 !
   321 
   365 
   322 catchMethodRedefinitions:aBoolean
   366 catchMethodRedefinitions:aBoolean
   323     "turn on/off redefinition catching. Return the prior value of the flag."
   367     "turn on/off method redefinition catching. 
       
   368      If on, redefining methods from another package will show a
       
   369      warning dialog. Useful, when filing in alien code to avoid defefinition
       
   370      of system methods.
       
   371      Return the prior value of the flag."
   324 
   372 
   325     |prev|
   373     |prev|
   326 
   374 
   327     prev := CatchMethodRedefinitions.
   375     prev := CatchMethodRedefinitions.
   328     CatchMethodRedefinitions := aBoolean.
   376     CatchMethodRedefinitions := aBoolean.
   329     ^ prev
   377     ^ prev
       
   378 
       
   379     "Modified: / 17.6.1998 / 10:31:02 / cg"
   330 !
   380 !
   331 
   381 
   332 lockChangesFile
   382 lockChangesFile
   333     "return true, if the change file is locked during update"
   383     "return true, if the change file is locked during update"
   334 
   384 
   660                  my classVariable
   710                  my classVariable
   661                           CatchMethodRedefinitions 
   711                           CatchMethodRedefinitions 
   662                  to false.
   712                  to false.
   663                  (also found in the Launchers 'settings-compilation' menu)
   713                  (also found in the Launchers 'settings-compilation' menu)
   664                 "
   714                 "
   665                 (MethodRedefinitionSignal
   715                 (Class methodRedefinitionSignal
   666                     raiseRequestWith:(oldMethod -> newMethod)
   716                     raiseRequestWith:(oldMethod -> newMethod)
   667                     errorString:('redefinition of systemCode: ' , self name , '>>' , newSelector) 
   717                     errorString:('redefinition of method: ' , self name , '>>' , newSelector) 
   668                 ) == #keep ifTrue:[
   718                 ) == #keep ifTrue:[
   669                     newMethod package:oldMethod package
   719                     newMethod package:oldMethod package
   670                 ].
   720                 ].
   671 
   721 
   672                 "/ if proceeded, install as usual.
   722                 "/ if proceeded, install as usual.
   698         self addChangeRecordForMethod:newMethod.
   748         self addChangeRecordForMethod:newMethod.
   699     ]
   749     ]
   700 
   750 
   701     "Modified: / 9.9.1996 / 22:39:32 / stefan"
   751     "Modified: / 9.9.1996 / 22:39:32 / stefan"
   702     "Created: / 4.6.1997 / 14:47:10 / cg"
   752     "Created: / 4.6.1997 / 14:47:10 / cg"
   703     "Modified: / 29.10.1997 / 15:48:25 / cg"
   753     "Modified: / 17.6.1998 / 10:41:34 / cg"
   704 !
   754 !
   705 
   755 
   706 basicAddSelector:newSelector withMethod:newMethod
   756 basicAddSelector:newSelector withMethod:newMethod
   707     "add the method given by 2nd argument under the selector given by
   757     "add the method given by 2nd argument under the selector given by
   708      1st argument to the methodDictionary. 
   758      1st argument to the methodDictionary. 
  2944 ! !
  2994 ! !
  2945 
  2995 
  2946 !ClassDescription class methodsFor:'documentation'!
  2996 !ClassDescription class methodsFor:'documentation'!
  2947 
  2997 
  2948 version
  2998 version
  2949     ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.69 1998-06-15 19:39:03 cg Exp $'
  2999     ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.70 1998-06-17 09:42:17 cg Exp $'
  2950 ! !
  3000 ! !
  2951 ClassDescription initialize!
  3001 ClassDescription initialize!