916 enabled: hasSingleChangeSelectedAndCanBrowse: |
916 enabled: hasSingleChangeSelectedAndCanBrowse: |
917 label: 'Browse Class(s)' |
917 label: 'Browse Class(s)' |
918 itemValue: changeMenuBrowseClass: |
918 itemValue: changeMenuBrowseClass: |
919 translateLabel: true |
919 translateLabel: true |
920 ) |
920 ) |
|
921 (MenuItem |
|
922 label: '-' |
|
923 ) |
|
924 (MenuItem |
|
925 enabled: hasSingleChangeSelectedAndCanBrowse: |
|
926 label: 'Compare Class Against...' |
|
927 itemValue: changeMenuCompareClass: |
|
928 translateLabel: true |
|
929 ) |
921 ) |
930 ) |
922 nil |
931 nil |
923 nil |
932 nil |
924 ) |
933 ) |
|
934 |
|
935 "Modified: / 01-12-2011 / 18:36:15 / cg" |
925 ! |
936 ! |
926 |
937 |
927 changeMenu2 |
938 changeMenu2 |
928 "This resource specification was automatically generated |
939 "This resource specification was automatically generated |
929 by the MenuEditor of ST/X." |
940 by the MenuEditor of ST/X." |
1922 UserPreferences current systemBrowserClass |
1933 UserPreferences current systemBrowserClass |
1923 browseClasses:classes title:'selected monticello classes'. |
1934 browseClasses:classes title:'selected monticello classes'. |
1924 |
1935 |
1925 "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1936 "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1926 "Created: / 05-09-2011 / 16:08:35 / cg" |
1937 "Created: / 05-09-2011 / 16:08:35 / cg" |
|
1938 ! |
|
1939 |
|
1940 changeMenuCompareClass: changeList |
|
1941 |changes classNames classNameToClassMapping lastNameSpace |
|
1942 addClassName addThemChanges existingClasses |
|
1943 allChanges changeSet1 changeSet2 diffSet| |
|
1944 |
|
1945 changeList == list1 ifTrue:[ |
|
1946 changes := selection1Holder value. |
|
1947 ] ifFalse:[ |
|
1948 changes := selection2Holder value. |
|
1949 ]. |
|
1950 changes := changes collect:[:eachListEntry | eachListEntry change]. |
|
1951 |
|
1952 classNameToClassMapping := Dictionary new. |
|
1953 classNames := Set new. |
|
1954 allChanges := ChangeSet new. |
|
1955 existingClasses := Set new. |
|
1956 |
|
1957 addClassName := |
|
1958 [:nmArg | |
|
1959 |nm ns existingClass goodAnswer| |
|
1960 |
|
1961 nm := nmArg. |
|
1962 existingClass := Smalltalk classNamed:nm. |
|
1963 |
|
1964 existingClass notNil ifTrue:[ |
|
1965 goodAnswer := nm |
|
1966 ] ifFalse:[ |
|
1967 ns := NameSpace allNameSpaces |
|
1968 detect:[:ns | (ns classNamed:nm) notNil ] |
|
1969 ifNone:nil. |
|
1970 ns notNil ifTrue:[ |
|
1971 goodAnswer := (ns classNamed:nm) name. |
|
1972 ] ifFalse:[ |
|
1973 goodAnswer := nm. |
|
1974 (lastNameSpace notNil |
|
1975 and:[ lastNameSpace isNamespace |
|
1976 and:[(lastNameSpace classNamed:nm) notNil ]] |
|
1977 ) ifTrue:[ |
|
1978 goodAnswer := (lastNameSpace classNamed:nm) name. |
|
1979 ] ifFalse:[ |
|
1980 (lastNameSpace notNil |
|
1981 and:[ lastNameSpace isBehavior |
|
1982 and:[(lastNameSpace privateClassesAt:nm asSymbol) notNil ]] |
|
1983 ) ifTrue:[ |
|
1984 goodAnswer := (lastNameSpace privateClassesAt:nm asSymbol) name. |
|
1985 ] |
|
1986 ]. |
|
1987 ]. |
|
1988 ]. |
|
1989 nm := Dialog |
|
1990 request:('Class to compare for "%1"?' bindWith:nmArg) |
|
1991 initialAnswer:goodAnswer. |
|
1992 nm isNil ifTrue:[^ self]. |
|
1993 nm notEmpty ifTrue:[ |
|
1994 existingClass := Smalltalk at:nm asSymbol. |
|
1995 ]. |
|
1996 existingClass notNil ifTrue:[ |
|
1997 classNameToClassMapping at:nmArg put:existingClass. |
|
1998 existingClasses add:existingClass. |
|
1999 ]. |
|
2000 classNames add:nmArg |
|
2001 ]. |
|
2002 |
|
2003 addThemChanges := [:changes | |
|
2004 "/ collect classes and mappings |
|
2005 changes do:[:c | |
|
2006 c isClassDefinitionChange ifTrue:[ |
|
2007 addClassName value:(c className). |
|
2008 allChanges add:c. |
|
2009 ]]. |
|
2010 |
|
2011 changes do:[:c | |
|
2012 c isMethodChange ifTrue:[ |
|
2013 (classNames includes:(c className)) ifFalse:[ |
|
2014 addClassName value:(c className). |
|
2015 ]. |
|
2016 allChanges add:c. |
|
2017 ]]. |
|
2018 |
|
2019 changes do:[:c | |
|
2020 c isCompositeChange ifTrue:[ |
|
2021 addThemChanges value:(c changes) |
|
2022 ]. |
|
2023 ]. |
|
2024 ]. |
|
2025 |
|
2026 changes do:addThemChanges. |
|
2027 |
|
2028 "/ now, build a diffset and present it... |
|
2029 changeSet1 := allChanges. |
|
2030 changeSet2 := ChangeSet new. |
|
2031 existingClasses do:[:cls | |
|
2032 changeSet2 addAll:(ChangeSet forExistingClass:cls). |
|
2033 ]. |
|
2034 diffSet := changeSet1 diffSetsAgainst:changeSet2. |
|
2035 |
|
2036 (UserPreferences versionDiffViewerClass) |
|
2037 openOnDiffSet:diffSet |
|
2038 labelA:'Monticello' |
|
2039 labelB:'Current (In Image)' |
|
2040 title:'Diffs' |
|
2041 ignoreExtensions:false. |
|
2042 |
|
2043 "Created: / 04-08-2011 / 17:27:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2044 "Created: / 01-12-2011 / 18:36:44 / cg" |
1927 ! |
2045 ! |
1928 |
2046 |
1929 changeMenuDeleteSelection: changeList |
2047 changeMenuDeleteSelection: changeList |
1930 |
2048 |
1931 self selectionDo:[:chg|chg removed: true] |
2049 self selectionDo:[:chg|chg removed: true] |