Tools__NewClassWizardDialog.st
branchjv
changeset 17134 c4cce8b7a95d
parent 17133 f9f20407fbf9
parent 16926 a5e115fc2ba2
child 17379 028adf14bc05
equal deleted inserted replaced
17133:f9f20407fbf9 17134:c4cce8b7a95d
    19 		superclassNameHolder createRequiredMethodsHolder
    19 		superclassNameHolder createRequiredMethodsHolder
    20 		createPrintMethodHolder createAccessorsHolder
    20 		createPrintMethodHolder createAccessorsHolder
    21 		createUpdateMethodHolder createInitializerHolder
    21 		createUpdateMethodHolder createInitializerHolder
    22 		createInitialGUICodeHolder classInstVarNamesHolder
    22 		createInitialGUICodeHolder classInstVarNamesHolder
    23 		classVarNamesHolder nameSpaceHolder categoryHolder
    23 		classVarNamesHolder nameSpaceHolder categoryHolder
    24 		stereotypeHolder'
    24 		stereotypeHolder isCreatingClassHolder listOfSuperclassesHolder
       
    25 		canDisableTemplateCreationHolder'
    25 	classVariableNames:'LastLanguage LastSuperclass LastPackage LastNamespace
    26 	classVariableNames:'LastLanguage LastSuperclass LastPackage LastNamespace
    26 		LastCategory'
    27 		LastCategory'
    27 	poolDictionaries:''
    28 	poolDictionaries:''
    28 	category:'Interface-Browsers-New'
    29 	category:'Interface-Browsers-New'
    29 !
    30 !
   134 
   135 
   135 #namespaceChooser
   136 #namespaceChooser
   136 'Open a dialog for namespace selection'
   137 'Open a dialog for namespace selection'
   137 
   138 
   138 #package
   139 #package
   139 'Package into which this class should be placed.\Packages are units for deployment\(separately compiled & deployable libraries and applications)'
   140 'Packages are units for deployment\(separately compiled & deployable libraries and applications).\For class creation, choose the package into which this class should be placed.\For package creation, define the packageID of the new package.\ID must be of the form: "<module>:<path>", for example: "myname:demos/myFirstDemoProgram"'
   140 
   141 
   141 #project
   142 #project
   142 'Project-ID (aka package) into which this class should be placed'
   143 'Project-ID (aka package) into which this class should be placed'
   143 
   144 
   144 #category
   145 #category
   312              layout: (LayoutFrame 0 0 0 0 100 0 90 0)
   313              layout: (LayoutFrame 0 0 0 0 100 0 90 0)
   313              hasCharacterOrientedLabel: false
   314              hasCharacterOrientedLabel: false
   314              translateLabel: true
   315              translateLabel: true
   315            )
   316            )
   316           (LabelSpec
   317           (LabelSpec
   317              label: 'Class Creation Wizard'
   318              label: 'Class/Package Creation Wizard'
   318              name: 'Label11'
   319              name: 'Label11'
   319              layout: (LayoutFrame 100 0 10 0 390 0 50 0)
   320              layout: (LayoutFrame 100 0 10 0 390 0 50 0)
   320              translateLabel: true
   321              translateLabel: true
   321            )
   322            )
   322           (LabelSpec
   323           (LabelSpec
   323              label: 'Programming Language:'
       
   324              name: 'Label9'
       
   325              layout: (LayoutFrame 7 0 90 0 301 0 112 0)
       
   326              activeHelpKey: programmingLanguage
       
   327              translateLabel: true
       
   328              adjust: right
       
   329            )
       
   330           (ComboListSpec
       
   331              name: 'ComboList1'
       
   332              layout: (LayoutFrame 308 0 90 0 -32 1 112 0)
       
   333              activeHelpKey: programmingLanguage
       
   334              model: languageHolder
       
   335              comboList: listOfLanguages
       
   336              useIndex: true
       
   337            )
       
   338           (LabelSpec
       
   339              label: 'Stereotype:'
   324              label: 'Stereotype:'
   340              name: 'Label13'
   325              name: 'Label13'
   341              layout: (LayoutFrame 10 0 143 0 180 0 165 0)
   326              layout: (LayoutFrame 10 0 91 0 180 0 113 0)
   342              activeHelpKey: stereotype
   327              activeHelpKey: stereotype
   343              translateLabel: true
   328              translateLabel: true
   344              adjust: right
   329              adjust: right
   345            )
   330            )
   346           (ComboListSpec
   331           (ComboListSpec
   347              name: 'ComboList3'
   332              name: 'ComboList3'
   348              layout: (LayoutFrame 190 0 142 0 -32 1 164 0)
   333              layout: (LayoutFrame 190 0 91 0 -32 1 113 0)
   349              activeHelpKey: stereotype
   334              activeHelpKey: stereotype
   350              model: stereotypeHolder
   335              model: stereotypeHolder
   351              comboList: listOfStereotypes
   336              comboList: listOfStereotypes
   352              useIndex: true
   337              useIndex: true
   353            )
   338            )
   354           (LabelSpec
   339           (LabelSpec
       
   340              label: 'Programming Language:'
       
   341              name: 'Label9'
       
   342              layout: (LayoutFrame 7 0 126 0 301 0 148 0)
       
   343              activeHelpKey: programmingLanguage
       
   344              visibilityChannel: isCreatingClassHolder
       
   345              translateLabel: true
       
   346              adjust: right
       
   347            )
       
   348           (ComboListSpec
       
   349              name: 'ComboList1'
       
   350              layout: (LayoutFrame 308 0 126 0 -32 1 148 0)
       
   351              activeHelpKey: programmingLanguage
       
   352              visibilityChannel: isCreatingClassHolder
       
   353              model: languageHolder
       
   354              comboList: listOfLanguages
       
   355              useIndex: true
       
   356            )
       
   357           (LabelSpec
   355              label: 'Class Name:'
   358              label: 'Class Name:'
   356              name: 'Label1'
   359              name: 'Label1'
   357              layout: (LayoutFrame 10 0 172 0 180 0 194 0)
   360              layout: (LayoutFrame 10 0 172 0 180 0 194 0)
   358              activeHelpKey: className
   361              activeHelpKey: className
       
   362              visibilityChannel: isCreatingClassHolder
   359              translateLabel: true
   363              translateLabel: true
   360              adjust: right
   364              adjust: right
       
   365            )
       
   366           (LabelSpec
       
   367              label: '*'
       
   368              name: 'Label14'
       
   369              layout: (LayoutFrame 180 0 173 0 190 0 195 0)
       
   370              visibilityChannel: isCreatingClassHolder
       
   371              translateLabel: true
   361            )
   372            )
   362           (InputFieldSpec
   373           (InputFieldSpec
   363              name: 'EntryField1'
   374              name: 'EntryField1'
   364              layout: (LayoutFrame 190 0 172 0 -32 1 194 0)
   375              layout: (LayoutFrame 190 0 172 0 -32 1 194 0)
   365              activeHelpKey: className
   376              activeHelpKey: className
       
   377              visibilityChannel: isCreatingClassHolder
   366              model: classNameHolder
   378              model: classNameHolder
   367              acceptOnReturn: true
   379              acceptOnReturn: true
   368              acceptOnTab: true
   380              acceptOnTab: true
   369              acceptOnLostFocus: true
   381              acceptOnLostFocus: true
   370              acceptOnPointerLeave: true
   382              acceptOnPointerLeave: true
   371            )
   383            )
   372           (LabelSpec
   384           (LabelSpec
   373              label: '*'
       
   374              name: 'Label14'
       
   375              layout: (LayoutFrame 180 0 173 0 190 0 195 0)
       
   376              translateLabel: true
       
   377            )
       
   378           (LabelSpec
       
   379              label: 'Superclass:'
   385              label: 'Superclass:'
   380              name: 'Label2'
   386              name: 'Label2'
   381              layout: (LayoutFrame 10 0 202 0 180 0 224 0)
   387              layout: (LayoutFrame 10 0 202 0 180 0 224 0)
   382              activeHelpKey: superclass
   388              activeHelpKey: superclass
       
   389              visibilityChannel: isCreatingClassHolder
   383              translateLabel: true
   390              translateLabel: true
   384              adjust: right
   391              adjust: right
   385            )
   392            )
   386           (ComboBoxSpec
   393           (ComboBoxSpec
   387              name: 'ComboBox1'
   394              name: 'ComboBox1'
   388              layout: (LayoutFrame 190 0 202 0 -32 1 224 0)
   395              layout: (LayoutFrame 190 0 202 0 -32 1 224 0)
   389              activeHelpKey: superclass
   396              activeHelpKey: superclass
       
   397              visibilityChannel: isCreatingClassHolder
   390              model: superclassNameHolder
   398              model: superclassNameHolder
   391              acceptOnLostFocus: true
   399              acceptOnLostFocus: true
   392              comboList: listOfSuperclasses
   400              comboList: listOfSuperclassesHolder
   393              useIndex: false
   401              useIndex: false
   394            )
   402            )
   395           (LabelSpec
   403           (LabelSpec
   396              label: '*'
   404              label: '*'
   397              name: 'Label15'
   405              name: 'Label15'
   398              layout: (LayoutFrame 180 0 202 0 190 0 224 0)
   406              layout: (LayoutFrame 180 0 202 0 190 0 224 0)
       
   407              visibilityChannel: isCreatingClassHolder
   399              translateLabel: true
   408              translateLabel: true
   400            )
   409            )
   401           (ActionButtonSpec
   410           (ActionButtonSpec
   402              label: '...'
   411              label: '...'
   403              name: 'Button1'
   412              name: 'Button1'
   404              layout: (LayoutFrame -22 1 202 0 -2 1 224 0)
   413              layout: (LayoutFrame -22 1 202 0 -2 1 224 0)
   405              activeHelpKey: chooseSuperclass
   414              activeHelpKey: chooseSuperclass
       
   415              visibilityChannel: isCreatingClassHolder
   406              translateLabel: true
   416              translateLabel: true
   407              model: openSuperClassChooser
   417              model: openSuperClassChooser
   408            )
   418            )
   409           (LabelSpec
   419           (LabelSpec
   410              label: 'Package ID:'
   420              label: 'Package ID:'
   411              name: 'Label3'
   421              name: 'Label3'
   412              layout: (LayoutFrame 10 0 243 0 180 0 265 0)
   422              layout: (LayoutFrame 10 0 243 0 180 0 265 0)
   413              activeHelpKey: package
   423              activeHelpKey: package
   414              translateLabel: true
   424              translateLabel: true
   415              adjust: right
   425              adjust: right
       
   426            )
       
   427           (LabelSpec
       
   428              label: '*'
       
   429              name: 'Label16'
       
   430              layout: (LayoutFrame 180 0 245 0 190 0 267 0)
       
   431              visibilityChannel: isCreatingPackageHolder
       
   432              translateLabel: true
   416            )
   433            )
   417           (ComboBoxSpec
   434           (ComboBoxSpec
   418              name: 'ComboBox2'
   435              name: 'ComboBox2'
   419              layout: (LayoutFrame 190 0 242 0 -32 1 264 0)
   436              layout: (LayoutFrame 190 0 242 0 -32 1 264 0)
   420              activeHelpKey: package
   437              activeHelpKey: package
   436           (LabelSpec
   453           (LabelSpec
   437              label: 'Namespace:'
   454              label: 'Namespace:'
   438              name: 'Label4'
   455              name: 'Label4'
   439              layout: (LayoutFrame 10 0 272 0 180 0 294 0)
   456              layout: (LayoutFrame 10 0 272 0 180 0 294 0)
   440              activeHelpKey: namespace
   457              activeHelpKey: namespace
       
   458              visibilityChannel: isCreatingClassHolder
   441              translateLabel: true
   459              translateLabel: true
   442              adjust: right
   460              adjust: right
   443            )
   461            )
   444           (ComboListSpec
   462           (ComboListSpec
   445              name: 'ComboList2'
   463              name: 'ComboList2'
   446              layout: (LayoutFrame 190 0 272 0 -32 1 294 0)
   464              layout: (LayoutFrame 190 0 272 0 -32 1 294 0)
   447              activeHelpKey: namespace
   465              activeHelpKey: namespace
       
   466              visibilityChannel: isCreatingClassHolder
   448              model: nameSpaceHolder
   467              model: nameSpaceHolder
   449              comboList: listOfNamespaces
   468              comboList: listOfNamespaces
   450            )
   469            )
   451           (ActionButtonSpec
   470           (ActionButtonSpec
   452              label: '...'
   471              label: '...'
   453              name: 'Button5'
   472              name: 'Button5'
   454              layout: (LayoutFrame -22 1 272 0 -2 1 294 0)
   473              layout: (LayoutFrame -22 1 272 0 -2 1 294 0)
   455              activeHelpKey: namespaceChooser
   474              activeHelpKey: namespaceChooser
       
   475              visibilityChannel: isCreatingClassHolder
   456              translateLabel: true
   476              translateLabel: true
   457              model: openNamespaceChooser
   477              model: openNamespaceChooser
   458            )
   478            )
   459           (LabelSpec
   479           (LabelSpec
   460              label: 'Category:'
   480              label: 'Category:'
   461              name: 'Label12'
   481              name: 'Label12'
   462              layout: (LayoutFrame 10 0 302 0 180 0 324 0)
   482              layout: (LayoutFrame 10 0 302 0 180 0 324 0)
   463              activeHelpKey: category
   483              activeHelpKey: category
       
   484              visibilityChannel: isCreatingClassHolder
   464              translateLabel: true
   485              translateLabel: true
   465              adjust: right
   486              adjust: right
   466            )
   487            )
   467           (ComboBoxSpec
   488           (ComboBoxSpec
   468              name: 'ComboBox3'
   489              name: 'ComboBox3'
   469              layout: (LayoutFrame 190 0 302 0 -32 1 324 0)
   490              layout: (LayoutFrame 190 0 302 0 -32 1 324 0)
   470              activeHelpKey: category
   491              activeHelpKey: category
       
   492              visibilityChannel: isCreatingClassHolder
   471              model: categoryHolder
   493              model: categoryHolder
   472              acceptOnLostFocus: true
   494              acceptOnLostFocus: true
   473              comboList: listOfCategories
   495              comboList: listOfCategories
   474            )
   496            )
   475           (ActionButtonSpec
   497           (ActionButtonSpec
   476              label: '...'
   498              label: '...'
   477              name: 'Button6'
   499              name: 'Button6'
   478              layout: (LayoutFrame -22 1 302 0 -2 1 324 0)
   500              layout: (LayoutFrame -22 1 302 0 -2 1 324 0)
   479              activeHelpKey: categoryChooser
   501              activeHelpKey: categoryChooser
       
   502              visibilityChannel: isCreatingClassHolder
   480              translateLabel: true
   503              translateLabel: true
   481              model: openCategoryChooser
   504              model: openCategoryChooser
   482            )
   505            )
   483           (LabelSpec
   506           (LabelSpec
   484              label: 'Instance Variables:'
   507              label: 'Instance Variables:'
   485              name: 'Label5'
   508              name: 'Label5'
   486              layout: (LayoutFrame 10 0 342 0 180 0 364 0)
   509              layout: (LayoutFrame 10 0 342 0 180 0 364 0)
   487              activeHelpKey: instanceVariableNames
   510              activeHelpKey: instanceVariableNames
       
   511              visibilityChannel: isCreatingClassHolder
   488              translateLabel: true
   512              translateLabel: true
   489              adjust: right
   513              adjust: right
   490            )
   514            )
   491           (InputFieldSpec
   515           (InputFieldSpec
   492              name: 'EntryField4'
   516              name: 'EntryField4'
   493              layout: (LayoutFrame 190 0 342 0 -32 1 364 0)
   517              layout: (LayoutFrame 190 0 342 0 -32 1 364 0)
   494              activeHelpKey: instanceVariableNames
   518              activeHelpKey: instanceVariableNames
       
   519              visibilityChannel: isCreatingClassHolder
   495              model: instVarNamesHolder
   520              model: instVarNamesHolder
   496              acceptOnReturn: true
   521              acceptOnReturn: true
   497              acceptOnTab: true
   522              acceptOnTab: true
   498              acceptOnLostFocus: true
   523              acceptOnLostFocus: true
   499              acceptOnPointerLeave: true
   524              acceptOnPointerLeave: true
   501           (LabelSpec
   526           (LabelSpec
   502              label: 'Class Variables:'
   527              label: 'Class Variables:'
   503              name: 'Label6'
   528              name: 'Label6'
   504              layout: (LayoutFrame 10 0 372 0 180 0 394 0)
   529              layout: (LayoutFrame 10 0 372 0 180 0 394 0)
   505              activeHelpKey: classVariableNames
   530              activeHelpKey: classVariableNames
       
   531              visibilityChannel: isCreatingClassHolder
   506              translateLabel: true
   532              translateLabel: true
   507              adjust: right
   533              adjust: right
   508            )
   534            )
   509           (InputFieldSpec
   535           (InputFieldSpec
   510              name: 'EntryField5'
   536              name: 'EntryField5'
   511              layout: (LayoutFrame 190 0 372 0 -32 1 394 0)
   537              layout: (LayoutFrame 190 0 372 0 -32 1 394 0)
   512              activeHelpKey: classVariableNames
   538              activeHelpKey: classVariableNames
       
   539              visibilityChannel: isCreatingClassHolder
   513              model: classVarNamesHolder
   540              model: classVarNamesHolder
   514              acceptOnReturn: true
   541              acceptOnReturn: true
   515              acceptOnTab: true
   542              acceptOnTab: true
   516              acceptOnLostFocus: true
   543              acceptOnLostFocus: true
   517              acceptOnPointerLeave: true
   544              acceptOnPointerLeave: true
   519           (LabelSpec
   546           (LabelSpec
   520              label: 'Class InstVars:'
   547              label: 'Class InstVars:'
   521              name: 'Label7'
   548              name: 'Label7'
   522              layout: (LayoutFrame 10 0 402 0 180 0 424 0)
   549              layout: (LayoutFrame 10 0 402 0 180 0 424 0)
   523              activeHelpKey: classInstVariableNames
   550              activeHelpKey: classInstVariableNames
       
   551              visibilityChannel: isCreatingClassHolder
   524              translateLabel: true
   552              translateLabel: true
   525              adjust: right
   553              adjust: right
   526            )
   554            )
   527           (InputFieldSpec
   555           (InputFieldSpec
   528              name: 'EntryField6'
   556              name: 'EntryField6'
   529              layout: (LayoutFrame 190 0 402 0 -32 1 424 0)
   557              layout: (LayoutFrame 190 0 402 0 -32 1 424 0)
   530              activeHelpKey: classInstVariableNames
   558              activeHelpKey: classInstVariableNames
       
   559              visibilityChannel: isCreatingClassHolder
   531              model: classInstVarNamesHolder
   560              model: classInstVarNamesHolder
   532              acceptOnReturn: true
   561              acceptOnReturn: true
   533              acceptOnTab: true
   562              acceptOnTab: true
   534              acceptOnLostFocus: true
   563              acceptOnLostFocus: true
   535              acceptOnPointerLeave: true
   564              acceptOnPointerLeave: true
   544           (CheckBoxSpec
   573           (CheckBoxSpec
   545              label: 'Accessors'
   574              label: 'Accessors'
   546              name: 'CheckBox1'
   575              name: 'CheckBox1'
   547              layout: (LayoutFrame 120 0 442 0 280 0 464 0)
   576              layout: (LayoutFrame 120 0 442 0 280 0 464 0)
   548              activeHelpKey: createAccessors
   577              activeHelpKey: createAccessors
       
   578              visibilityChannel: isCreatingClassHolder
   549              model: createAccessorsHolder
   579              model: createAccessorsHolder
   550              translateLabel: true
   580              translateLabel: true
   551            )
   581            )
   552           (CheckBoxSpec
   582           (CheckBoxSpec
   553              label: 'Initial Template Code'
   583              label: 'Initial Template Code'
   554              name: 'CheckBox6'
   584              name: 'CheckBox6'
   555              layout: (LayoutFrame 310 0 442 0 -36 1 464 0)
   585              layout: (LayoutFrame 310 0 442 0 -36 1 464 0)
   556              activeHelpKey: createInitialGUICode
   586              activeHelpKey: createInitialGUICode
       
   587              enableChannel: canDisableTemplateCreationHolder
   557              model: createInitialGUICodeHolder
   588              model: createInitialGUICodeHolder
   558              translateLabel: true
   589              translateLabel: true
   559            )
   590            )
   560           (CheckBoxSpec
   591           (CheckBoxSpec
   561              label: 'Initializer'
   592              label: 'Initializer'
   562              name: 'CheckBox2'
   593              name: 'CheckBox2'
   563              layout: (LayoutFrame 120 0 472 0 0 1 494 0)
   594              layout: (LayoutFrame 120 0 472 0 0 1 494 0)
   564              activeHelpKey: createInitializer
   595              activeHelpKey: createInitializer
       
   596              visibilityChannel: isCreatingClassHolder
   565              model: createInitializerHolder
   597              model: createInitializerHolder
   566              translateLabel: true
   598              translateLabel: true
   567            )
   599            )
   568           (CheckBoxSpec
   600           (CheckBoxSpec
   569              label: 'Update Method'
   601              label: 'Update Method'
   570              name: 'CheckBox5'
   602              name: 'CheckBox5'
   571              layout: (LayoutFrame 120 0 502 0 0 1 524 0)
   603              layout: (LayoutFrame 120 0 502 0 0 1 524 0)
   572              activeHelpKey: createUpdateMethod
   604              activeHelpKey: createUpdateMethod
       
   605              visibilityChannel: isCreatingClassHolder
   573              model: createUpdateMethodHolder
   606              model: createUpdateMethodHolder
   574              translateLabel: true
   607              translateLabel: true
   575            )
   608            )
   576           (CheckBoxSpec
   609           (CheckBoxSpec
   577              label: 'Required Methods (Subclass responsibilities)'
   610              label: 'Required Methods (Subclass responsibilities)'
   578              name: 'CheckBox3'
   611              name: 'CheckBox3'
   579              layout: (LayoutFrame 120 0 532 0 0 1 554 0)
   612              layout: (LayoutFrame 120 0 532 0 0 1 554 0)
   580              activeHelpKey: createRequiredMethods
   613              activeHelpKey: createRequiredMethods
       
   614              visibilityChannel: isCreatingClassHolder
   581              model: createRequiredMethodsHolder
   615              model: createRequiredMethodsHolder
   582              translateLabel: true
   616              translateLabel: true
   583            )
   617            )
   584           (CheckBoxSpec
   618           (CheckBoxSpec
   585              label: 'Print Method'
   619              label: 'Print Method'
   754 ! !
   788 ! !
   755 
   789 
   756 !NewClassWizardDialog methodsFor:'actions'!
   790 !NewClassWizardDialog methodsFor:'actions'!
   757 
   791 
   758 doAccept
   792 doAccept
       
   793     self isCreatingPackageHolder value ifFalse:[
       
   794         self doAcceptForNewClass ifFalse:[^ self].
       
   795     ] ifTrue:[
       
   796         self doAcceptForNewPackage ifFalse:[^ self].
       
   797     ].    
       
   798     super doAccept.
       
   799 !
       
   800 
       
   801 doAcceptForNewClass
   759     |newClassName superclassName superclass package answer|
   802     |newClassName superclassName superclass package answer|
   760 
   803 
   761     newClassName := self classNameHolder value.
   804     newClassName := self classNameHolder value.
   762     newClassName isEmptyOrNil ifTrue:[
   805     newClassName isEmptyOrNil ifTrue:[
   763         Dialog warn:'No Classname entered'.
   806         self warn:('No Classname entered').
   764         ^ self.
   807         ^ false.
   765     ].
   808     ].
   766     newClassName isValidSmalltalkIdentifier ifFalse:[
   809     newClassName isValidSmalltalkIdentifier ifFalse:[
   767         Dialog warn:'No valid Classname entered (must be alphaNumeric)'.
   810         self warn:'No valid Classname entered (must be alphaNumeric)'.
   768         ^ self.
   811         ^ false.
   769     ].
   812     ].
   770     newClassName first isUppercase ifFalse:[
   813     newClassName first isUppercase ifFalse:[
   771         Dialog warn:'No valid Classname entered (first Character must be uppercase)'.
   814         self warn:'No valid Classname entered (first Character must be uppercase)'.
   772         ^ self.
   815         ^ false.
   773     ].
   816     ].
   774 
   817 
   775     superclassName := self superclassNameHolder value.
   818     superclassName := self superclassNameHolder value.
   776     superclass := Smalltalk classNamed:superclassName.
   819     superclass := Smalltalk classNamed:superclassName.
   777     superclass isNil ifTrue:[
   820     superclass isNil ifTrue:[
   778         (superclassName knownAsSymbol and:[Smalltalk includesKey:superclassName asSymbol]) ifFalse:[
   821         (superclassName knownAsSymbol and:[Smalltalk includesKey:superclassName asSymbol]) ifFalse:[
   779             Dialog warn:'No such Superclass'.
   822             self warn:'No such Superclass'.
   780             ^ self.
   823             ^ false.
   781         ].
   824         ].
   782         (Smalltalk at:superclassName asSymbol) isBehavior ifFalse:[
   825         (Smalltalk at:superclassName asSymbol) isBehavior ifFalse:[
   783             Dialog warn:('"%1" refers to a global which is not a class (%2)'
   826             self warn:'"%1" refers to a global which is not a class (%2)'
   784                         bindWith:superclassName
   827                         with:superclassName
   785                         with:superclass className).
   828                         with:superclass className.
   786             ^ self.
   829             ^ false.
   787         ].
   830         ].
   788     ].
   831     ].
   789 
   832 
   790     package := self packageHolder value.
   833     package := self packageHolder value.
   791     package notEmptyOrNil ifTrue:[
   834     package notEmptyOrNil ifTrue:[
   792         (package asPackageId module isEmptyOrNil
   835         (package asPackageId module isEmptyOrNil
   793         or:[ package asPackageId directory isEmptyOrNil ]) ifTrue:[
   836         or:[ package asPackageId directory isEmptyOrNil ]) ifTrue:[
   794             Dialog warn:('The packageID "%1" must be of the form "module:directory" (for the source repository management)'
   837             self warn:'The packageID "%1" must be of the form "module:directory" (for the source repository management)'
   795                         bindWith:package).
   838                         with:package.
   796             ^ self.
   839             ^ false.
   797         ].
   840         ].
   798 
   841 
   799         (ProjectDefinition definitionClassForPackage:package) isNil ifTrue:[
   842         (ProjectDefinition definitionClassForPackage:package) isNil ifTrue:[
   800             answer := Dialog
   843             answer := Dialog
   801                         choose:('Create a new ProjectDefinition for "%1" ?
   844                         choose:('Create a new ProjectDefinition for "%1" ?
   806                         fromList:nil values:nil
   849                         fromList:nil values:nil
   807                         buttons:#('GUI Application' 'non-GUI Application' 'Library')
   850                         buttons:#('GUI Application' 'non-GUI Application' 'Library')
   808                         values:#(guiApplicationType #nonGuiApplicationType #libraryType)
   851                         values:#(guiApplicationType #nonGuiApplicationType #libraryType)
   809                         lines:nil cancel:false.
   852                         lines:nil cancel:false.
   810 
   853 
   811             answer == false ifTrue:[^ self].
   854             answer == false ifTrue:[^ false].
   812 
   855 
   813             ProjectDefinition
   856             ProjectDefinition
   814                 definitionClassForPackage:package
   857                 definitionClassForPackage:package
   815                 projectType: (ProjectDefinition perform:answer)
   858                 projectType: (ProjectDefinition perform:answer)
   816                 createIfAbsent:true.
   859                 createIfAbsent:true.
   832 
   875 
   833     LastCategory := categoryHolder value.
   876     LastCategory := categoryHolder value.
   834     LastPackage := packageHolder value.
   877     LastPackage := packageHolder value.
   835     LastLanguage := self listOfLanguages at:(languageHolder value).
   878     LastLanguage := self listOfLanguages at:(languageHolder value).
   836 
   879 
   837     super doAccept.
   880     ^ true
   838 
   881 
   839     "Modified: / 30-01-2011 / 09:33:28 / cg"
   882     "Modified: / 30-01-2011 / 09:33:28 / cg"
   840     "Modified (comment): / 27-01-2012 / 14:53:02 / cg"
   883     "Modified (comment): / 27-01-2012 / 14:53:02 / cg"
       
   884 !
       
   885 
       
   886 doAcceptForNewPackage
       
   887     |package projectType|
       
   888 
       
   889     package := self packageHolder value.
       
   890     package isEmptyOrNil ifTrue:[
       
   891         self warn:'Missing packageID'.
       
   892         ^ false.
       
   893     ].
       
   894     
       
   895     (package asPackageId module isEmptyOrNil
       
   896     or:[ package asPackageId directory isEmptyOrNil ]) ifTrue:[
       
   897         self warn:'The packageID "%1" must be of the form "module:directory" (for the source repository management)'
       
   898                     with:package.
       
   899         ^ false.
       
   900     ].
       
   901 
       
   902     (ProjectDefinition definitionClassForPackage:package) notNil ifTrue:[
       
   903         self warn:'Package already exists'.
       
   904         ^ false.
       
   905     ].    
       
   906     self stereotypeSymbol == #GUIProject ifTrue:[
       
   907         projectType := ProjectDefinition guiApplicationType
       
   908     ] ifFalse:[    
       
   909         self stereotypeSymbol == #NonGUIProject ifTrue:[
       
   910             projectType := ProjectDefinition nonGuiApplicationType
       
   911         ] ifFalse:[    
       
   912             self stereotypeSymbol == #LibraryProject ifTrue:[
       
   913                 projectType := ProjectDefinition libraryType
       
   914             ] ifFalse:[
       
   915                 self warn:'oops - what kind of package is this'.
       
   916                 ^ false.
       
   917             ]
       
   918         ].    
       
   919     ].
       
   920     ProjectDefinition
       
   921         definitionClassForPackage:package
       
   922         projectType:projectType
       
   923         createIfAbsent:true.
       
   924             
       
   925     self doCancel. "/ hack - for now.
       
   926     ^ false.
   841 !
   927 !
   842 
   928 
   843 doCancel
   929 doCancel
   844     self closeRequest.
   930     self closeRequest.
   845 !
   931 !
   927     ].
  1013     ].
   928     self superclassNameHolder value:class name.
  1014     self superclassNameHolder value:class name.
   929 !
  1015 !
   930 
  1016 
   931 stereotypeChanged
  1017 stereotypeChanged
   932     |stereoType|
  1018     |stereoTypeSymbol|
   933 
  1019 
   934     stereoType := self listOfStereotypes at:(self stereotypeHolder value).
  1020     self listOfSuperclassesHolder value:self listOfSuperclasses.
   935 
  1021     
   936     stereoType = '<none>' ifTrue:[
  1022     stereoTypeSymbol := self stereotypeSymbol.
       
  1023     
       
  1024     (stereoTypeSymbol = #'GUIProject'
       
  1025     or:[ stereoTypeSymbol = #'NonGUIProject'
       
  1026     or:[ stereoTypeSymbol = #'LibraryProject' ]]) ifTrue:[
       
  1027         self isCreatingClassHolder value:false. 
       
  1028         self canDisableTemplateCreationHolder value:false.
       
  1029         self createInitialGUICodeHolder value:true.
       
  1030     ] ifFalse:[
       
  1031         self isCreatingClassHolder value:true.    
       
  1032         self canDisableTemplateCreationHolder value:true.
       
  1033     ].    
       
  1034     
       
  1035     stereoTypeSymbol = nil ifTrue:[
   937         self createInitializerHolder value:true.
  1036         self createInitializerHolder value:true.
   938         self createPrintMethodHolder value:false.
  1037         self createPrintMethodHolder value:false.
   939         self createAccessorsHolder value:true.
  1038         self createAccessorsHolder value:true.
   940         self createInitialGUICodeHolder value:false.
  1039         self createInitialGUICodeHolder value:false.
   941         self createUpdateMethodHolder value:false.
  1040         self createUpdateMethodHolder value:false.
   942     ].
  1041     ].
   943 
  1042 
   944     stereoType = 'Data Object' ifTrue:[
  1043     stereoTypeSymbol = #'DataObject' ifTrue:[
   945         self superclassNameHolder value:'Model'.
  1044         self superclassNameHolder value:'Model'.
   946         self createAccessorsHolder value:true.
  1045         self createAccessorsHolder value:true.
   947         self createInitialGUICodeHolder value:false.
  1046         self createInitialGUICodeHolder value:false.
   948         self createUpdateMethodHolder value:false.
  1047         self createUpdateMethodHolder value:false.
   949     ].
  1048     ].
   950 "/    stereoType = 'Enumeration' ifTrue:[
  1049 "/    stereoTypeSymbol = #'Enumeration' ifTrue:[
   951 "/        self superclassNameHolder value:'Enumeration'.
  1050 "/        self superclassNameHolder value:'Enumeration'.
   952 "/        self createInitializerHolder value:true.
  1051 "/        self createInitializerHolder value:true.
   953 "/        self createAccessorsHolder value:false.
  1052 "/        self createAccessorsHolder value:false.
   954 "/        self createInitialGUICodeHolder value:false.
  1053 "/        self createInitialGUICodeHolder value:false.
   955 "/    ].
  1054 "/    ].
   956     stereoType = 'GUIApplication' ifTrue:[
  1055     stereoTypeSymbol = #'GUIApplication' ifTrue:[
   957         self superclassNameHolder value:'ApplicationModel'.
  1056         self superclassNameHolder value:'ApplicationModel'.
   958         self createInitializerHolder value:false.
  1057         self createInitializerHolder value:false.
   959         self createPrintMethodHolder value:false.
  1058         self createPrintMethodHolder value:false.
   960         self createInitialGUICodeHolder value:true.
  1059         self createInitialGUICodeHolder value:true.
   961         self createUpdateMethodHolder value:true.
  1060         self createUpdateMethodHolder value:true.
   962     ].
  1061     ].
   963     stereoType = 'SharedPool' ifTrue:[
  1062     stereoTypeSymbol = #'SharedPool' ifTrue:[
   964         self superclassNameHolder value:'SharedPool'.
  1063         self superclassNameHolder value:'SharedPool'.
   965         self createAccessorsHolder value:false.
  1064         self createAccessorsHolder value:false.
   966         self createInitializerHolder value:true.
  1065         self createInitializerHolder value:true.
   967         self createPrintMethodHolder value:false.
  1066         self createPrintMethodHolder value:false.
   968         self createInitialGUICodeHolder value:false.
  1067         self createInitialGUICodeHolder value:false.
   969         self createUpdateMethodHolder value:false.
  1068         self createUpdateMethodHolder value:false.
   970     ].
  1069     ].
   971     (stereoType startsWith: 'Startup') ifTrue:[
  1070     (stereoTypeSymbol = #'StartupClass') ifTrue:[
   972         self superclassNameHolder value:'StandaloneStartup'.
  1071         self superclassNameHolder value:'StandaloneStartup'.
   973         self createAccessorsHolder value:false.
  1072         self createAccessorsHolder value:false.
   974         self createInitializerHolder value:true.
  1073         self createInitializerHolder value:true.
   975         self createPrintMethodHolder value:false.
  1074         self createPrintMethodHolder value:false.
   976         self createInitialGUICodeHolder value:true.
  1075         self createInitialGUICodeHolder value:true.
   977         self createUpdateMethodHolder value:false.
  1076         self createUpdateMethodHolder value:false.
   978     ].
  1077     ].
   979     stereoType = 'TestCase' ifTrue:[
  1078     stereoTypeSymbol = #'TestCase' ifTrue:[
   980         self superclassNameHolder value:'TestCase'.
  1079         self superclassNameHolder value:'TestCase'.
   981         self createAccessorsHolder value:false.
  1080         self createAccessorsHolder value:false.
   982         self createInitializerHolder value:false.
  1081         self createInitializerHolder value:false.
   983         self createPrintMethodHolder value:false.
  1082         self createPrintMethodHolder value:false.
   984         self createInitialGUICodeHolder value:true.
  1083         self createInitialGUICodeHolder value:true.
   985         self createUpdateMethodHolder value:false.
  1084         self createUpdateMethodHolder value:false.
   986     ].
  1085     ].
   987     stereoType = 'WebService' ifTrue:[
  1086     stereoTypeSymbol = #'WebService' ifTrue:[
   988         self superclassNameHolder value:'HTTPService'.
  1087         self superclassNameHolder value:'HTTPService'.
   989         self createAccessorsHolder value:false.
  1088         self createAccessorsHolder value:false.
   990         self createInitializerHolder value:false.
  1089         self createInitializerHolder value:false.
   991         self createPrintMethodHolder value:false.
  1090         self createPrintMethodHolder value:false.
   992         self createInitialGUICodeHolder value:true.
  1091         self createInitialGUICodeHolder value:true.
   993         self createUpdateMethodHolder value:false.
  1092         self createUpdateMethodHolder value:false.
   994     ].
  1093     ].
   995     stereoType = 'Widget' ifTrue:[
  1094     stereoTypeSymbol = #'Widget' ifTrue:[
   996         self superclassNameHolder value:'View'.
  1095         self superclassNameHolder value:'View'.
   997         self createInitializerHolder value:false.
  1096         self createInitializerHolder value:false.
   998         self createPrintMethodHolder value:false.
  1097         self createPrintMethodHolder value:false.
   999         self createInitialGUICodeHolder value:false.
  1098         self createInitialGUICodeHolder value:false.
  1000         self createUpdateMethodHolder value:true.
  1099         self createUpdateMethodHolder value:true.
  1001     ].
  1100     ].
  1002 
  1101 
  1003     "Modified: / 27-01-2012 / 14:47:20 / cg"
  1102     "Modified: / 27-01-2012 / 14:47:20 / cg"
       
  1103 !
       
  1104 
       
  1105 stereotypeSymbol
       
  1106     |stereoTypeIndex stereoTypeSpec stereoTypeSymbol|
       
  1107 
       
  1108     stereoTypeIndex := self stereotypeHolder value.
       
  1109     stereoTypeIndex isNil ifTrue:[^ nil].
       
  1110     
       
  1111     stereoTypeSpec := self stereotypeSpec at:stereoTypeIndex.
       
  1112     stereoTypeSymbol := stereoTypeSpec first.
       
  1113     ^ stereoTypeSymbol
  1004 ! !
  1114 ! !
  1005 
  1115 
  1006 !NewClassWizardDialog methodsFor:'aspects'!
  1116 !NewClassWizardDialog methodsFor:'aspects'!
       
  1117 
       
  1118 canDisableTemplateCreationHolder
       
  1119     <resource: #uiAspect>
       
  1120 
       
  1121     canDisableTemplateCreationHolder isNil ifTrue:[
       
  1122         canDisableTemplateCreationHolder := true asValue.
       
  1123     ].
       
  1124     ^ canDisableTemplateCreationHolder.
       
  1125 !
  1007 
  1126 
  1008 categoryHolder
  1127 categoryHolder
  1009     <resource: #uiAspect>
  1128     <resource: #uiAspect>
  1010 
  1129 
  1011     categoryHolder isNil ifTrue:[
  1130     categoryHolder isNil ifTrue:[
  1030         classNameHolder := ValueHolder new.
  1149         classNameHolder := ValueHolder new.
  1031     ].
  1150     ].
  1032     ^ classNameHolder.
  1151     ^ classNameHolder.
  1033 !
  1152 !
  1034 
  1153 
       
  1154 classNameVisibleHolder
       
  1155     <resource: #uiAspect>
       
  1156 
       
  1157     ^ self isCreatingClassHolder
       
  1158 !
       
  1159 
  1035 classVarNamesHolder
  1160 classVarNamesHolder
  1036     <resource: #uiAspect>
  1161     <resource: #uiAspect>
  1037 
  1162 
  1038     classVarNamesHolder isNil ifTrue:[
  1163     classVarNamesHolder isNil ifTrue:[
  1039         classVarNamesHolder := ValueHolder new.
  1164         classVarNamesHolder := ValueHolder new.
  1124 
  1249 
  1125     instVarNamesHolder isNil ifTrue:[
  1250     instVarNamesHolder isNil ifTrue:[
  1126         instVarNamesHolder := ValueHolder new.
  1251         instVarNamesHolder := ValueHolder new.
  1127     ].
  1252     ].
  1128     ^ instVarNamesHolder.
  1253     ^ instVarNamesHolder.
       
  1254 !
       
  1255 
       
  1256 isCreatingClassHolder
       
  1257     <resource: #uiAspect>
       
  1258 
       
  1259     isCreatingClassHolder isNil ifTrue:[
       
  1260         isCreatingClassHolder := true asValue
       
  1261     ].
       
  1262     ^ isCreatingClassHolder.
       
  1263 !
       
  1264 
       
  1265 isCreatingPackageHolder
       
  1266     ^ BlockValue forLogicalNot:self isCreatingClassHolder.
  1129 !
  1267 !
  1130 
  1268 
  1131 languageHolder
  1269 languageHolder
  1132     <resource: #uiAspect>
  1270     <resource: #uiAspect>
  1133 
  1271 
  1162 
  1300 
  1163 listOfPackages
  1301 listOfPackages
  1164     ^ Smalltalk allPackageIDs copy sort
  1302     ^ Smalltalk allPackageIDs copy sort
  1165 !
  1303 !
  1166 
  1304 
       
  1305 listOfStereotypeSymbols
       
  1306     "program readable list"
       
  1307     ^ self stereotypeSpec collect:[:each | each isNil ifTrue:[nil] ifFalse:[each first]].
       
  1308 !
       
  1309 
  1167 listOfStereotypes
  1310 listOfStereotypes
  1168     ^ #(
  1311     "human readable list"
  1169         '<none>'
  1312     ^ self stereotypeSpec collect:[:each | each isNil ifTrue:[nil] ifFalse:[each second]].
  1170 "/        ConsoleApplication
       
  1171         'Data Object'
       
  1172 "/        Enumeration
       
  1173         GUIApplication
       
  1174         SharedPool
       
  1175         TestCase
       
  1176         'StartupClass (main entry for standalone apps)'
       
  1177         WebService
       
  1178         Widget
       
  1179     )
       
  1180 
       
  1181     "Modified: / 27-01-2012 / 14:46:39 / cg"
       
  1182 !
  1313 !
  1183 
  1314 
  1184 listOfSuperclasses
  1315 listOfSuperclasses
  1185     <resource: #uiAspect>
  1316     <resource: #uiAspect>
  1186 
  1317 
  1187     |l superClassName|
  1318     |l superClassName
  1188 
  1319      stereoTypeSymbol more
       
  1320      includeObject includeModel includeApplicationModel includeView
       
  1321      includeStandaloneStartup|
       
  1322 
       
  1323     stereoTypeSymbol := self stereotypeSymbol.
       
  1324     
       
  1325     includeObject := includeModel := includeApplicationModel := includeView := true.
       
  1326     includeStandaloneStartup := false.
       
  1327     
       
  1328     stereoTypeSymbol = #'DataObject' ifTrue:[
       
  1329         includeApplicationModel := includeView := false.
       
  1330     ].
       
  1331     stereoTypeSymbol = #'Enumeration' ifTrue:[
       
  1332         includeModel := includeApplicationModel := includeView := false.
       
  1333     ].
       
  1334     stereoTypeSymbol = #'GUIApplication' ifTrue:[
       
  1335         includeModel := includeView := includeObject := false.
       
  1336     ].
       
  1337     stereoTypeSymbol = #'ConsoleProgram' ifTrue:[
       
  1338         includeModel := includeApplicationModel := includeView := includeObject := false.
       
  1339         includeStandaloneStartup := true.
       
  1340     ].
       
  1341     stereoTypeSymbol = #'SharedPool' ifTrue:[
       
  1342         includeModel := includeApplicationModel := includeView := includeObject := false.
       
  1343     ].
       
  1344     (stereoTypeSymbol = #'StartupClass') ifTrue:[
       
  1345         includeModel := includeApplicationModel := includeView := includeObject := false.
       
  1346         includeStandaloneStartup := true.
       
  1347     ].
       
  1348     stereoTypeSymbol = #'TestCase' ifTrue:[
       
  1349         includeModel := includeApplicationModel := includeView := includeObject := false.
       
  1350     ].
       
  1351     stereoTypeSymbol = #'WebService' ifTrue:[
       
  1352         includeModel := includeApplicationModel := includeView := includeObject := false.
       
  1353     ].
       
  1354     stereoTypeSymbol = #'Widget' ifTrue:[
       
  1355         includeModel := includeApplicationModel := includeObject := false.
       
  1356     ].
       
  1357     
  1189     l := OrderedCollection new.
  1358     l := OrderedCollection new.
  1190     (superClassName := self superclassNameHolder value) notNil ifTrue:[
  1359     (includeObject and:[superClassName ~= 'Object']) ifTrue:[
  1191         l add:superClassName.
       
  1192     ].
       
  1193     superClassName ~= 'Object' ifTrue:[
       
  1194         l add:'Object'
  1360         l add:'Object'
  1195     ].
  1361     ].
  1196     superClassName ~= 'Model' ifTrue:[
  1362     (includeModel and:[superClassName ~= 'Model']) ifTrue:[
  1197         l add:'Model'
  1363         l add:'Model'
  1198     ].
  1364     ].
  1199     superClassName ~= 'View' ifTrue:[
  1365     (includeView and:[superClassName ~= 'View']) ifTrue:[
  1200         l add:'View'
  1366         l add:'View'
  1201     ].
  1367     ].
  1202     superClassName ~= 'ApplicationModel' ifTrue:[
  1368     (includeApplicationModel and:[superClassName ~= 'ApplicationModel']) ifTrue:[
  1203         l add:'ApplicationModel'
  1369         l add:'ApplicationModel'
  1204     ].
  1370     ].
  1205     l add:'-'.
  1371     
  1206     l addAll:(SystemBrowser visitedClassNamesHistory).
  1372     includeStandaloneStartup ifTrue:[
       
  1373         superClassName ~= 'StandaloneStartup' ifTrue:[
       
  1374             l add:'StandaloneStartup'
       
  1375         ].
       
  1376         superClassName ~= 'StandaloneStartupHeadless' ifTrue:[
       
  1377             l add:'StandaloneStartupHeadless'
       
  1378         ].
       
  1379     ].
       
  1380     
       
  1381     more := UserPreferences systemBrowserClass visitedClassNamesHistory.
       
  1382     more notEmptyOrNil ifTrue:[
       
  1383         l add:'-'.
       
  1384         l addAll:more.
       
  1385     ].
  1207     ^ l
  1386     ^ l
  1208 
  1387 
  1209     "Created: / 30-01-2011 / 10:34:44 / cg"
  1388     "Created: / 30-01-2011 / 10:34:44 / cg"
       
  1389 !
       
  1390 
       
  1391 listOfSuperclassesHolder
       
  1392     <resource: #uiAspect>
       
  1393 
       
  1394     listOfSuperclassesHolder isNil ifTrue:[
       
  1395         listOfSuperclassesHolder := self listOfSuperclasses asValue.
       
  1396     ].
       
  1397     ^ listOfSuperclassesHolder.
  1210 !
  1398 !
  1211 
  1399 
  1212 nameSpaceHolder
  1400 nameSpaceHolder
  1213     <resource: #uiAspect>
  1401     <resource: #uiAspect>
  1214 
  1402 
  1243         stereotypeHolder onChangeSend:#stereotypeChanged to:self.
  1431         stereotypeHolder onChangeSend:#stereotypeChanged to:self.
  1244     ].
  1432     ].
  1245     ^ stereotypeHolder.
  1433     ^ stereotypeHolder.
  1246 !
  1434 !
  1247 
  1435 
       
  1436 stereotypeSpec
       
  1437     ^ #(
       
  1438         ( nil '<none>' )
       
  1439         ( DataObject 'Data Object' )
       
  1440 "/      ( Enumeration Enumeration )
       
  1441         ( GUIApplication 'GUI Application')
       
  1442         ( ConsoleProgram 'Console Program')
       
  1443         ( SharedPool 'Shared Pool')
       
  1444         ( TestCase TestCase )
       
  1445         ( WebService 'Web Service' )
       
  1446         ( Widget Widget)
       
  1447         ( StartupClass 'Startup Class (main entry for standalone apps)' )
       
  1448         nil
       
  1449         ( GUIProject 'GUI Project')
       
  1450         ( NonGUIProject 'Non-GUI Project')
       
  1451         ( LibraryProject 'Library Project')
       
  1452     )
       
  1453 
       
  1454     "Modified: / 27-01-2012 / 14:46:39 / cg"
       
  1455 !
       
  1456 
  1248 superclassNameHolder
  1457 superclassNameHolder
  1249     <resource: #uiAspect>
  1458     <resource: #uiAspect>
  1250 
  1459 
  1251     superclassNameHolder isNil ifTrue:[
  1460     superclassNameHolder isNil ifTrue:[
  1252         superclassNameHolder := (LastSuperclass ? 'Object') asValue.
  1461         superclassNameHolder := (LastSuperclass ? ''"'Object'") asValue.
  1253     ].
  1462     ].
  1254     ^ superclassNameHolder.
  1463     ^ superclassNameHolder.
  1255 
  1464 
  1256     "Modified: / 27-01-2012 / 14:49:43 / cg"
  1465     "Modified: / 27-01-2012 / 14:49:43 / cg"
  1257 ! !
  1466 ! !