1917 classClassInstVars |
1918 classClassInstVars |
1918 "show class instance variables in codeView and setup accept-action |
1919 "show class instance variables in codeView and setup accept-action |
1919 for a class-instvar-definition change" |
1920 for a class-instvar-definition change" |
1920 |
1921 |
1921 self doClassMenu:[:currentClass | |
1922 self doClassMenu:[:currentClass | |
1922 |s| |
1923 |s| |
1923 |
1924 |
1924 s := WriteStream on:(String new). |
1925 s := WriteStream on:(String new). |
1925 currentClass fileOutClassInstVarDefinitionOn:s. |
1926 currentClass fileOutClassInstVarDefinitionOn:s. |
1926 codeView contents:(s contents). |
1927 codeView contents:(s contents). |
1927 codeView modified:false. |
1928 codeView modified:false. |
1928 codeView acceptAction:[:theCode | |
1929 codeModified := false. |
1929 codeView cursor:Cursor execute. |
1930 |
1930 Object abortSignal catch:[ |
1931 codeView acceptAction:[:theCode | |
1931 Class nameSpaceQuerySignal answer:Smalltalk |
1932 codeView cursor:Cursor execute. |
1932 do:[ |
1933 Object abortSignal catch:[ |
1933 Compiler evaluate:theCode asString notifying:codeView compile:false. |
1934 Class nameSpaceQuerySignal answer:Smalltalk |
1934 ]. |
1935 do:[ |
1935 |
1936 Compiler evaluate:theCode asString notifying:codeView compile:false. |
1936 codeView modified:false. |
1937 ]. |
1937 self normalLabel. |
1938 |
1938 self updateClassList. |
1939 codeView modified:false. |
1939 ]. |
1940 codeModified := false. |
1940 codeView cursor:Cursor normal. |
1941 self normalLabel. |
1941 ]. |
1942 self updateClassList. |
1942 codeView explainAction:nil. |
1943 ]. |
1943 methodListView notNil ifTrue:[ |
1944 codeView cursor:Cursor normal. |
1944 methodListView setSelection:nil |
1945 ]. |
1945 ]. |
1946 codeView explainAction:nil. |
1946 aspect := #classInstVars. |
1947 methodListView notNil ifTrue:[ |
1947 self normalLabel |
1948 methodListView setSelection:nil |
|
1949 ]. |
|
1950 aspect := #classInstVars. |
|
1951 self normalLabel |
1948 ] |
1952 ] |
1949 |
1953 |
1950 "Modified: 16.1.1997 / 01:47:37 / cg" |
1954 "Modified: / 31.3.1998 / 23:37:34 / cg" |
1951 ! |
1955 ! |
1952 |
1956 |
1953 classComment |
1957 classComment |
1954 "show the classes comment in the codeView. |
1958 "show the classes comment in the codeView. |
1955 Also, set accept action to change the comment." |
1959 Also, set accept action to change the comment." |
2831 count subclasses and let user confirm removal." |
2838 count subclasses and let user confirm removal." |
2832 |
2839 |
2833 |count t box| |
2840 |count t box| |
2834 |
2841 |
2835 currentClass notNil ifTrue:[ |
2842 currentClass notNil ifTrue:[ |
2836 count := currentClass allSubclasses size. |
2843 count := currentClass allSubclasses size. |
2837 t := 'remove %1'. |
2844 t := 'remove %1'. |
2838 count ~~ 0 ifTrue:[ |
2845 count ~~ 0 ifTrue:[ |
2839 t := t , '\(with %2 subclass'. |
2846 t := t , '\(with %2 subclass'. |
2840 count ~~ 1 ifTrue:[ |
2847 count ~~ 1 ifTrue:[ |
2841 t := t , 'es' |
2848 t := t , 'es' |
2842 ]. |
2849 ]. |
2843 t := (t , ')') |
2850 t := (t , ')') |
2844 ]. |
2851 ]. |
2845 t := t , ' ?'. |
2852 t := t , ' ?'. |
2846 t := (resources string:t with:currentClass name with:count) withCRs. |
2853 t := (resources string:t with:currentClass name with:count) withCRs. |
2847 |
2854 |
2848 box := YesNoBox |
2855 box := YesNoBox |
2849 title:t |
2856 title:t |
2850 yesText:(resources at:'remove') |
2857 yesText:(resources at:'remove') |
2851 noText:(resources at:'abort'). |
2858 noText:(resources at:'abort'). |
2852 box label:(resources string:'remove class'). |
2859 box label:(resources string:'remove class'). |
2853 |
2860 |
2854 box confirm ifTrue:[ |
2861 box confirm ifTrue:[ |
2855 "after querying user - do really remove current class |
2862 "after querying user - do really remove current class |
2856 and all subclasses |
2863 and all subclasses |
2857 " |
2864 " |
2858 self doClassMenu:[:currentClass | |
2865 self doClassMenu:[:currentClass | |
2859 |didRemove| |
2866 |didRemove| |
2860 |
2867 |
2861 didRemove := false. |
2868 didRemove := false. |
2862 |
2869 |
2863 " |
2870 " |
2864 query ? |
2871 query ? |
2865 " |
2872 " |
2866 currentClass allSubclassesDo:[:aSubClass | |
2873 currentClass allSubclassesDo:[:aSubClass | |
2867 (CheckForInstancesWhenRemovingClasses not |
2874 (CheckForInstancesWhenRemovingClasses not |
2868 or:[aSubClass hasInstances not |
2875 or:[aSubClass hasInstances not |
2869 or:[self confirm:(resources string:'''%1'' has instances - remove anyway ?' with:aSubClass name)]]) |
2876 or:[self confirm:(resources string:'''%1'' has instances - remove anyway ?' with:aSubClass name)]]) |
2870 ifTrue:[ |
2877 ifTrue:[ |
2871 aSubClass removeFromSystem |
2878 aSubClass removeFromSystem |
2872 ] |
2879 ] |
2873 ]. |
2880 ]. |
2874 (CheckForInstancesWhenRemovingClasses not |
2881 (CheckForInstancesWhenRemovingClasses not |
2875 or:[currentClass hasInstances not |
2882 or:[currentClass hasInstances not |
2876 or:[self confirm:(resources string:'''%1'' has instances - remove anyway ?' with:currentClass name)]]) |
2883 or:[self confirm:(resources string:'''%1'' has instances - remove anyway ?' with:currentClass name)]]) |
2877 ifTrue:[ |
2884 ifTrue:[ |
2878 didRemove := true. |
2885 didRemove := true. |
2879 currentClass removeFromSystem. |
2886 currentClass removeFromSystem. |
2880 ]. |
2887 ]. |
2881 |
2888 |
2882 didRemove ifTrue:[ |
2889 didRemove ifTrue:[ |
2883 self switchToClass:nil. |
2890 self switchToClass:nil. |
2884 Smalltalk changed. |
2891 Smalltalk changed. |
2885 self updateClassList. |
2892 self updateClassList. |
2886 |
2893 |
2887 "if it was the last in its category, update class category list" |
2894 "if it was the last in its category, update class category list" |
2888 |
2895 |
2889 "/ classListView numberOfLines == 0 ifTrue:[ |
2896 "/ classListView numberOfLines == 0 ifTrue:[ |
2890 "/ self updateClassCategoryListWithScroll:false |
2897 "/ self updateClassCategoryListWithScroll:false |
2891 "/ ]. |
2898 "/ ]. |
2892 |
2899 |
2893 methodCategoryListView notNil ifTrue:[methodCategoryListView contents:nil]. |
2900 methodCategoryListView notNil ifTrue:[methodCategoryListView contents:nil]. |
2894 methodListView notNil ifTrue:[methodListView contents:nil]. |
2901 methodListView notNil ifTrue:[methodListView contents:nil]. |
2895 codeView contents:nil. |
2902 codeView contents:nil. |
2896 codeView modified:false |
2903 codeView modified:false. |
2897 ] |
2904 codeModified := false. |
2898 ] |
2905 ] |
2899 ]. |
2906 ] |
2900 box destroy. |
2907 ]. |
|
2908 box destroy. |
2901 ] |
2909 ] |
2902 |
2910 |
2903 "Modified: 12.8.1997 / 02:23:19 / cg" |
2911 "Modified: / 31.3.1998 / 23:38:05 / cg" |
2904 ! |
2912 ! |
2905 |
2913 |
2906 classRename |
2914 classRename |
2907 "launch an enterBox for new name and query user" |
2915 "launch an enterBox for new name and query user" |
2908 |
2916 |
2925 "common helper for comment, primitive-stuff etc. |
2933 "common helper for comment, primitive-stuff etc. |
2926 show the string returned from the classes getSelector-method, |
2934 show the string returned from the classes getSelector-method, |
2927 Set acceptaction to change it via setSelector." |
2935 Set acceptaction to change it via setSelector." |
2928 |
2936 |
2929 self doClassMenu:[:currentClass | |
2937 self doClassMenu:[:currentClass | |
2930 |text| |
2938 |text| |
2931 |
2939 |
2932 text := currentClass perform:getSelector. |
2940 text := currentClass perform:getSelector. |
2933 text isNil ifTrue:[ |
2941 text isNil ifTrue:[ |
2934 text := default |
2942 text := default |
2935 ]. |
2943 ]. |
2936 codeView contents:text. |
2944 codeView contents:text. |
2937 codeView modified:false. |
2945 codeView modified:false. |
2938 codeView acceptAction:[:theCode | |
2946 codeModified := false. |
2939 Object abortSignal catch:[ |
2947 |
2940 lockUpdates := true. |
2948 codeView acceptAction:[:theCode | |
2941 currentClass perform:setSelector with:theCode asString. |
2949 Object abortSignal catch:[ |
2942 codeView modified:false. |
2950 lockUpdates := true. |
2943 ]. |
2951 currentClass perform:setSelector with:theCode asString. |
2944 lockUpdates := false. |
2952 codeView modified:false. |
2945 ]. |
2953 codeModified := false. |
2946 codeView explainAction:nil. |
2954 ]. |
2947 |
2955 lockUpdates := false. |
2948 methodListView notNil ifTrue:[ |
2956 ]. |
2949 methodListView setSelection:nil |
2957 codeView explainAction:nil. |
2950 ]. |
2958 |
2951 aspect := aspectSymbol. |
2959 methodListView notNil ifTrue:[ |
2952 self normalLabel |
2960 methodListView setSelection:nil |
|
2961 ]. |
|
2962 aspect := aspectSymbol. |
|
2963 self normalLabel |
2953 ] |
2964 ] |
2954 |
2965 |
2955 "Modified: 25.5.1996 / 13:02:40 / cg" |
2966 "Modified: / 31.3.1998 / 23:38:36 / cg" |
2956 ! |
2967 ! |
2957 |
2968 |
2958 classSpawn |
2969 classSpawn |
2959 "create a new SystemBrowser browsing current class, |
2970 "create a new SystemBrowser browsing current class, |
2960 or if there is a selection, spawn a browser on the selected class |
2971 or if there is a selection, spawn a browser on the selected class |
3958 |
3969 |
3959 classRevisionInfo |
3970 classRevisionInfo |
3960 "show current classes revision info in codeView" |
3971 "show current classes revision info in codeView" |
3961 |
3972 |
3962 self doClassMenu:[:currentClass | |
3973 self doClassMenu:[:currentClass | |
3963 |aStream info info2 s rv mgr fn msg| |
3974 |aStream info info2 s rv mgr fn msg| |
3964 |
3975 |
3965 aStream := WriteStream on:(String new:200). |
3976 aStream := WriteStream on:(String new:200). |
3966 currentClass notNil ifTrue:[ |
3977 currentClass notNil ifTrue:[ |
3967 Processor activeProcess withLowerPriorityDo:[ |
3978 Processor activeProcess withLowerPriorityDo:[ |
3968 self busyLabel:'extracting revision info' with:nil. |
3979 self busyLabel:'extracting revision info' with:nil. |
3969 |
3980 |
3970 info := currentClass revisionInfo. |
3981 info := currentClass revisionInfo. |
3971 |
3982 |
3972 rv := currentClass binaryRevision. |
3983 rv := currentClass binaryRevision. |
3973 rv notNil ifTrue:[ |
3984 rv notNil ifTrue:[ |
3974 aStream nextPutLine:'**** Loaded classes binary information ****'; cr. |
3985 aStream nextPutLine:'**** Loaded classes binary information ****'; cr. |
3975 aStream nextPutLine:' Binary based upon : ' , rv. |
3986 aStream nextPutLine:' Binary based upon : ' , rv. |
3976 aStream cr. |
3987 aStream cr. |
3977 ]. |
3988 ]. |
3978 |
3989 |
3979 info notNil ifTrue:[ |
3990 info notNil ifTrue:[ |
3980 (info includesKey:#revision) ifFalse:[ |
3991 (info includesKey:#revision) ifFalse:[ |
3981 aStream nextPutLine:'WARNING:'; cr. |
3992 aStream nextPutLine:'WARNING:'; cr. |
3982 aStream nextPutLine:' The class seems not to be loaded from the repository.'. |
3993 aStream nextPutLine:' The class seems not to be loaded from the repository.'. |
3983 aStream nextPutLine:' Check carefully before checking anything in.'. |
3994 aStream nextPutLine:' Check carefully before checking anything in.'. |
3984 aStream nextPutLine:' (i.e. compare with repository for renamed class(es), same-name but unrelated etc.)'. |
3995 aStream nextPutLine:' (i.e. compare with repository for renamed class(es), same-name but unrelated etc.)'. |
3985 aStream cr. |
3996 aStream cr. |
3986 ]. |
3997 ]. |
3987 |
3998 |
3988 aStream nextPutLine:'**** Classes source information ****'; cr. |
3999 aStream nextPutLine:'**** Classes source information ****'; cr. |
3989 s := info at:#repositoryPath ifAbsent:nil. |
4000 s := info at:#repositoryPath ifAbsent:nil. |
3990 s notNil ifTrue:[ |
4001 s notNil ifTrue:[ |
3991 aStream nextPutLine:' Source repository : ' , s |
4002 aStream nextPutLine:' Source repository : ' , s |
3992 ]. |
4003 ]. |
3993 aStream nextPutLine:' Filename ........ : ' , (info at:#fileName ifAbsent:'?'). |
4004 aStream nextPutLine:' Filename ........ : ' , (info at:#fileName ifAbsent:'?'). |
3994 aStream nextPutLine:' Revision ........ : ' , (info at:#revision ifAbsent:'?'). |
4005 aStream nextPutLine:' Revision ........ : ' , (info at:#revision ifAbsent:'?'). |
3995 aStream nextPutLine:' Checkin date .... : ' , (info at:#date ifAbsent:'?') , ' ' , (info at:#time ifAbsent:'?'). |
4006 aStream nextPutLine:' Checkin date .... : ' , (info at:#date ifAbsent:'?') , ' ' , (info at:#time ifAbsent:'?'). |
3996 aStream nextPutLine:' Checkin user .... : ' , (info at:#user ifAbsent:'?'). |
4007 aStream nextPutLine:' Checkin user .... : ' , (info at:#user ifAbsent:'?'). |
3997 |
4008 |
3998 (info2 := currentClass packageSourceCodeInfo) notNil ifTrue:[ |
4009 (info2 := currentClass packageSourceCodeInfo) notNil ifTrue:[ |
3999 aStream nextPutLine:' Repository: ..... : ' , (info2 at:#module ifAbsent:'?'). |
4010 aStream nextPutLine:' Repository: ..... : ' , (info2 at:#module ifAbsent:'?'). |
4000 aStream nextPutLine:' Directory: ...... : ' , (info2 at:#directory ifAbsent:'?'). |
4011 aStream nextPutLine:' Directory: ...... : ' , (info2 at:#directory ifAbsent:'?'). |
4001 ]. |
4012 ]. |
4002 aStream nextPutLine:' Container ....... : ' , (info at:#repositoryPathName ifAbsent:'?'). |
4013 aStream nextPutLine:' Container ....... : ' , (info at:#repositoryPathName ifAbsent:'?'). |
4003 aStream cr. |
4014 aStream cr. |
4004 |
4015 |
4005 (mgr := currentClass sourceCodeManager) notNil ifTrue:[ |
4016 (mgr := currentClass sourceCodeManager) notNil ifTrue:[ |
4006 aStream nextPutLine:'**** Repository information ****'; cr. |
4017 aStream nextPutLine:'**** Repository information ****'; cr. |
4007 mgr writeRevisionLogOf:currentClass to:aStream. |
4018 mgr writeRevisionLogOf:currentClass to:aStream. |
4008 ] |
4019 ] |
4009 ] ifFalse:[ |
4020 ] ifFalse:[ |
4010 aStream nextPutLine:'No revision info found'. |
4021 aStream nextPutLine:'No revision info found'. |
4011 currentClass isLoaded ifFalse:[ |
4022 currentClass isLoaded ifFalse:[ |
4012 aStream cr; nextPutAll:'This is an autoloaded class - you may see more after its loaded.' |
4023 aStream cr; nextPutAll:'This is an autoloaded class - you may see more after its loaded.' |
4013 ] ifTrue:[ |
4024 ] ifTrue:[ |
4014 fn := currentClass classFilename. |
4025 fn := currentClass classFilename. |
4015 currentClass wasAutoloaded ifTrue:[ |
4026 currentClass wasAutoloaded ifTrue:[ |
4016 msg := 'This class was autoloaded.'. |
4027 msg := 'This class was autoloaded.'. |
4017 fn notNil ifTrue:[ |
4028 fn notNil ifTrue:[ |
4018 msg := msg , ' (from ''' , fn , ''')'. |
4029 msg := msg , ' (from ''' , fn , ''')'. |
4019 ]. |
4030 ]. |
4020 ] ifFalse:[ |
4031 ] ifFalse:[ |
4021 fn notNil ifTrue:[ |
4032 fn notNil ifTrue:[ |
4022 msg := 'This class was loaded from ''' , fn , '''.' |
4033 msg := 'This class was loaded from ''' , fn , '''.' |
4023 ]. |
4034 ]. |
4024 ]. |
4035 ]. |
4025 msg notNil ifTrue:[ |
4036 msg notNil ifTrue:[ |
4026 aStream cr; nextPutAll:msg. |
4037 aStream cr; nextPutAll:msg. |
4027 ] |
4038 ] |
4028 ] |
4039 ] |
4029 ] |
4040 ] |
4030 ] |
4041 ] |
4031 ]. |
4042 ]. |
4032 codeView contents:(aStream contents). |
4043 codeView contents:(aStream contents). |
4033 |
4044 |
4034 codeView modified:false. |
4045 codeView modified:false. |
4035 codeView acceptAction:nil. |
4046 codeModified := false. |
4036 codeView explainAction:nil. |
4047 codeView acceptAction:nil. |
4037 methodListView notNil ifTrue:[ |
4048 codeView explainAction:nil. |
4038 methodListView setSelection:nil |
4049 methodListView notNil ifTrue:[ |
4039 ]. |
4050 methodListView setSelection:nil |
4040 aspect := #revisionInfo. |
4051 ]. |
4041 self normalLabel |
4052 aspect := #revisionInfo. |
|
4053 self normalLabel |
4042 ] |
4054 ] |
4043 |
4055 |
4044 "Created: 14.11.1995 / 16:43:15 / cg" |
4056 "Created: / 14.11.1995 / 16:43:15 / cg" |
4045 "Modified: 11.11.1996 / 10:09:28 / cg" |
4057 "Modified: / 31.3.1998 / 23:38:10 / cg" |
4046 ! |
4058 ! |
4047 |
4059 |
4048 getLogMessageFor:aString |
4060 getLogMessageFor:aString |
4049 "get a log message for when checking in a class. |
4061 "get a log message for when checking in a class. |
4050 Return the message or nil if aborted." |
4062 Return the message or nil if aborted." |
4168 currentMethod := currentSelector := nil. |
4180 currentMethod := currentSelector := nil. |
4169 |
4181 |
4170 classListView setSelection:nil. |
4182 classListView setSelection:nil. |
4171 |
4183 |
4172 fullClass ifFalse:[ |
4184 fullClass ifFalse:[ |
4173 methodCategoryListView contents:nil. |
4185 methodCategoryListView contents:nil. |
4174 methodListView contents:nil |
4186 methodListView contents:nil |
4175 ]. |
4187 ]. |
4176 |
4188 |
4177 (aClass == Autoload |
4189 (aClass == Autoload |
4178 or:[aClass isNil or:[aClass isLoaded not]]) ifTrue:[ |
4190 or:[aClass isNil or:[aClass isLoaded not]]) ifTrue:[ |
4179 theSuperClass := Object |
4191 theSuperClass := Object |
4180 ] ifFalse:[ |
4192 ] ifFalse:[ |
4181 theSuperClass := aClass |
4193 theSuperClass := aClass |
4182 ]. |
4194 ]. |
4183 codeView contents:(self classTemplateFor:theSuperClass in:cat namespace:isNameSpace private:isPrivate). |
4195 codeView contents:(self classTemplateFor:theSuperClass in:cat namespace:isNameSpace private:isPrivate). |
4184 codeView modified:false. |
4196 codeView modified:false. |
|
4197 codeModified := false. |
4185 |
4198 |
4186 codeView acceptAction:[:theCode | |
4199 codeView acceptAction:[:theCode | |
4187 codeView cursor:Cursor execute. |
4200 codeView cursor:Cursor execute. |
4188 Object abortSignal catch:[ |
4201 Object abortSignal catch:[ |
4189 |cls| |
4202 |cls| |
4190 |
4203 |
4191 Object errorSignal handle:[:ex | |
4204 Object errorSignal handle:[:ex | |
4192 codeView error:ex errorString |
4205 codeView error:ex errorString |
4193 position:1 to:nil from:nil. |
4206 position:1 to:nil from:nil. |
4194 ] do:[ |
4207 ] do:[ |
4195 Class nameSpaceQuerySignal answer:Smalltalk |
4208 Class nameSpaceQuerySignal answer:Smalltalk |
4196 do:[ |
4209 do:[ |
4197 |
4210 |
4198 cls := (Compiler evaluate:theCode asString notifying:codeView compile:false). |
4211 cls := (Compiler evaluate:theCode asString notifying:codeView compile:false). |
4199 cls isBehavior ifTrue:[ |
4212 cls isBehavior ifTrue:[ |
4200 codeView modified:false. |
4213 codeView modified:false. |
4201 self classCategoryUpdate. |
4214 self classCategoryUpdate. |
4202 self updateClassListWithScroll:false. |
4215 self updateClassListWithScroll:false. |
4203 cls isNamespace ifFalse:[ |
4216 cls isNamespace ifFalse:[ |
4204 self switchToClassNamed:(cls name). |
4217 self switchToClassNamed:(cls name). |
4205 ] |
4218 ] |
4206 ] |
4219 ] |
4207 ] |
4220 ] |
4208 ] |
4221 ] |
4209 ]. |
4222 ]. |
4210 codeView cursor:(Cursor normal). |
4223 codeView cursor:(Cursor normal). |
4211 ]. |
4224 ]. |
4212 codeView explainAction:nil. |
4225 codeView explainAction:nil. |
4213 self switchToClass:nil |
4226 self switchToClass:nil |
4214 |
4227 |
4215 "Created: 23.12.1996 / 12:45:43 / cg" |
4228 "Created: / 23.12.1996 / 12:45:43 / cg" |
4216 "Modified: 16.1.1997 / 01:46:39 / cg" |
4229 "Modified: / 31.3.1998 / 23:37:18 / cg" |
4217 ! |
4230 ! |
4218 |
4231 |
4219 classDoubleClick:lineNr |
4232 classDoubleClick:lineNr |
4220 "double click on a class; |
4233 "double click on a class; |
4221 if its unloaded, load it. |
4234 if its unloaded, load it. |
4354 |
4367 |
4355 classSelectionChanged |
4368 classSelectionChanged |
4356 |oldMethodCategory oldMethod oldSelector| |
4369 |oldMethodCategory oldMethod oldSelector| |
4357 |
4370 |
4358 self withBusyCursorDo:[ |
4371 self withBusyCursorDo:[ |
4359 "/ alien classes have no methodCategories; hide that list ... |
4372 "/ alien classes have no methodCategories; hide that list ... |
4360 |
4373 |
4361 currentClass notNil ifTrue:[ |
4374 currentClass notNil ifTrue:[ |
4362 currentClass supportsMethodCategories ifFalse:[ |
4375 currentClass supportsMethodCategories ifFalse:[ |
4363 self hideMethodCategoryList |
4376 self hideMethodCategoryList |
4364 ] ifTrue:[ |
4377 ] ifTrue:[ |
4365 self showMethodCategoryList |
4378 self showMethodCategoryList |
4366 ]. |
4379 ]. |
4367 ]. |
4380 ]. |
4368 |
4381 |
4369 aspect := #definition. |
4382 aspect := #definition. |
4370 |
4383 |
4371 oldMethodCategory := currentMethodCategory. |
4384 oldMethodCategory := currentMethodCategory. |
4372 oldMethod := currentMethod. |
4385 oldMethod := currentMethod. |
4373 oldSelector := currentSelector. |
4386 oldSelector := currentSelector. |
4374 |
4387 |
4375 showInstance ifTrue:[ |
4388 showInstance ifTrue:[ |
4376 actualClass := acceptClass := currentClass |
4389 actualClass := acceptClass := currentClass |
4377 ] ifFalse:[ |
4390 ] ifFalse:[ |
4378 actualClass := acceptClass := currentClass class |
4391 actualClass := acceptClass := currentClass class |
4379 ]. |
4392 ]. |
4380 currentMethodCategory := nil. |
4393 currentMethodCategory := nil. |
4381 currentMethod := nil. |
4394 currentMethod := nil. |
4382 currentSelector := nil. |
4395 currentSelector := nil. |
4383 |
4396 |
4384 self updateMethodCategoryList. |
4397 self updateMethodCategoryList. |
4385 |
4398 |
4386 oldMethodCategory notNil ifTrue:[ |
4399 oldMethodCategory notNil ifTrue:[ |
4387 methodCategoryListView setSelectElement:oldMethodCategory. |
4400 methodCategoryListView setSelectElement:oldMethodCategory. |
4388 methodCategoryListView hasSelection ifTrue:[ |
4401 methodCategoryListView hasSelection ifTrue:[ |
4389 currentMethodCategory := oldMethodCategory. |
4402 currentMethodCategory := oldMethodCategory. |
4390 self methodCategorySelectionChanged |
4403 self methodCategorySelectionChanged |
4391 ] |
4404 ] |
4392 ]. |
4405 ]. |
4393 self updateMethodList. |
4406 self updateMethodList. |
4394 "/ self updateCodeView. |
4407 "/ self updateCodeView. |
4395 self updateVariableList. |
4408 self updateVariableList. |
4396 |
4409 |
4397 fullClass ifTrue:[ |
4410 fullClass ifTrue:[ |
4398 self updateCodeView. |
4411 self updateCodeView. |
4399 codeView acceptAction:[:theCode | |
4412 codeView acceptAction:[:theCode | |
4400 codeView cursor:Cursor execute. |
4413 codeView cursor:Cursor execute. |
4401 Object abortSignal catch:[ |
4414 Object abortSignal catch:[ |
4402 self compileCode:theCode asString. |
4415 self compileCode:theCode asString. |
4403 codeView modified:false. |
4416 codeView modified:false. |
4404 ]. |
4417 codeModified := false. |
4405 codeView cursor:Cursor normal. |
4418 ]. |
4406 ]. |
4419 codeView cursor:Cursor normal. |
4407 ] ifFalse:[ |
4420 ]. |
|
4421 ] ifFalse:[ |
4408 "/ self classDefinition. |
4422 "/ self classDefinition. |
4409 self classListUpdate. |
4423 self classListUpdate. |
4410 |
4424 |
4411 codeView acceptAction:[:theCode | |
4425 codeView acceptAction:[:theCode | |
4412 |ns| |
4426 |ns| |
4413 |
4427 |
4414 currentClass notNil ifTrue:[ |
4428 currentClass notNil ifTrue:[ |
4415 ns := currentClass nameSpace |
4429 ns := currentClass nameSpace |
4416 ] ifFalse:[ |
4430 ] ifFalse:[ |
4417 ns := nil |
4431 ns := nil |
4418 ]. |
4432 ]. |
4419 |
4433 |
4420 codeView cursor:Cursor execute. |
4434 codeView cursor:Cursor execute. |
4421 |
4435 |
4422 Class nameSpaceQuerySignal handle:[:ex | |
4436 Class nameSpaceQuerySignal handle:[:ex | |
4423 ns isNil ifTrue:[ |
4437 ns isNil ifTrue:[ |
4424 ex reject |
4438 ex reject |
4425 ]. |
4439 ]. |
4426 ex proceedWith:ns |
4440 ex proceedWith:ns |
4427 ] do:[ |
4441 ] do:[ |
4428 Object abortSignal catch:[ |
4442 Object abortSignal catch:[ |
4429 UndefinedObject createMinimumProtocolInNewSubclassQuery |
4443 UndefinedObject createMinimumProtocolInNewSubclassQuery |
4430 answer:true |
4444 answer:true |
4431 do:[ |
4445 do:[ |
4432 (Compiler |
4446 (Compiler |
4433 evaluate:theCode asString |
4447 evaluate:theCode asString |
4434 notifying:codeView |
4448 notifying:codeView |
4435 compile:false) |
4449 compile:false) |
4436 isBehavior ifTrue:[ |
4450 isBehavior ifTrue:[ |
4437 self classCategoryUpdate. |
4451 self classCategoryUpdate. |
4438 self updateClassListWithScroll:false. |
4452 self updateClassListWithScroll:false. |
4439 codeView modified:false. |
4453 codeView modified:false. |
4440 ]. |
4454 codeModified := false. |
4441 ] |
4455 ]. |
4442 ]. |
4456 ] |
4443 ]. |
4457 ]. |
4444 codeView cursor:Cursor normal. |
4458 ]. |
4445 ]. |
4459 codeView cursor:Cursor normal. |
4446 ]. |
4460 ]. |
4447 codeView explainAction:nil. |
4461 ]. |
4448 |
4462 codeView explainAction:nil. |
4449 (classCategoryListView notNil and:[currentClass notNil]) ifTrue:[ |
4463 |
4450 (currentClassCategory = currentClass category) ifFalse:[ |
4464 (classCategoryListView notNil and:[currentClass notNil]) ifTrue:[ |
4451 currentClassCategory := currentClass category. |
4465 (currentClassCategory = currentClass category) ifFalse:[ |
4452 (classCategoryListView list includes:currentClassCategory) ifTrue:[ |
4466 currentClassCategory := currentClass category. |
4453 classCategoryListView setSelectElement:currentClassCategory |
4467 (classCategoryListView list includes:currentClassCategory) ifTrue:[ |
4454 ] ifFalse:[ |
4468 classCategoryListView setSelectElement:currentClassCategory |
4455 classCategoryListView setSelection:nil |
4469 ] ifFalse:[ |
4456 ] |
4470 classCategoryListView setSelection:nil |
4457 ] |
4471 ] |
4458 ]. |
4472 ] |
4459 |
4473 ]. |
4460 self setDoitActionForClass |
4474 |
|
4475 self setDoitActionForClass |
4461 ] |
4476 ] |
4462 |
4477 |
4463 "Created: 23.11.1995 / 11:32:03 / cg" |
4478 "Created: / 23.11.1995 / 11:32:03 / cg" |
4464 "Modified: 18.8.1997 / 15:43:49 / cg" |
4479 "Modified: / 31.3.1998 / 23:38:22 / cg" |
4465 ! |
4480 ! |
4466 |
4481 |
4467 classTemplateFor:aSuperClass in:categoryString namespace:isNameSpace private:isPrivate |
4482 classTemplateFor:aSuperClass in:categoryString namespace:isNameSpace private:isPrivate |
4468 "return a class definition template - be smart in what is offered initially" |
4483 "return a class definition template - be smart in what is offered initially" |
4469 |
4484 |
6803 "Modified: / 19.12.1997 / 12:27:42 / stefan" |
6818 "Modified: / 19.12.1997 / 12:27:42 / stefan" |
6804 ! |
6819 ! |
6805 |
6820 |
6806 copyMethodsFromClass:class category:category |
6821 copyMethodsFromClass:class category:category |
6807 currentClass notNil ifTrue:[ |
6822 currentClass notNil ifTrue:[ |
6808 Object abortSignal catch:[ |
6823 Object abortSignal catch:[ |
6809 class methodDictionary do:[:aMethod | |
6824 class methodDictionary do:[:aMethod | |
6810 |source| |
6825 |source| |
6811 |
6826 |
6812 (category match:aMethod category) ifTrue:[ |
6827 (category match:aMethod category) ifTrue:[ |
6813 source := aMethod source. |
6828 source := aMethod source. |
6814 codeView contents:source. |
6829 codeView contents:source. |
6815 codeView modified:false. |
6830 codeView modified:false. |
6816 actualClass compilerClass |
6831 codeModified := false. |
6817 compile:source |
6832 actualClass compilerClass |
6818 forClass:actualClass |
6833 compile:source |
6819 inCategory:aMethod category |
6834 forClass:actualClass |
6820 notifying:codeView. |
6835 inCategory:aMethod category |
6821 self updateMethodCategoryListWithScroll:false. |
6836 notifying:codeView. |
6822 self updateMethodListWithScroll:false. |
6837 self updateMethodCategoryListWithScroll:false. |
6823 ] |
6838 self updateMethodListWithScroll:false. |
6824 ] |
6839 ] |
6825 ] |
6840 ] |
|
6841 ] |
6826 ] |
6842 ] |
6827 |
6843 |
6828 "Modified: 7.6.1996 / 09:02:35 / stefan" |
6844 "Modified: / 7.6.1996 / 09:02:35 / stefan" |
|
6845 "Modified: / 31.3.1998 / 23:39:11 / cg" |
6829 ! |
6846 ! |
6830 |
6847 |
6831 listOfAllMethodCategoriesInClass:aClass |
6848 listOfAllMethodCategoriesInClass:aClass |
6832 "answer a list of all method categories of the argument, aClass" |
6849 "answer a list of all method categories of the argument, aClass" |
6833 |
6850 |
8852 |
8871 |
8853 !BrowserView methodsFor:'misc'! |
8872 !BrowserView methodsFor:'misc'! |
8854 |
8873 |
8855 codeChanged |
8874 codeChanged |
8856 codeView modified ifTrue:[ |
8875 codeView modified ifTrue:[ |
|
8876 codeModified := true. |
8857 codeView modified:false. |
8877 codeView modified:false. |
8858 self startSyntaxHighlightProcess. |
8878 self startSyntaxHighlightProcess. |
8859 ] |
8879 ] |
8860 |
8880 |
8861 "Created: / 31.3.1998 / 14:25:29 / cg" |
8881 "Created: / 31.3.1998 / 14:25:29 / cg" |
8862 "Modified: / 31.3.1998 / 19:03:49 / cg" |
8882 "Modified: / 31.3.1998 / 23:38:49 / cg" |
8863 ! |
8883 ! |
8864 |
8884 |
8865 instanceProtocol:aBoolean |
8885 instanceProtocol:aBoolean |
8866 "switch between instance and class protocol" |
8886 "switch between instance and class protocol" |
8867 |
8887 |
8868 |onToggle offToggle| |
8888 |onToggle offToggle| |
8869 |
8889 |
8870 showInstance ~~ aBoolean ifTrue:[ |
8890 showInstance ~~ aBoolean ifTrue:[ |
8871 self checkSelectionChangeAllowed ifTrue:[ |
8891 self checkSelectionChangeAllowed ifTrue:[ |
8872 instanceToggle notNil ifTrue:[ |
8892 instanceToggle notNil ifTrue:[ |
8873 aBoolean ifTrue:[ |
8893 aBoolean ifTrue:[ |
8874 offToggle := classToggle. |
8894 offToggle := classToggle. |
8875 onToggle := instanceToggle. |
8895 onToggle := instanceToggle. |
8876 ] ifFalse:[ |
8896 ] ifFalse:[ |
8877 onToggle := classToggle. |
8897 onToggle := classToggle. |
8878 offToggle := instanceToggle. |
8898 offToggle := instanceToggle. |
8879 ]. |
8899 ]. |
8880 onToggle turnOn. |
8900 onToggle turnOn. |
8881 offToggle turnOff. |
8901 offToggle turnOff. |
8882 ]. |
8902 ]. |
8883 showInstance := aBoolean. |
8903 showInstance := aBoolean. |
8884 |
8904 |
8885 (variableListView notNil |
8905 (variableListView notNil |
8886 and:[variableListView hasSelection]) ifTrue:[ |
8906 and:[variableListView hasSelection]) ifTrue:[ |
8887 self unhilightMethodCategories. |
8907 self unhilightMethodCategories. |
8888 self unhilightMethods. |
8908 self unhilightMethods. |
8889 variableListView setSelection:nil |
8909 variableListView setSelection:nil |
8890 ]. |
8910 ]. |
8891 |
8911 |
8892 fullProtocol ifTrue:[ |
8912 fullProtocol ifTrue:[ |
8893 showInstance ifTrue:[ |
8913 showInstance ifTrue:[ |
8894 actualClass := currentClassHierarchy. |
8914 actualClass := currentClassHierarchy. |
8895 ] ifFalse:[ |
8915 ] ifFalse:[ |
8896 actualClass := currentClassHierarchy class. |
8916 actualClass := currentClassHierarchy class. |
8897 ]. |
8917 ]. |
8898 acceptClass := actualClass. |
8918 acceptClass := actualClass. |
8899 |
8919 |
8900 self updateClassList. |
8920 self updateClassList. |
8901 self updateMethodCategoryListWithScroll:false. |
8921 self updateMethodCategoryListWithScroll:false. |
8902 self updateMethodListWithScroll:false. |
8922 self updateMethodListWithScroll:false. |
8903 self updateVariableList. |
8923 self updateVariableList. |
8904 ^ self |
8924 ^ self |
8905 ]. |
8925 ]. |
8906 currentClass notNil ifTrue:[ |
8926 currentClass notNil ifTrue:[ |
8907 self classSelectionChanged |
8927 self classSelectionChanged |
8908 ]. |
8928 ]. |
8909 codeView modified:false. |
8929 codeView modified:false. |
8910 ] ifFalse:[ |
8930 codeModified := false. |
8911 aBoolean ifTrue:[ |
8931 ] ifFalse:[ |
8912 onToggle := classToggle. |
8932 aBoolean ifTrue:[ |
8913 offToggle := instanceToggle |
8933 onToggle := classToggle. |
8914 ] ifFalse:[ |
8934 offToggle := instanceToggle |
8915 offToggle := classToggle. |
8935 ] ifFalse:[ |
8916 onToggle := instanceToggle. |
8936 offToggle := classToggle. |
8917 ]. |
8937 onToggle := instanceToggle. |
8918 onToggle turnOn. |
8938 ]. |
8919 offToggle turnOff. |
8939 onToggle turnOn. |
8920 ] |
8940 offToggle turnOff. |
|
8941 ] |
8921 ] |
8942 ] |
8922 |
8943 |
8923 "Modified: 25.5.1996 / 13:02:41 / cg" |
8944 "Modified: / 31.3.1998 / 23:40:04 / cg" |
8924 ! |
8945 ! |
8925 |
8946 |
8926 processName |
8947 processName |
8927 "the name of my process - for the processMonitor only" |
8948 "the name of my process - for the processMonitor only" |
8928 |
8949 |
8953 currentMethod isNil ifTrue:[^ self]. |
8974 currentMethod isNil ifTrue:[^ self]. |
8954 |
8975 |
8955 oldCodeList := codeView list. |
8976 oldCodeList := codeView list. |
8956 |
8977 |
8957 coloringProcess := [ |
8978 coloringProcess := [ |
8958 |oldCode oldEmp code cls selStartLine selStartCol selEndLine selEndCol| |
8979 |oldCode oldEmp code cls| |
8959 |
8980 |
8960 oldCode := oldCodeList asString. |
8981 oldCode := oldCodeList asString. |
8961 oldEmp := oldCode emphasis. |
8982 oldEmp := oldCode emphasis. |
8962 code := oldCode string. |
8983 code := oldCode string. |
8963 cls := actualClass. |
8984 cls := actualClass. |
8964 |
8985 |
8965 "/ Transcript showCR:'-------1|'; show:oldCode; showCR:'|'. |
|
8966 code := SyntaxHighlighter formatMethod:code in:cls. |
8986 code := SyntaxHighlighter formatMethod:code in:cls. |
8967 "/ Transcript showCR:'-------2|'; show:code; showCR:'|'. |
|
8968 code emphasis ~= oldEmp ifTrue:[ |
8987 code emphasis ~= oldEmp ifTrue:[ |
8969 Processor activeProcess withPriority:(Processor activePriority + 2) do:[ |
8988 Processor activeProcess withPriority:(Processor activePriority + 2) do:[ |
8970 selStartLine := codeView selectionStartLine. |
|
8971 selStartCol := codeView selectionStartCol. |
|
8972 selEndLine := codeView selectionEndLine. |
|
8973 selEndCol := codeView selectionEndCol. |
|
8974 codeView setContents:code. |
8989 codeView setContents:code. |
8975 selStartLine notNil ifTrue:[ |
|
8976 codeView selectFromLine:selStartLine col:selStartCol |
|
8977 toLine:selEndLine col:selEndCol |
|
8978 ] |
|
8979 ]. |
8990 ]. |
8980 ]. |
8991 ]. |
8981 coloringProcess := nil. |
8992 coloringProcess := nil. |
8982 ] forkAt:(Processor userBackgroundPriority). |
8993 ] forkAt:(Processor userBackgroundPriority). |
8983 |
8994 |
8984 "Created: / 31.3.1998 / 14:25:29 / cg" |
8995 "Created: / 31.3.1998 / 14:25:29 / cg" |
8985 "Modified: / 31.3.1998 / 19:03:12 / cg" |
8996 "Modified: / 31.3.1998 / 23:31:51 / cg" |
8986 ! |
8997 ! |
8987 |
8998 |
8988 updateCodeView |
8999 updateCodeView |
8989 |code sourceLineNumber doStartSyntax| |
9000 |code sourceLineNumber doStartSyntax| |
8990 |
9001 |
9668 ]. |
9683 ]. |
9669 |
9684 |
9670 ^ self checkSelectionChangeAllowedWithCompare:false |
9685 ^ self checkSelectionChangeAllowedWithCompare:false |
9671 |
9686 |
9672 "Created: / 24.11.1995 / 11:03:33 / cg" |
9687 "Created: / 24.11.1995 / 11:03:33 / cg" |
9673 "Modified: / 28.1.1998 / 00:24:15 / cg" |
9688 "Modified: / 31.3.1998 / 23:36:36 / cg" |
9674 ! |
9689 ! |
9675 |
9690 |
9676 checkSelectionChangeAllowedWithCompare:compareOffered |
9691 checkSelectionChangeAllowedWithCompare:compareOffered |
9677 "return true, if selection change is ok; |
9692 "return true, if selection change is ok; |
9678 its not ok, if code has been changed. |
9693 its not ok, if code has been changed. |
9679 in this case, return the result of a user query" |
9694 in this case, return the result of a user query" |
9680 |
9695 |
9681 |action labels values| |
9696 |action labels values| |
9682 |
9697 |
9683 codeView modified ifFalse:[ |
9698 codeView modified ifFalse:[ |
9684 ^ true |
9699 codeModified ifFalse:[ |
|
9700 ^ true |
|
9701 ] |
9685 ]. |
9702 ]. |
9686 |
9703 |
9687 compareOffered ifTrue:[ |
9704 compareOffered ifTrue:[ |
9688 labels := #('cancel' 'compare' 'accept' 'continue'). |
9705 labels := #('cancel' 'compare' 'accept' 'continue'). |
9689 values := #(false #compare #accept true). |
9706 values := #(false #compare #accept true). |
9690 ] ifFalse:[ |
9707 ] ifFalse:[ |
9691 labels := #('cancel' 'accept' 'continue'). |
9708 labels := #('cancel' 'accept' 'continue'). |
9692 values := #(false #accept true). |
9709 values := #(false #accept true). |
9693 ]. |
9710 ]. |
9694 |
9711 |
9695 action := OptionBox |
9712 action := OptionBox |
9696 request:(resources at:'text has not been accepted.\\Your modifications will be lost when continuing.') withCRs |
9713 request:(resources at:'text has not been accepted.\\Your modifications will be lost when continuing.') withCRs |
9697 label:(resources string:'Attention') |
9714 label:(resources string:'Attention') |
9698 form:(WarningBox iconBitmap) |
9715 form:(WarningBox iconBitmap) |
9699 buttonLabels:(resources array:labels) |
9716 buttonLabels:(resources array:labels) |
9700 values:values |
9717 values:values |
9701 default:true. |
9718 default:true. |
9702 action ~~ #accept ifTrue:[ |
9719 action ~~ #accept ifTrue:[ |
9703 ^ action |
9720 ^ action |
9704 ]. |
9721 ]. |
9705 codeView accept. |
9722 codeView accept. |
9706 ^ true |
9723 ^ true |
9707 |
9724 |
9708 "Created: 24.11.1995 / 10:54:46 / cg" |
9725 "Created: / 24.11.1995 / 10:54:46 / cg" |
9709 "Modified: 20.2.1996 / 20:47:51 / cg" |
9726 "Modified: / 31.3.1998 / 23:36:55 / cg" |
9710 ! |
9727 ! |
9711 |
9728 |
9712 classHierarchyOf:aClass level:level do:aBlock using:subclassDictionary removeFrom:remainSet |
9729 classHierarchyOf:aClass level:level do:aBlock using:subclassDictionary removeFrom:remainSet |
9713 "evaluate the 2-arg block for every subclass of aClass, |
9730 "evaluate the 2-arg block for every subclass of aClass, |
9714 passing class and nesting level to the block." |
9731 passing class and nesting level to the block." |