ChangesBrowser.st
branchjv
changeset 12254 b1237f76f501
parent 12229 5c129972b1fd
child 12287 400a99059170
equal deleted inserted replaced
12253:6d3eedcdb4c1 12254:b1237f76f501
  1613     "Modified: / 03-01-2012 / 15:23:13 / cg"
  1613     "Modified: / 03-01-2012 / 15:23:13 / cg"
  1614 ! !
  1614 ! !
  1615 
  1615 
  1616 !ChangesBrowser methodsFor:'menu actions'!
  1616 !ChangesBrowser methodsFor:'menu actions'!
  1617 
  1617 
       
  1618 doApply
       
  1619     "user wants a change to be applied"
       
  1620 
       
  1621     self withSelectedChangesDo:[:changeNr |
       
  1622         (self applyChange:changeNr) ifFalse:[
       
  1623             ^ self "/ cancel
       
  1624         ].
       
  1625         self autoSelect:(changeNr + 1)
       
  1626     ]
       
  1627 !
       
  1628 
       
  1629 doApplyAll
       
  1630     "user wants all changes to be applied"
       
  1631 
       
  1632     self withExecuteCursorDo:[
       
  1633         |lastNr "{ Class: SmallInteger }" |
       
  1634 
       
  1635         self clearCodeView.
       
  1636         lastNr := self numberOfChanges.
       
  1637 
       
  1638         "if we apply multiple changes, and an error occurs,
       
  1639          ask the user if all operations should be aborted..."
       
  1640         multipleApply := lastNr > 1.
       
  1641 
       
  1642         1 to:lastNr do:[:changeNr |
       
  1643             changeListView setSelection:changeNr.
       
  1644             self applyChange:changeNr
       
  1645         ].
       
  1646         self autoSelectLast
       
  1647     ]
       
  1648 
       
  1649     "Modified: 21.1.1997 / 22:26:30 / cg"
       
  1650 !
       
  1651 
       
  1652 doApplyClassFromBeginning
       
  1653     "user wants all changes for this class from 1 to changeNr to be applied"
       
  1654 
       
  1655     self withSingleSelectedChangeDo:[:changeNr |
       
  1656         |thisClassName classNameToApply lastChange
       
  1657          lastNr "{ Class: SmallInteger }" |
       
  1658 
       
  1659         classNameToApply := self classNameOfChange:changeNr.
       
  1660         classNameToApply notNil ifTrue:[
       
  1661             self clearCodeView.
       
  1662 
       
  1663             "if we apply multiple changes, and an error occurs,
       
  1664              ask the user if all operations should be aborted..."
       
  1665             multipleApply := changeNr ~= 1.
       
  1666 
       
  1667             1 to:changeNr do:[:changeNr |
       
  1668                 thisClassName := self classNameOfChange:changeNr.
       
  1669                 thisClassName = classNameToApply ifTrue:[
       
  1670                     changeListView setSelection:changeNr.
       
  1671                     self applyChange:changeNr.
       
  1672                     lastChange := changeNr
       
  1673                 ].
       
  1674             ].
       
  1675             self autoSelect:changeNr+1.
       
  1676         ]
       
  1677     ]
       
  1678 
       
  1679     "Modified: 21.1.1997 / 22:26:04 / cg"
       
  1680 !
       
  1681 
       
  1682 doApplyClassRest
       
  1683     "user wants all changes for this class from changeNr to be applied"
       
  1684 
       
  1685     self withSingleSelectedChangeDo:[:changeNr |
       
  1686         |thisClassName classNameToApply lastChange
       
  1687          lastNr "{ Class: SmallInteger }" |
       
  1688 
       
  1689         classNameToApply := self classNameOfChange:changeNr.
       
  1690         classNameToApply notNil ifTrue:[
       
  1691             self clearCodeView.
       
  1692 
       
  1693             lastNr := self numberOfChanges.
       
  1694 
       
  1695             "if we apply multiple changes, and an error occurs,
       
  1696              ask the user if all operations should be aborted..."
       
  1697             multipleApply := (lastNr - changeNr) > 1.
       
  1698 
       
  1699             changeNr to:lastNr do:[:changeNr |
       
  1700                 thisClassName := self classNameOfChange:changeNr.
       
  1701                 thisClassName = classNameToApply ifTrue:[
       
  1702                     changeListView setSelection:changeNr.
       
  1703                     self applyChange:changeNr.
       
  1704                     lastChange := changeNr
       
  1705                 ].
       
  1706             ].
       
  1707             self autoSelect:lastChange.
       
  1708         ]
       
  1709     ]
       
  1710 
       
  1711     "Modified: 21.1.1997 / 22:26:04 / cg"
       
  1712 !
       
  1713 
       
  1714 doApplyFromBeginning
       
  1715     "user wants all changes from 1 to changeNr to be applied"
       
  1716 
       
  1717     self withSingleSelectedChangeDo:[:changeNr |
       
  1718         |lastNr "{ Class: SmallInteger }" |
       
  1719 
       
  1720         self clearCodeView.
       
  1721 
       
  1722         "if we apply multiple changes, and an error occurs,
       
  1723          ask the user if all operations should be aborted..."
       
  1724         multipleApply := changeNr ~= 1.
       
  1725 
       
  1726         1 to:changeNr do:[:changeNr |
       
  1727             changeListView setSelection:changeNr.
       
  1728             self applyChange:changeNr
       
  1729         ].
       
  1730         self autoSelect:changeNr+1.
       
  1731     ]
       
  1732 !
       
  1733 
       
  1734 doApplyRest
       
  1735     "apply all changes from changeNr to the end"
       
  1736 
       
  1737     self withSingleSelectedChangeDo:[:changeNr |
       
  1738         |lastNr "{ Class: SmallInteger }" |
       
  1739 
       
  1740         self clearCodeView.
       
  1741 
       
  1742         lastNr := self numberOfChanges.
       
  1743 
       
  1744         "if we apply multiple changes, and an error occurs,
       
  1745          ask the user if all operations should be aborted..."
       
  1746         multipleApply := (lastNr - changeNr) > 1.
       
  1747 
       
  1748         changeNr to:lastNr do:[:changeNr |
       
  1749             changeListView setSelection:changeNr.
       
  1750             self applyChange:changeNr
       
  1751         ].
       
  1752         self autoSelect:self numberOfChanges.
       
  1753     ]
       
  1754 
       
  1755     "Modified: 21.1.1997 / 22:25:29 / cg"
       
  1756 !
       
  1757 
       
  1758 doApplyToConflictOrEnd
       
  1759     "apply all changes from changeNr to either a conflict (i.e. method exists)
       
  1760      or the end."
       
  1761 
       
  1762     self withSingleSelectedChangeDo:[:changeNr |
       
  1763         |lastNr "{ Class: SmallInteger }"|
       
  1764 
       
  1765         self clearCodeView.
       
  1766 
       
  1767         lastNr := self numberOfChanges.
       
  1768 
       
  1769         "if we apply multiple changes, and an error occurs,
       
  1770          ask the user if all operations should be aborted..."
       
  1771         multipleApply := (lastNr - changeNr) > 1.
       
  1772 
       
  1773         changeNr to:lastNr do:[:changeNr |
       
  1774             | cls sel |
       
  1775             changeListView setSelection:changeNr.
       
  1776 
       
  1777             ((cls := self classOfChange:changeNr ifAbsent:[:className| nil]) notNil
       
  1778             and:[(sel := self selectorOfMethodChange:changeNr) notNil])
       
  1779             ifTrue:[
       
  1780                 (cls includesSelector:sel) ifTrue:[
       
  1781                     self autoSelect:changeNr.
       
  1782                     ^ self
       
  1783                 ].
       
  1784             ].
       
  1785             self applyChange:changeNr
       
  1786         ].
       
  1787         self autoSelect:self numberOfChanges.
       
  1788     ]
       
  1789 !
       
  1790 
       
  1791 doBrowse
       
  1792     "user wants a browser on the class of a change"
       
  1793 
       
  1794     self withSingleSelectedChangeDo:[:changeNr |
       
  1795 	|cls|
       
  1796 
       
  1797 	cls := self classOfChange:changeNr.
       
  1798 	cls notNil ifTrue:[
       
  1799 	    UserPreferences systemBrowserClass
       
  1800 		openInClass:cls
       
  1801 		selector:(self selectorOfMethodChange:changeNr)
       
  1802 	]
       
  1803     ]
       
  1804 !
       
  1805 
       
  1806 doBrowseImplementors
       
  1807     "open an implementors-browser"
       
  1808 
       
  1809     |changeNr initial selector|
       
  1810 
       
  1811     (changeNr := self theSingleSelection) notNil ifTrue:[
       
  1812 	initial := self selectorOfMethodChange:changeNr.
       
  1813     ].
       
  1814 
       
  1815     selector := Dialog
       
  1816 		    request:'Selector to browse implementors of:'
       
  1817 		    initialAnswer:(initial ? '').
       
  1818     selector size ~~ 0 ifTrue:[
       
  1819 	UserPreferences systemBrowserClass
       
  1820 	    browseImplementorsMatching:selector.
       
  1821     ]
       
  1822 !
       
  1823 
       
  1824 doBrowseSenders
       
  1825     "user wants a browser on the class of a change"
       
  1826 
       
  1827     |changeNr initial selector|
       
  1828 
       
  1829     (changeNr := self theSingleSelection) notNil ifTrue:[
       
  1830 	initial := self selectorOfMethodChange:changeNr.
       
  1831     ].
       
  1832 
       
  1833     selector := Dialog
       
  1834 		    request:'Selector to browse senders of:'
       
  1835 		    initialAnswer:(initial ? '').
       
  1836     selector size ~~ 0 ifTrue:[
       
  1837 	UserPreferences systemBrowserClass
       
  1838 	    browseAllCallsOn:selector asSymbol.
       
  1839     ]
       
  1840 !
       
  1841 
       
  1842 doCheckinAndDeleteClassAll
       
  1843     "first checkin the selected changes class then delete all changes
       
  1844      for it."
       
  1845 
       
  1846     |classes answer logTitle checkinInfo|
       
  1847 
       
  1848 "/    self theSingleSelection isNil ifTrue:[
       
  1849 "/        ^ self information:'Only possible if a single change is selected.'.
       
  1850 "/    ].
       
  1851 
       
  1852     self withExecuteCursorDo:[
       
  1853         classes := IdentitySet new.
       
  1854 
       
  1855         self withSelectedChangesDo:[:changeNr |
       
  1856             | className class |
       
  1857 
       
  1858             className := self classNameOfChange:changeNr.
       
  1859             className notNil ifTrue:[
       
  1860                 class := Smalltalk classNamed:className.
       
  1861                 class isNil ifTrue:[
       
  1862                     self error:'oops - no class: ', className mayProceed:true.
       
  1863                 ].
       
  1864                 class notNil ifTrue:[
       
  1865                     class := class theNonMetaclass.
       
  1866                     (classes includes:class) ifFalse:[
       
  1867                         class isPrivate ifTrue:[
       
  1868                             (classes includes:class owningClass) ifFalse:[
       
  1869                                 answer := self confirmWithCancel:('This is a private class.\\CheckIn the owner ''%1'' and all of its private classes ?'
       
  1870                                                                     bindWith:class owningClass name allBold) withCRs.
       
  1871                                 answer isNil ifTrue:[^ self].
       
  1872                                 answer ifTrue:[
       
  1873                                     classes add:class owningClass
       
  1874                                 ]
       
  1875                             ]
       
  1876                         ] ifFalse:[
       
  1877                             classes add:class
       
  1878                         ].
       
  1879                     ]
       
  1880                 ]
       
  1881             ]
       
  1882         ].
       
  1883 
       
  1884         classes size == 1 ifTrue:[
       
  1885             logTitle := classes first name.
       
  1886         ] ifFalse:[
       
  1887             logTitle := '%1 classes' bindWith:classes size.
       
  1888         ].
       
  1889         checkinInfo := SourceCodeManagerUtilities default
       
  1890                         getCheckinInfoFor:logTitle
       
  1891                         initialAnswer:nil.
       
  1892         checkinInfo isNil ifTrue:[^ self ].
       
  1893 
       
  1894         changeListView setSelection:nil.
       
  1895         classes do:[:eachClass |
       
  1896             (SourceCodeManagerUtilities default checkinClass:eachClass withInfo:checkinInfo)
       
  1897                 ifTrue:[
       
  1898                     self silentDeleteChangesForClassAndPrivateClasses:eachClass name
       
  1899                            from:1 to:(self numberOfChanges).
       
  1900                 ]
       
  1901         ].
       
  1902         self setChangeList.
       
  1903     ]
       
  1904 
       
  1905     "Modified: / 6.9.1995 / 17:11:16 / claus"
       
  1906     "Modified: / 17.11.2001 / 14:21:13 / cg"
       
  1907 !
       
  1908 
       
  1909 doCompare
       
  1910     "compare change with current system version"
       
  1911 
       
  1912     classesNotToBeAutoloaded removeAll.
       
  1913 
       
  1914     self withSingleSelectedChangeDo:[:changeNr |
       
  1915         self withExecuteCursorDo:[
       
  1916             self compareChange:changeNr
       
  1917         ].
       
  1918         self newLabel:''
       
  1919     ].
       
  1920 
       
  1921     "Modified: 24.2.1996 / 19:37:19 / cg"
       
  1922 !
       
  1923 
       
  1924 doCompareAndCompress
       
  1925     "remove all changes, which are equivalent to the current image version"
       
  1926 
       
  1927     |toDelete|
       
  1928 
       
  1929     classesNotToBeAutoloaded removeAll.
       
  1930     toDelete := OrderedCollection new.
       
  1931     self withExecuteCursorDo:[
       
  1932         1 to:self numberOfChanges do:[:changeNr |
       
  1933             (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  1934                 toDelete add:changeNr
       
  1935             ]
       
  1936         ].
       
  1937     ].
       
  1938 
       
  1939     toDelete reverseDo:[:changeNr |
       
  1940         self silentDeleteChange:changeNr.
       
  1941     ].
       
  1942     self setChangeList.
       
  1943     "
       
  1944      scroll back a bit, if we are left way behind the list
       
  1945     "
       
  1946     changeListView firstLineShown > self numberOfChanges ifTrue:[
       
  1947         changeListView makeLineVisible:self numberOfChanges
       
  1948     ].
       
  1949     self clearCodeView.
       
  1950 
       
  1951     self newLabel:''.
       
  1952     classesNotToBeAutoloaded removeAll.
       
  1953 !
       
  1954 
       
  1955 doCompress
       
  1956     "compress the change-set; this replaces multiple method-changes by the last
       
  1957      (i.e. the most recent) change"
       
  1958 
       
  1959     self compressForClass:nil
       
  1960 
       
  1961     "Modified: / 29.10.1997 / 01:03:26 / cg"
       
  1962 !
       
  1963 
       
  1964 doCompressClass
       
  1965     "compress changes for the selected class.
       
  1966      this replaces multiple method-changes by the last (i.e. the most recent) change."
       
  1967 
       
  1968     self theSingleSelection isNil ifTrue:[
       
  1969 	^ self information:'Only possible if a single change is selected.'.
       
  1970     ].
       
  1971 
       
  1972     self selectedClassNames do:[:classNameToCompress |
       
  1973 	self compressForClass:classNameToCompress.
       
  1974     ]
       
  1975 
       
  1976     "Created: / 29.10.1997 / 01:05:16 / cg"
       
  1977     "Modified: / 19.11.2001 / 21:55:17 / cg"
       
  1978 !
       
  1979 
       
  1980 doCompressSelector
       
  1981     "compress changes for the selected class & selector.
       
  1982      this replaces multiple method-changes by the last (i.e. the most recent) change."
       
  1983 
       
  1984     |classSelectorPairs|
       
  1985 
       
  1986     self theSingleSelection isNil ifTrue:[
       
  1987 	^ self information:'Only possible if a single change is selected.'.
       
  1988     ].
       
  1989 
       
  1990     classSelectorPairs := Set new.
       
  1991     self withSelectedChangesDo:[:changeNr |
       
  1992 	| classNameToCompress selector |
       
  1993 
       
  1994 	classNameToCompress := self classNameOfChange:changeNr.
       
  1995 	classNameToCompress notNil ifTrue:[
       
  1996 	    selector := self selectorOfMethodChange:changeNr.
       
  1997 	    selector notNil ifTrue:[
       
  1998 		classSelectorPairs add:(classNameToCompress -> selector).
       
  1999 	    ]
       
  2000 	]
       
  2001     ].
       
  2002 
       
  2003     classSelectorPairs do:[:pair |
       
  2004 	self compressForClass:pair key selector:pair value.
       
  2005     ]
       
  2006 
       
  2007     "Created: / 19.11.2001 / 21:50:59 / cg"
       
  2008     "Modified: / 19.11.2001 / 22:10:08 / cg"
       
  2009 !
       
  2010 
       
  2011 doDelete
       
  2012     "delete currently selected change(s)"
       
  2013 
       
  2014     |rangeEnd rangeStart firstDeleted|
       
  2015 
       
  2016     changeListView selection size <= 5 ifTrue:[
       
  2017 	self withSelectedChangesReverseDo:[:changeNr |
       
  2018 	    self deleteChange:changeNr.
       
  2019 	    self autoSelectOrEnd:changeNr
       
  2020 	].
       
  2021 	^ self
       
  2022     ].
       
  2023 
       
  2024     self withSelectedChangesReverseDo:[:changeNr |
       
  2025 	rangeEnd isNil ifTrue:[
       
  2026 	    rangeEnd := rangeStart := changeNr
       
  2027 	] ifFalse:[
       
  2028 	    (changeNr = (rangeEnd + 1)) ifTrue:[
       
  2029 		rangeEnd := changeNr
       
  2030 	    ] ifFalse:[
       
  2031 		(changeNr = (rangeStart - 1)) ifTrue:[
       
  2032 		    rangeStart := changeNr
       
  2033 		] ifFalse:[
       
  2034 		    self deleteChangesFrom:rangeStart to:rangeEnd.
       
  2035 		    firstDeleted := (firstDeleted ? rangeStart) min:rangeStart.
       
  2036 		    rangeStart := rangeEnd := nil.
       
  2037 		].
       
  2038 	    ].
       
  2039 	].
       
  2040     ].
       
  2041     rangeStart notNil ifTrue:[
       
  2042 	self deleteChangesFrom:rangeStart to:rangeEnd.
       
  2043 	firstDeleted := (firstDeleted ? rangeStart) min:rangeStart.
       
  2044     ].
       
  2045     self autoSelectOrEnd:firstDeleted
       
  2046 !
       
  2047 
       
  2048 doDeleteAndSelectPrevious
       
  2049     "delete currently selected change(s)"
       
  2050 
       
  2051     self withSelectedChangesReverseDo:[:changeNr |
       
  2052 	self deleteChange:changeNr.
       
  2053 	self autoSelectOrEnd:changeNr-1
       
  2054     ]
       
  2055 !
       
  2056 
       
  2057 doDeleteClassAll
       
  2058     "delete all changes with same class as currently selected change"
       
  2059 
       
  2060     |classNamesToDelete lastChangeNr overAllNumDeletedBefore|
       
  2061 
       
  2062     lastChangeNr := -1.
       
  2063     classNamesToDelete := Set new.
       
  2064     self withSelectedChangesDo:[:changeNr |
       
  2065 	|classNameToDelete|
       
  2066 
       
  2067 	classNameToDelete := self classNameOfChange:changeNr.
       
  2068 	classNameToDelete notNil ifTrue:[
       
  2069 	    classNamesToDelete add:classNameToDelete.
       
  2070 	].
       
  2071 	lastChangeNr := lastChangeNr max:changeNr.
       
  2072     ].
       
  2073 
       
  2074     overAllNumDeletedBefore := 0.
       
  2075     changeListView setSelection:nil.
       
  2076 
       
  2077     self withExecuteCursorDo:[
       
  2078 	classNamesToDelete do:[:classNameToDelete |
       
  2079 	    |numDeletedBefore|
       
  2080 
       
  2081 	    self silentDeleteChangesFor:classNameToDelete
       
  2082 				   from:lastChangeNr
       
  2083 				     to:(self numberOfChanges).
       
  2084 	    numDeletedBefore := self
       
  2085 				   silentDeleteChangesFor:classNameToDelete
       
  2086 				   from:1
       
  2087 				   to:(lastChangeNr-1).
       
  2088 	    lastChangeNr := lastChangeNr - numDeletedBefore.
       
  2089 	    overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  2090 	].
       
  2091     ].
       
  2092 
       
  2093     self setChangeList.
       
  2094     self autoSelectOrEnd:lastChangeNr
       
  2095 
       
  2096     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  2097     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  2098 !
       
  2099 
       
  2100 doDeleteClassAndPrivateClassesAll
       
  2101     "delete all changes with same class and private classes
       
  2102      as currently selected change"
       
  2103 
       
  2104     |lastChangeNr classNamesToDelete overAllNumDeletedBefore|
       
  2105 
       
  2106     lastChangeNr := -1.
       
  2107     classNamesToDelete := Set new.
       
  2108     self withSelectedChangesDo:[:changeNr |
       
  2109 	|classNameToDelete|
       
  2110 
       
  2111 	classNameToDelete := self ownerClassNameOfChange:changeNr.
       
  2112 	classNameToDelete notNil ifTrue:[
       
  2113 	    classNamesToDelete add:classNameToDelete.
       
  2114 	].
       
  2115 	lastChangeNr := lastChangeNr max:changeNr.
       
  2116     ].
       
  2117 
       
  2118     overAllNumDeletedBefore := 0.
       
  2119     changeListView setSelection:nil.
       
  2120 
       
  2121     self withExecuteCursorDo:[
       
  2122 	classNamesToDelete do:[:classNameToDelete |
       
  2123 	    | changeNr numDeletedBefore|
       
  2124 
       
  2125 	    classNameToDelete notNil ifTrue:[
       
  2126 		changeListView setSelection:nil.
       
  2127 		self silentDeleteChangesForClassAndPrivateClasses:classNameToDelete
       
  2128 				       from:lastChangeNr
       
  2129 					 to:(self numberOfChanges).
       
  2130 		numDeletedBefore := self
       
  2131 				       silentDeleteChangesForClassAndPrivateClasses:classNameToDelete
       
  2132 				       from:1
       
  2133 				       to:(lastChangeNr-1).
       
  2134 		lastChangeNr := lastChangeNr - numDeletedBefore.
       
  2135 		overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  2136 	    ]
       
  2137 	]
       
  2138     ].
       
  2139     self setChangeList.
       
  2140     self autoSelectOrEnd:lastChangeNr
       
  2141 
       
  2142     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  2143     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  2144 !
       
  2145 
       
  2146 doDeleteClassFromBeginning
       
  2147     "delete changes with same class as currently selected change from the beginning
       
  2148      up to the selected change.
       
  2149      Useful to get rid of obsolete changes before a fileout or checkin entry."
       
  2150 
       
  2151     self withSingleSelectedChangeDo:[:changeNr |
       
  2152 	|classNameToDelete prevSelection numDeleted|
       
  2153 
       
  2154 	classNameToDelete := self classNameOfChange:changeNr.
       
  2155 	classNameToDelete notNil ifTrue:[
       
  2156 	    prevSelection := changeNr.
       
  2157 	    changeListView setSelection:nil.
       
  2158 	    numDeleted := self
       
  2159 				silentDeleteChangesFor:classNameToDelete
       
  2160 				from:1
       
  2161 				to:changeNr.
       
  2162 	    self setChangeList.
       
  2163 	    self autoSelectOrEnd:(changeNr + 1 - numDeleted)
       
  2164 	]
       
  2165     ].
       
  2166 
       
  2167     "Created: 13.12.1995 / 15:41:58 / cg"
       
  2168     "Modified: 25.5.1996 / 12:26:34 / cg"
       
  2169 !
       
  2170 
       
  2171 doDeleteClassRest
       
  2172     "delete rest of changes with same class as currently selected change"
       
  2173 
       
  2174     self withSingleSelectedChangeDo:[:changeNr |
       
  2175 	| classNameToDelete |
       
  2176 
       
  2177 	classNameToDelete := self classNameOfChange:changeNr.
       
  2178 	classNameToDelete notNil ifTrue:[
       
  2179 	    changeListView setSelection:nil.
       
  2180 	    self silentDeleteChangesFor:classNameToDelete
       
  2181 				   from:changeNr
       
  2182 				     to:(self numberOfChanges).
       
  2183 	    self setChangeList.
       
  2184 	    self autoSelectOrEnd:changeNr
       
  2185 	]
       
  2186     ]
       
  2187 
       
  2188     "Modified: / 18.5.1998 / 14:25:07 / cg"
       
  2189 !
       
  2190 
       
  2191 doDeleteClassSelectorAll
       
  2192     "delete all changes with same class and selector as currently selected change"
       
  2193 
       
  2194     |classNameSelectorPairsToDelete lastChangeNr overAllNumDeletedBefore|
       
  2195 
       
  2196     lastChangeNr := -1.
       
  2197     classNameSelectorPairsToDelete := Set new.
       
  2198     self withSelectedChangesDo:[:changeNr |
       
  2199 	|className selector|
       
  2200 
       
  2201 	className := self classNameOfChange:changeNr.
       
  2202 	selector := self selectorOfMethodChange:changeNr.
       
  2203 	selector notNil ifTrue:[
       
  2204 	    (className notNil and:[selector notNil]) ifTrue:[
       
  2205 		classNameSelectorPairsToDelete add:(className -> selector).
       
  2206 	    ]
       
  2207 	].
       
  2208 	lastChangeNr := lastChangeNr max:changeNr.
       
  2209     ].
       
  2210 
       
  2211     overAllNumDeletedBefore := 0.
       
  2212     changeListView setSelection:nil.
       
  2213 
       
  2214     self withExecuteCursorDo:[
       
  2215 	classNameSelectorPairsToDelete do:[:pair |
       
  2216 	    |numDeletedBefore className selector|
       
  2217 
       
  2218 	    className := pair key.
       
  2219 	    selector  := pair value.
       
  2220 	    self silentDeleteChangesFor:className selector:selector
       
  2221 				   from:lastChangeNr
       
  2222 				     to:(self numberOfChanges).
       
  2223 	    numDeletedBefore := self
       
  2224 				   silentDeleteChangesFor:className selector:selector
       
  2225 				   from:1
       
  2226 				   to:(lastChangeNr-1).
       
  2227 	    lastChangeNr := lastChangeNr - numDeletedBefore.
       
  2228 	    overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  2229 	].
       
  2230     ].
       
  2231 
       
  2232     self setChangeList.
       
  2233     self autoSelectOrEnd:lastChangeNr
       
  2234 
       
  2235     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  2236     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  2237 !
       
  2238 
       
  2239 doDeleteFromBeginning
       
  2240     "delete all changes from 1 to the current"
       
  2241 
       
  2242     self withSingleSelectedChangeDo:[:changeNr |
       
  2243 	self deleteChangesFrom:1 to:changeNr.
       
  2244 	self clearCodeView.
       
  2245 	self autoSelectOrEnd:changeNr
       
  2246     ]
       
  2247 !
       
  2248 
       
  2249 doDeleteRest
       
  2250     "delete all changes from current to the end"
       
  2251 
       
  2252     self withSingleSelectedChangeDo:[:changeNr |
       
  2253 	self deleteChangesFrom:changeNr to:(self numberOfChanges).
       
  2254 	self clearCodeView.
       
  2255 	self autoSelectOrEnd:changeNr-1
       
  2256     ]
       
  2257 !
       
  2258 
       
  2259 doFileoutAndDeleteClassAll
       
  2260     "first fileOut the selected changes class then delete all changes
       
  2261      for it."
       
  2262 
       
  2263     self withSingleSelectedChangeDo:[:changeNr |
       
  2264 	| className class |
       
  2265 
       
  2266 	className := self classNameOfChange:changeNr.
       
  2267 	className notNil ifTrue:[
       
  2268 	    class := Smalltalk classNamed:className.
       
  2269 	    class notNil ifTrue:[
       
  2270 		Class fileOutErrorSignal handle:[:ex |
       
  2271 		    self warn:('fileout failed: ' , ex description).
       
  2272 		] do:[
       
  2273 		    class fileOut.
       
  2274 		    self doDeleteClassAll
       
  2275 		].
       
  2276 	    ].
       
  2277 
       
  2278 	].
       
  2279     ]
       
  2280 
       
  2281     "Modified: 6.9.1995 / 17:11:16 / claus"
       
  2282 !
       
  2283 
       
  2284 doMakePatch
       
  2285     "user wants a change to be made a patch
       
  2286      - copy it over to the patches file"
       
  2287 
       
  2288     self withSelectedChangesDo:[:changeNr |
       
  2289 	self makeChangeAPatch:changeNr.
       
  2290 	self autoSelect:(changeNr + 1)
       
  2291     ]
       
  2292 !
       
  2293 
       
  2294 doMakePermanent
       
  2295     "user wants a change to be made permanent
       
  2296      - rewrite the source file where this change has to go"
       
  2297 
       
  2298     |yesNoBox|
       
  2299 
       
  2300     (self theSingleSelection) isNil ifTrue:[
       
  2301         ^ self information:'Only possible if a single change is selected.'.
       
  2302     ].
       
  2303 
       
  2304     yesNoBox := YesNoBox new.
       
  2305     yesNoBox title:(resources string:'Warning: this operation cannot be undone').
       
  2306     yesNoBox okText:(resources string:'continue') noText:(resources string:'abort').
       
  2307     yesNoBox okAction:[   |changeNr|
       
  2308 
       
  2309                           changeNr := self theSingleSelection.
       
  2310                           changeNr notNil ifTrue:[
       
  2311                               self makeChangePermanent:changeNr.
       
  2312                               self autoSelect:(changeNr + 1)
       
  2313                           ]
       
  2314                       ].
       
  2315     yesNoBox showAtPointer.
       
  2316     yesNoBox destroy
       
  2317 
       
  2318     "Modified: 7.1.1997 / 23:03:33 / cg"
       
  2319 !
       
  2320 
       
  2321 doSave
       
  2322     "user wants a change to be appended to a file"
       
  2323 
       
  2324     |fileName|
       
  2325 
       
  2326     self withSelectedChangesDo:[:changeNr |
       
  2327         fileName := Dialog
       
  2328                         requestFileNameForSave:(resources string:'Append change to:')
       
  2329                         default:(lastSaveFileName ? '')
       
  2330                         ok:(resources string:'Append')
       
  2331                         abort:(resources string:'Abort')
       
  2332                         pattern:'*.chg'.
       
  2333 
       
  2334         fileName notNil ifTrue:[
       
  2335             lastSaveFileName := fileName.
       
  2336             self withCursor:(Cursor write) do:[
       
  2337                 self appendChange:changeNr toFile:fileName.
       
  2338             ].
       
  2339             self autoSelect:(changeNr + 1)
       
  2340         ].
       
  2341     ]
       
  2342 
       
  2343     "Modified: / 27-10-2010 / 11:30:07 / cg"
       
  2344 !
       
  2345 
       
  2346 doSaveClass
       
  2347     "user wants changes for some class from current to end to be appended to a file"
       
  2348 
       
  2349     (self theSingleSelection) isNil ifTrue:[
       
  2350 	^ self information:'Only possible if a single change is selected.'.
       
  2351     ].
       
  2352     self doSaveClassFrom:1
       
  2353 !
       
  2354 
       
  2355 doSaveClassAll
       
  2356     "user wants changes for some class from current to end to be appended to a file"
       
  2357 
       
  2358     (self theSingleSelection) isNil ifTrue:[
       
  2359 	^ self information:'Only possible if a single change is selected.'.
       
  2360     ].
       
  2361     self doSaveClassFrom:1
       
  2362 !
       
  2363 
       
  2364 doSaveClassFrom:startNr
       
  2365     "user wants changes from current to end to be appended to a file"
       
  2366 
       
  2367     |changeNr classNameToSave|
       
  2368 
       
  2369     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  2370 	^ self information:'Only possible if a single change is selected.'.
       
  2371     ].
       
  2372     classNameToSave := self classNameOfChange:changeNr.
       
  2373     classNameToSave notNil ifTrue:[
       
  2374 	self saveClass:classNameToSave from:startNr
       
  2375     ]
       
  2376 !
       
  2377 
       
  2378 doSaveClassRest
       
  2379     "user wants changes for some class from current to end to be appended to a file"
       
  2380 
       
  2381     |changeNr|
       
  2382 
       
  2383     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  2384         ^ self information:'Only possible if a single change is selected.'.
       
  2385     ].
       
  2386     self doSaveClassFrom:changeNr.
       
  2387 
       
  2388     changeListView setSelection:changeNr.
       
  2389     "/ self changeSelection:changeNr.
       
  2390 !
       
  2391 
       
  2392 doSaveRest
       
  2393     "user wants changes from current to end to be appended to a file"
       
  2394 
       
  2395     |changeNr fileName|
       
  2396 
       
  2397     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  2398         ^ self information:(resources string:'Only possible if a single change is selected.').
       
  2399     ].
       
  2400 
       
  2401     fileName := Dialog
       
  2402                     requestFileNameForSave:(resources string:'Append changes to:')
       
  2403                     default:(lastSaveFileName ? '')
       
  2404                     ok:(resources string:'Append')
       
  2405                     abort:(resources string:'Abort')
       
  2406                     pattern:'*.chg'.
       
  2407 
       
  2408     fileName notNil ifTrue:[
       
  2409         lastSaveFileName := fileName.
       
  2410         self withCursor:(Cursor write) do:[
       
  2411             changeNr to:(self numberOfChanges) do:[:changeNr |
       
  2412                 changeListView setSelection:changeNr.
       
  2413                 (self appendChange:changeNr toFile:fileName) ifFalse:[
       
  2414                     ^ self
       
  2415                 ]
       
  2416             ]
       
  2417         ]
       
  2418     ]
       
  2419 
       
  2420     "Modified: / 27-10-2010 / 11:30:37 / cg"
       
  2421 !
       
  2422 
       
  2423 doUpdate
       
  2424     "reread the changes-file"
       
  2425 
       
  2426     self readChangesFileInBackground:true.
       
  2427     self newLabel:''.
       
  2428     realized ifTrue:[
       
  2429 	self setChangeList.
       
  2430     ]
       
  2431 !
       
  2432 
       
  2433 doWriteBack
       
  2434     "write back the list onto the changes file"
       
  2435 
       
  2436     anyChanges ifTrue:[
       
  2437         (self writeBackChanges) ifTrue:[
       
  2438             realized ifTrue:[
       
  2439                 self readChangesFile.
       
  2440                 realized ifTrue:[
       
  2441                     self setChangeList
       
  2442                 ]
       
  2443             ]
       
  2444         ]
       
  2445     ]
       
  2446 
       
  2447     "Modified: 5.9.1996 / 17:19:46 / cg"
       
  2448 !
       
  2449 
       
  2450 findClass
       
  2451     "findClass menu action: let user enter a classes name, and select the next change for that class"
       
  2452 
       
  2453     |current|
       
  2454 
       
  2455     changeNrShown notNil ifTrue:[
       
  2456         current := self classNameOfChange:changeNrShown.
       
  2457     ].
       
  2458 
       
  2459     self
       
  2460         askForSearch:'Class to search for:'
       
  2461         initialAnswer:current
       
  2462         thenSearchUsing:[:searchString :changeNr |
       
  2463                             |thisClassName|
       
  2464 
       
  2465                             thisClassName := self classNameOfChange:changeNr.
       
  2466                             thisClassName notNil
       
  2467                             and:[
       
  2468                                 (thisClassName sameAs: searchString)
       
  2469                                 or:[searchString includesMatchCharacters and:[searchString match:thisClassName ignoreCase:true]]]
       
  2470                         ]
       
  2471         onCancel:[^ self].
       
  2472 
       
  2473     lastSearchType := #class.
       
  2474     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  2475 !
       
  2476 
       
  2477 findFirstForClass
       
  2478     "findNextForClass menu action: select the next change for the selected changes class"
       
  2479 
       
  2480     self findNextForClassStartingAt:1
       
  2481 
       
  2482     "Created: / 20-11-2006 / 16:37:56 / cg"
       
  2483 !
       
  2484 
       
  2485 findLastForClass
       
  2486     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  2487 
       
  2488     self findPreviousForClassStartingAt:(self numberOfChanges)
       
  2489 
       
  2490     "Created: / 20-11-2006 / 16:39:15 / cg"
       
  2491 !
       
  2492 
       
  2493 findLastSnapshot
       
  2494     "findLastSnapshot menu action: select the last change which is for a snapShot-image save action"
       
  2495 
       
  2496     "/ lastSearchType := #snapshot.
       
  2497 
       
  2498     self 
       
  2499         findPreviousForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  2500         startingAt:(self numberOfChanges)
       
  2501 
       
  2502     "Created: / 06-10-2006 / 11:03:39 / cg"
       
  2503 !
       
  2504 
       
  2505 findNext
       
  2506     "findNext menu action: select the next change.
       
  2507      Searches for what the last search was for; i.e. either same class or same selector"
       
  2508 
       
  2509     lastSearchType == #selector ifTrue:[
       
  2510 	^ self findNextForSelector
       
  2511     ].
       
  2512     lastSearchType == #snapshot ifTrue:[
       
  2513 	^ self findNextSnapshot
       
  2514     ].
       
  2515     lastSearchType == #string ifTrue:[
       
  2516 	^ self findNextForString
       
  2517     ].
       
  2518     lastSearchType == #difference ifTrue:[
       
  2519 	^ self findNextDifference
       
  2520     ].
       
  2521 
       
  2522     ^ self findNextForClass
       
  2523 
       
  2524     "Created: / 18.6.1998 / 22:15:00 / cg"
       
  2525     "Modified: / 18.6.1998 / 22:15:25 / cg"
       
  2526 !
       
  2527 
       
  2528 findNextDifference
       
  2529     lastSearchType := #difference.
       
  2530     changeNrShown isNil ifTrue:[^ self].
       
  2531 
       
  2532     self findNextForWhich:[:changeNr |
       
  2533 	    (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  2534 		"/ same
       
  2535 		false
       
  2536 	    ] ifFalse:[
       
  2537 		"/ different
       
  2538 		true
       
  2539 	    ]
       
  2540 	]
       
  2541 !
       
  2542 
       
  2543 findNextForClass
       
  2544     "findNextForClass menu action: select the next change for the selected changes class"
       
  2545 
       
  2546     self findNextForClassStartingAt: changeNrShown + 1
       
  2547 
       
  2548     "Modified: / 20-11-2006 / 16:37:49 / cg"
       
  2549 !
       
  2550 
       
  2551 findNextForClassStartingAt:startNr
       
  2552     "findNextForClass menu action: select the next change for the selected changes class"
       
  2553 
       
  2554     |cls|
       
  2555 
       
  2556     lastSearchType := #class.
       
  2557     changeNrShown isNil ifTrue:[^ self].
       
  2558 
       
  2559     cls := self classNameOfChange:changeNrShown.
       
  2560     cls isNil ifTrue:[^ self].
       
  2561 
       
  2562     self 
       
  2563         findNextForWhich:[:changeNr |
       
  2564                 |thisClass|
       
  2565 
       
  2566                 thisClass := self classNameOfChange:changeNr.
       
  2567                 (thisClass = cls
       
  2568                 or:[cls includesMatchCharacters and:[cls match:thisClass]])]
       
  2569         startingAt:startNr
       
  2570 
       
  2571     "Created: / 20-11-2006 / 16:37:37 / cg"
       
  2572 !
       
  2573 
       
  2574 findNextForSelector
       
  2575     "findNextForSelector menu action: select the next change for the selected changes selector"
       
  2576 
       
  2577     |sel|
       
  2578 
       
  2579     lastSearchType := #selector.
       
  2580     changeNrShown isNil ifTrue:[^ self].
       
  2581 
       
  2582     sel := self selectorOfMethodChange:changeNrShown.
       
  2583     sel isNil ifTrue:[^ self].
       
  2584 
       
  2585     self findNextForWhich: [:changeNr |
       
  2586 		|thisSelector|
       
  2587 
       
  2588 		thisSelector := self selectorOfMethodChange:changeNr.
       
  2589 		(thisSelector = sel or:[sel includesMatchCharacters and:[sel match:thisSelector]])
       
  2590 	]
       
  2591 
       
  2592 !
       
  2593 
       
  2594 findNextForString
       
  2595     lastSearchString isNil ifTrue:[
       
  2596 	^ self findString
       
  2597     ].
       
  2598     self findNextWithString:lastSearchString
       
  2599 !
       
  2600 
       
  2601 findNextForWhich:aBlock
       
  2602     "helper: select the next change for which aBlock evaluates to true"
       
  2603 
       
  2604     ^ self findNextForWhich:aBlock startingAt:changeNrShown + 1
       
  2605 
       
  2606     "Modified: / 20-11-2006 / 16:34:23 / cg"
       
  2607 !
       
  2608 
       
  2609 findNextForWhich:aBlock startingAt:changeNrToStartSearch
       
  2610     "helper: select the next change for which aBlock evaluates to true"
       
  2611 
       
  2612     ^ self     
       
  2613         findNextOrPrevious:#next 
       
  2614         forWhich:aBlock startingAt:changeNrToStartSearch
       
  2615 
       
  2616     "Created: / 20-11-2006 / 16:34:06 / cg"
       
  2617 !
       
  2618 
       
  2619 findNextOrPrevious:direction forWhich:aBlock startingAt:changeNrToStartSearch
       
  2620     "helper: find and select the next or previous change for which aBlock evaluates to true"
       
  2621 
       
  2622     self withCursor:Cursor questionMark do:[
       
  2623         Object userInterruptSignal handle:[:ex |
       
  2624             self beep.
       
  2625             ^ 0
       
  2626         ] do:[
       
  2627             |increment nr lastNr|
       
  2628 
       
  2629             increment := (direction == #previous) ifTrue:[-1] ifFalse:[1].
       
  2630             lastNr := self numberOfChanges.
       
  2631             nr := changeNrToStartSearch.
       
  2632             [ (direction == #previous and:[nr >= 1])
       
  2633               or:[ direction == #next and:[ nr <= lastNr]] 
       
  2634             ] whileTrue:[
       
  2635                 (aBlock value:nr) ifTrue:[
       
  2636                     changeListView setSelection:nr.
       
  2637                     self changeSelection:nr.
       
  2638                     ^ nr
       
  2639                 ].
       
  2640                 nr := nr + increment.
       
  2641             ].
       
  2642         ]
       
  2643     ].
       
  2644     self showNotFound.
       
  2645     self windowGroup sensor flushKeyboard. "/ avoid multiple beeps, in case of type ahead
       
  2646     ^ 0
       
  2647 
       
  2648     "Created: / 08-03-2012 / 11:57:26 / cg"
       
  2649 !
       
  2650 
       
  2651 findNextSnapshot
       
  2652     "findNextSnapshot menu action: select the next change which is for a snapShot-image save action"
       
  2653 
       
  2654     lastSearchType := #snapshot.
       
  2655     changeNrShown isNil ifTrue:[^ self].
       
  2656 
       
  2657     self findNextForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  2658 !
       
  2659 
       
  2660 findNextWithString:searchString
       
  2661     lastSearchType := #string.
       
  2662 
       
  2663     lastSearchString := searchString.
       
  2664 
       
  2665     changeNrShown isNil ifTrue:[
       
  2666 	changeNrShown := 0.
       
  2667     ].
       
  2668 
       
  2669     self findNextForWhich:
       
  2670 	[:changeNr |
       
  2671 	    |s|
       
  2672 
       
  2673 	    s := self sourceOfMethodChange:changeNr.
       
  2674 	    s notNil and:[
       
  2675 		(searchString includesMatchCharacters not
       
  2676 			    and:[(s findString:searchString) ~~ 0])
       
  2677 		or:[ searchString includesMatchCharacters
       
  2678 			    and:[('*' , searchString , '*') match:s ]]]
       
  2679 	].
       
  2680 
       
  2681     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  2682 
       
  2683     codeView setSearchPattern:searchString.
       
  2684     codeView
       
  2685 	searchFwd:searchString
       
  2686 	ignoreCase:false
       
  2687 	startingAtLine:1 col:0
       
  2688 	ifAbsent:nil.
       
  2689 
       
  2690 !
       
  2691 
       
  2692 findPrevious
       
  2693     "findPrevious menu action: select the previous change.
       
  2694      Searches for what the last search was for; i.e. either same class or same selector"
       
  2695 
       
  2696     lastSearchType == #selector ifTrue:[
       
  2697 	^ self findPreviousForSelector
       
  2698     ].
       
  2699     lastSearchType == #snapshot ifTrue:[
       
  2700 	^ self findPreviousSnapshot
       
  2701     ].
       
  2702     lastSearchType == #string ifTrue:[
       
  2703 	^ self findPreviousForString
       
  2704     ].
       
  2705     lastSearchType == #difference ifTrue:[
       
  2706 	^ self findPreviousDifference
       
  2707     ].
       
  2708 
       
  2709     ^ self findPreviousForClass
       
  2710 
       
  2711     "Created: / 18.6.1998 / 22:15:15 / cg"
       
  2712 !
       
  2713 
       
  2714 findPreviousDifference
       
  2715     lastSearchType := #difference.
       
  2716     changeNrShown isNil ifTrue:[^ self].
       
  2717 
       
  2718     self findPreviousForWhich:[:changeNr |
       
  2719 	    (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  2720 		"/ same
       
  2721 		false
       
  2722 	    ] ifFalse:[
       
  2723 		"/ different
       
  2724 		true
       
  2725 	    ]
       
  2726 	]
       
  2727 !
       
  2728 
       
  2729 findPreviousForClass
       
  2730     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  2731 
       
  2732     self findPreviousForClassStartingAt:(changeNrShown - 1)
       
  2733 
       
  2734     "Modified: / 20-11-2006 / 16:39:04 / cg"
       
  2735 !
       
  2736 
       
  2737 findPreviousForClassStartingAt:startNr
       
  2738     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  2739 
       
  2740     |cls|
       
  2741 
       
  2742     lastSearchType := #class.
       
  2743     changeNrShown isNil ifTrue:[^ self].
       
  2744 
       
  2745     cls := self classNameOfChange:changeNrShown.
       
  2746     cls isNil ifTrue:[^ self].
       
  2747 
       
  2748     self 
       
  2749         findPreviousForWhich:
       
  2750             [:changeNr |
       
  2751                     |thisClass|
       
  2752 
       
  2753                     thisClass := self classNameOfChange:changeNr.
       
  2754                     (thisClass = cls
       
  2755                     or:[cls includesMatchCharacters and:[cls match:thisClass]])]
       
  2756         startingAt:startNr
       
  2757 
       
  2758     "Created: / 20-11-2006 / 16:38:37 / cg"
       
  2759 !
       
  2760 
       
  2761 findPreviousForSelector
       
  2762     "findPreviousForSelector menu action: select the previous change for the selected changes selector"
       
  2763 
       
  2764     |sel|
       
  2765 
       
  2766     lastSearchType := #selector.
       
  2767     changeNrShown isNil ifTrue:[^ self].
       
  2768 
       
  2769     sel := self selectorOfMethodChange:changeNrShown.
       
  2770     sel isNil ifTrue:[^ self].
       
  2771 
       
  2772     self findPreviousForWhich:
       
  2773 	[:changeNr |
       
  2774 		|thisSelector|
       
  2775 
       
  2776 		thisSelector := self selectorOfMethodChange:changeNr.
       
  2777 		(thisSelector = sel
       
  2778 		or:[sel includesMatchCharacters and:[sel match:thisSelector]])
       
  2779 	]
       
  2780 
       
  2781 !
       
  2782 
       
  2783 findPreviousForString
       
  2784     lastSearchString isNil ifTrue:[
       
  2785 	^ self findString
       
  2786     ].
       
  2787     self findPreviousWithString:lastSearchString
       
  2788 !
       
  2789 
       
  2790 findPreviousForWhich:aBlock
       
  2791     "helper: select the previous change for which aBlock evaluates to true"
       
  2792 
       
  2793     ^ self findPreviousForWhich:aBlock startingAt:(changeNrShown - 1)
       
  2794 
       
  2795     "Modified: / 06-10-2006 / 11:01:38 / cg"
       
  2796 !
       
  2797 
       
  2798 findPreviousForWhich:aBlock startingAt:changeNrToStartSearch
       
  2799     "helper: select the previous change for which aBlock evaluates to true"
       
  2800 
       
  2801     ^ self     
       
  2802         findNextOrPrevious:#previous 
       
  2803         forWhich:aBlock startingAt:changeNrToStartSearch
       
  2804 
       
  2805     "Created: / 06-10-2006 / 11:01:09 / cg"
       
  2806 !
       
  2807 
       
  2808 findPreviousSnapshot
       
  2809     "findPreviousSnapshot menu action: select the previous change which is for a snapShot-image save action"
       
  2810 
       
  2811     lastSearchType := #snapshot.
       
  2812     changeNrShown isNil ifTrue:[^ self].
       
  2813 
       
  2814     self findPreviousForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  2815 !
       
  2816 
       
  2817 findPreviousWithString:searchString
       
  2818     lastSearchType := #string.
       
  2819 
       
  2820     lastSearchString := searchString.
       
  2821 
       
  2822     changeNrShown isNil ifTrue:[
       
  2823 	changeNrShown := 0.
       
  2824     ].
       
  2825 
       
  2826     self findPreviousForWhich:
       
  2827 	[:changeNr |
       
  2828 	    |s includesMatchCharacters|
       
  2829 
       
  2830 	    includesMatchCharacters := searchString includesMatchCharacters.
       
  2831 	    s := self sourceOfMethodChange:changeNr.
       
  2832 	    s notNil and:[
       
  2833 		(includesMatchCharacters not and:[(s findString:searchString) ~~ 0])
       
  2834 		or:[includesMatchCharacters and:[('*' , searchString , '*') match:s ]]]
       
  2835 	].
       
  2836 
       
  2837     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  2838 
       
  2839     codeView setSearchPattern:searchString.
       
  2840     codeView
       
  2841 	searchFwd:searchString
       
  2842 	ignoreCase:false
       
  2843 	startingAtLine:1 col:0
       
  2844 	ifAbsent:nil.
       
  2845 
       
  2846 !
       
  2847 
       
  2848 findSelector
       
  2849     "findSelector menu action: let user enter a selector, and select the next change for that selector"
       
  2850 
       
  2851     |current|
       
  2852 
       
  2853     changeNrShown notNil ifTrue:[
       
  2854 	current := self selectorOfMethodChange:changeNrShown.
       
  2855     ].
       
  2856 
       
  2857     self
       
  2858 	askForSearch:'Selector to search for:'
       
  2859 	initialAnswer:current
       
  2860 	thenSearchUsing:[:searchString :changeNr |
       
  2861 			    |thisSelector|
       
  2862 
       
  2863 			    thisSelector := self selectorOfMethodChange:changeNr.
       
  2864 			    (thisSelector = searchString
       
  2865 			    or:[searchString includesMatchCharacters and:[searchString match:thisSelector]])
       
  2866 			]
       
  2867 	onCancel:[^ self].
       
  2868 
       
  2869     lastSearchType := #selector.
       
  2870     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  2871 !
       
  2872 
       
  2873 findString
       
  2874     |searchString directionHolder|
       
  2875 
       
  2876     lastSearchType := #string.
       
  2877 
       
  2878     searchString := codeView selection.
       
  2879     searchString size == 0 ifTrue:[searchString := lastSearchString].
       
  2880 
       
  2881     searchString := self
       
  2882 	askForSearchString:'String to search for:'
       
  2883 	initialAnswer:(searchString ? '')
       
  2884 	directionInto:(directionHolder := ValueHolder new).
       
  2885 
       
  2886     searchString size == 0 ifTrue:[
       
  2887 	^ self
       
  2888     ].
       
  2889 
       
  2890     directionHolder value == #backward ifTrue:[
       
  2891 	self findPreviousWithString:searchString.
       
  2892     ] ifFalse:[
       
  2893 	self findNextWithString:searchString.
       
  2894     ]
       
  2895 !
       
  2896 
  1618 ignorePublicPrivateCategories:aBoolean
  2897 ignorePublicPrivateCategories:aBoolean
  1619     UserPreferences current ignorePublicPrivateCategories:aBoolean
  2898     UserPreferences current ignorePublicPrivateCategories:aBoolean
  1620 
  2899 
  1621     "Created: / 23-09-2011 / 19:52:21 / cg"
  2900     "Created: / 23-09-2011 / 19:52:21 / cg"
  1622 !
  2901 !
  1655     "/ settingsApp requestor:self.
  2934     "/ settingsApp requestor:self.
  1656     settingsApp installSettingsEntries:settingsList.
  2935     settingsApp installSettingsEntries:settingsList.
  1657     settingsApp allButOpen.
  2936     settingsApp allButOpen.
  1658     settingsApp window label:('Debugger Settings').
  2937     settingsApp window label:('Debugger Settings').
  1659     settingsApp openWindow.
  2938     settingsApp openWindow.
       
  2939 !
       
  2940 
       
  2941 setEnforcedNameSpace
       
  2942     |nsName listOfKnownNameSpaces keepAsDefaultHolder|
       
  2943 
       
  2944     listOfKnownNameSpaces := Set new.
       
  2945     NameSpace
       
  2946         allNameSpaces
       
  2947             do:[:eachNameSpace |
       
  2948                 listOfKnownNameSpaces add:eachNameSpace name
       
  2949             ].
       
  2950     listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort.
       
  2951 
       
  2952     Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
       
  2953         |box|
       
  2954 
       
  2955         keepAsDefaultHolder := true asValue.
       
  2956         box := ex parameter.
       
  2957         box verticalPanel
       
  2958             add:((CheckBox 
       
  2959                     label:(resources string:'Use this as default in the future')) 
       
  2960                     model:keepAsDefaultHolder).
       
  2961         ex proceed.
       
  2962     ] do:[
       
  2963         nsName := Dialog
       
  2964                 request:'When applying, new classes are created in nameSpace:'
       
  2965                 initialAnswer:(enforcedNameSpace ? LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name)
       
  2966                 list:listOfKnownNameSpaces.
       
  2967     ].
       
  2968     nsName isNil ifTrue:[^ self].
       
  2969 
       
  2970     (nsName isEmpty or:[nsName = 'Smalltalk']) ifTrue:[
       
  2971         applyInOriginalNameSpace value:true.
       
  2972         LastEnforcedNameSpace := enforcedNameSpace := nil.
       
  2973     ] ifFalse:[
       
  2974         applyInOriginalNameSpace value:false.
       
  2975         LastEnforcedNameSpace := enforcedNameSpace := NameSpace name:nsName.
       
  2976         autoCompare value ifTrue:[
       
  2977             self doUpdate
       
  2978         ].
       
  2979     ].
       
  2980     KeepEnforcedNameSpace := keepAsDefaultHolder value.
       
  2981     codeView namespaceForDoits:enforcedNameSpace.
       
  2982     diffView textViews do:[:each | each namespaceForDoits:enforcedNameSpace].
       
  2983 
       
  2984     "Modified: / 08-05-2012 / 14:04:19 / cg"
       
  2985 !
       
  2986 
       
  2987 setEnforcedPackage
       
  2988     |pkg listOfKnownPackages|
       
  2989 
       
  2990     listOfKnownPackages := Set new.
       
  2991     Smalltalk allClassesDo:[:eachClass |
       
  2992 				|package|
       
  2993 
       
  2994 				package := eachClass package.
       
  2995 				package size > 0 ifTrue:[
       
  2996 				    listOfKnownPackages add:package
       
  2997 				]
       
  2998 			   ].
       
  2999     listOfKnownPackages := listOfKnownPackages asOrderedCollection sort.
       
  3000 
       
  3001     pkg := Dialog
       
  3002 		request:'When applying, changes go into package:'
       
  3003 		initialAnswer:(enforcedPackage ? Class packageQuerySignal query)
       
  3004 		list:listOfKnownPackages.
       
  3005     pkg size ~~ 0 ifTrue:[
       
  3006 	enforcedPackage := pkg
       
  3007     ]
  1660 !
  3008 !
  1661 
  3009 
  1662 showAboutSTX
  3010 showAboutSTX
  1663     ToolApplicationModel openAboutSTX
  3011     ToolApplicationModel openAboutSTX
  1664 ! !
  3012 ! !
  4375         cls := cls class
  5723         cls := cls class
  4376     ].
  5724     ].
  4377     ^ cls
  5725     ^ cls
  4378 !
  5726 !
  4379 
  5727 
  4380 doApply
       
  4381     "user wants a change to be applied"
       
  4382 
       
  4383     self withSelectedChangesDo:[:changeNr |
       
  4384         (self applyChange:changeNr) ifFalse:[
       
  4385             ^ self "/ cancel
       
  4386         ].
       
  4387         self autoSelect:(changeNr + 1)
       
  4388     ]
       
  4389 !
       
  4390 
       
  4391 doApplyAll
       
  4392     "user wants all changes to be applied"
       
  4393 
       
  4394     self withExecuteCursorDo:[
       
  4395         |lastNr "{ Class: SmallInteger }" |
       
  4396 
       
  4397         self clearCodeView.
       
  4398         lastNr := self numberOfChanges.
       
  4399 
       
  4400         "if we apply multiple changes, and an error occurs,
       
  4401          ask the user if all operations should be aborted..."
       
  4402         multipleApply := lastNr > 1.
       
  4403 
       
  4404         1 to:lastNr do:[:changeNr |
       
  4405             changeListView setSelection:changeNr.
       
  4406             self applyChange:changeNr
       
  4407         ].
       
  4408         self autoSelectLast
       
  4409     ]
       
  4410 
       
  4411     "Modified: 21.1.1997 / 22:26:30 / cg"
       
  4412 !
       
  4413 
       
  4414 doApplyClassFromBeginning
       
  4415     "user wants all changes for this class from 1 to changeNr to be applied"
       
  4416 
       
  4417     self withSingleSelectedChangeDo:[:changeNr |
       
  4418         |thisClassName classNameToApply lastChange
       
  4419          lastNr "{ Class: SmallInteger }" |
       
  4420 
       
  4421         classNameToApply := self classNameOfChange:changeNr.
       
  4422         classNameToApply notNil ifTrue:[
       
  4423             self clearCodeView.
       
  4424 
       
  4425             "if we apply multiple changes, and an error occurs,
       
  4426              ask the user if all operations should be aborted..."
       
  4427             multipleApply := changeNr ~= 1.
       
  4428 
       
  4429             1 to:changeNr do:[:changeNr |
       
  4430                 thisClassName := self classNameOfChange:changeNr.
       
  4431                 thisClassName = classNameToApply ifTrue:[
       
  4432                     changeListView setSelection:changeNr.
       
  4433                     self applyChange:changeNr.
       
  4434                     lastChange := changeNr
       
  4435                 ].
       
  4436             ].
       
  4437             self autoSelect:changeNr+1.
       
  4438         ]
       
  4439     ]
       
  4440 
       
  4441     "Modified: 21.1.1997 / 22:26:04 / cg"
       
  4442 !
       
  4443 
       
  4444 doApplyClassRest
       
  4445     "user wants all changes for this class from changeNr to be applied"
       
  4446 
       
  4447     self withSingleSelectedChangeDo:[:changeNr |
       
  4448         |thisClassName classNameToApply lastChange
       
  4449          lastNr "{ Class: SmallInteger }" |
       
  4450 
       
  4451         classNameToApply := self classNameOfChange:changeNr.
       
  4452         classNameToApply notNil ifTrue:[
       
  4453             self clearCodeView.
       
  4454 
       
  4455             lastNr := self numberOfChanges.
       
  4456 
       
  4457             "if we apply multiple changes, and an error occurs,
       
  4458              ask the user if all operations should be aborted..."
       
  4459             multipleApply := (lastNr - changeNr) > 1.
       
  4460 
       
  4461             changeNr to:lastNr do:[:changeNr |
       
  4462                 thisClassName := self classNameOfChange:changeNr.
       
  4463                 thisClassName = classNameToApply ifTrue:[
       
  4464                     changeListView setSelection:changeNr.
       
  4465                     self applyChange:changeNr.
       
  4466                     lastChange := changeNr
       
  4467                 ].
       
  4468             ].
       
  4469             self autoSelect:lastChange.
       
  4470         ]
       
  4471     ]
       
  4472 
       
  4473     "Modified: 21.1.1997 / 22:26:04 / cg"
       
  4474 !
       
  4475 
       
  4476 doApplyFromBeginning
       
  4477     "user wants all changes from 1 to changeNr to be applied"
       
  4478 
       
  4479     self withSingleSelectedChangeDo:[:changeNr |
       
  4480         |lastNr "{ Class: SmallInteger }" |
       
  4481 
       
  4482         self clearCodeView.
       
  4483 
       
  4484         "if we apply multiple changes, and an error occurs,
       
  4485          ask the user if all operations should be aborted..."
       
  4486         multipleApply := changeNr ~= 1.
       
  4487 
       
  4488         1 to:changeNr do:[:changeNr |
       
  4489             changeListView setSelection:changeNr.
       
  4490             self applyChange:changeNr
       
  4491         ].
       
  4492         self autoSelect:changeNr+1.
       
  4493     ]
       
  4494 !
       
  4495 
       
  4496 doApplyRest
       
  4497     "apply all changes from changeNr to the end"
       
  4498 
       
  4499     self withSingleSelectedChangeDo:[:changeNr |
       
  4500         |lastNr "{ Class: SmallInteger }" |
       
  4501 
       
  4502         self clearCodeView.
       
  4503 
       
  4504         lastNr := self numberOfChanges.
       
  4505 
       
  4506         "if we apply multiple changes, and an error occurs,
       
  4507          ask the user if all operations should be aborted..."
       
  4508         multipleApply := (lastNr - changeNr) > 1.
       
  4509 
       
  4510         changeNr to:lastNr do:[:changeNr |
       
  4511             changeListView setSelection:changeNr.
       
  4512             self applyChange:changeNr
       
  4513         ].
       
  4514         self autoSelect:self numberOfChanges.
       
  4515     ]
       
  4516 
       
  4517     "Modified: 21.1.1997 / 22:25:29 / cg"
       
  4518 !
       
  4519 
       
  4520 doApplyToConflictOrEnd
       
  4521     "apply all changes from changeNr to either a conflict (i.e. method exists)
       
  4522      or the end."
       
  4523 
       
  4524     self withSingleSelectedChangeDo:[:changeNr |
       
  4525         |lastNr "{ Class: SmallInteger }"|
       
  4526 
       
  4527         self clearCodeView.
       
  4528 
       
  4529         lastNr := self numberOfChanges.
       
  4530 
       
  4531         "if we apply multiple changes, and an error occurs,
       
  4532          ask the user if all operations should be aborted..."
       
  4533         multipleApply := (lastNr - changeNr) > 1.
       
  4534 
       
  4535         changeNr to:lastNr do:[:changeNr |
       
  4536             | cls sel |
       
  4537             changeListView setSelection:changeNr.
       
  4538 
       
  4539             ((cls := self classOfChange:changeNr ifAbsent:[:className| nil]) notNil
       
  4540             and:[(sel := self selectorOfMethodChange:changeNr) notNil])
       
  4541             ifTrue:[
       
  4542                 (cls includesSelector:sel) ifTrue:[
       
  4543                     self autoSelect:changeNr.
       
  4544                     ^ self
       
  4545                 ].
       
  4546             ].
       
  4547             self applyChange:changeNr
       
  4548         ].
       
  4549         self autoSelect:self numberOfChanges.
       
  4550     ]
       
  4551 !
       
  4552 
       
  4553 doBrowse
       
  4554     "user wants a browser on the class of a change"
       
  4555 
       
  4556     self withSingleSelectedChangeDo:[:changeNr |
       
  4557 	|cls|
       
  4558 
       
  4559 	cls := self classOfChange:changeNr.
       
  4560 	cls notNil ifTrue:[
       
  4561 	    UserPreferences systemBrowserClass
       
  4562 		openInClass:cls
       
  4563 		selector:(self selectorOfMethodChange:changeNr)
       
  4564 	]
       
  4565     ]
       
  4566 !
       
  4567 
       
  4568 doBrowseImplementors
       
  4569     "open an implementors-browser"
       
  4570 
       
  4571     |changeNr initial selector|
       
  4572 
       
  4573     (changeNr := self theSingleSelection) notNil ifTrue:[
       
  4574 	initial := self selectorOfMethodChange:changeNr.
       
  4575     ].
       
  4576 
       
  4577     selector := Dialog
       
  4578 		    request:'Selector to browse implementors of:'
       
  4579 		    initialAnswer:(initial ? '').
       
  4580     selector size ~~ 0 ifTrue:[
       
  4581 	UserPreferences systemBrowserClass
       
  4582 	    browseImplementorsMatching:selector.
       
  4583     ]
       
  4584 !
       
  4585 
       
  4586 doBrowseSenders
       
  4587     "user wants a browser on the class of a change"
       
  4588 
       
  4589     |changeNr initial selector|
       
  4590 
       
  4591     (changeNr := self theSingleSelection) notNil ifTrue:[
       
  4592 	initial := self selectorOfMethodChange:changeNr.
       
  4593     ].
       
  4594 
       
  4595     selector := Dialog
       
  4596 		    request:'Selector to browse senders of:'
       
  4597 		    initialAnswer:(initial ? '').
       
  4598     selector size ~~ 0 ifTrue:[
       
  4599 	UserPreferences systemBrowserClass
       
  4600 	    browseAllCallsOn:selector asSymbol.
       
  4601     ]
       
  4602 !
       
  4603 
       
  4604 doCheckinAndDeleteClassAll
       
  4605     "first checkin the selected changes class then delete all changes
       
  4606      for it."
       
  4607 
       
  4608     |classes answer logTitle checkinInfo|
       
  4609 
       
  4610 "/    self theSingleSelection isNil ifTrue:[
       
  4611 "/        ^ self information:'Only possible if a single change is selected.'.
       
  4612 "/    ].
       
  4613 
       
  4614     self withExecuteCursorDo:[
       
  4615         classes := IdentitySet new.
       
  4616 
       
  4617         self withSelectedChangesDo:[:changeNr |
       
  4618             | className class |
       
  4619 
       
  4620             className := self classNameOfChange:changeNr.
       
  4621             className notNil ifTrue:[
       
  4622                 class := Smalltalk classNamed:className.
       
  4623                 class isNil ifTrue:[
       
  4624                     self error:'oops - no class: ', className mayProceed:true.
       
  4625                 ].
       
  4626                 class notNil ifTrue:[
       
  4627                     class := class theNonMetaclass.
       
  4628                     (classes includes:class) ifFalse:[
       
  4629                         class isPrivate ifTrue:[
       
  4630                             (classes includes:class owningClass) ifFalse:[
       
  4631                                 answer := self confirmWithCancel:('This is a private class.\\CheckIn the owner ''%1'' and all of its private classes ?'
       
  4632                                                                     bindWith:class owningClass name allBold) withCRs.
       
  4633                                 answer isNil ifTrue:[^ self].
       
  4634                                 answer ifTrue:[
       
  4635                                     classes add:class owningClass
       
  4636                                 ]
       
  4637                             ]
       
  4638                         ] ifFalse:[
       
  4639                             classes add:class
       
  4640                         ].
       
  4641                     ]
       
  4642                 ]
       
  4643             ]
       
  4644         ].
       
  4645 
       
  4646         classes size == 1 ifTrue:[
       
  4647             logTitle := classes first name.
       
  4648         ] ifFalse:[
       
  4649             logTitle := '%1 classes' bindWith:classes size.
       
  4650         ].
       
  4651         checkinInfo := SourceCodeManagerUtilities default
       
  4652                         getCheckinInfoFor:logTitle
       
  4653                         initialAnswer:nil.
       
  4654         checkinInfo isNil ifTrue:[^ self ].
       
  4655 
       
  4656         changeListView setSelection:nil.
       
  4657         classes do:[:eachClass |
       
  4658             (SourceCodeManagerUtilities default checkinClass:eachClass withInfo:checkinInfo)
       
  4659                 ifTrue:[
       
  4660                     self silentDeleteChangesForClassAndPrivateClasses:eachClass name
       
  4661                            from:1 to:(self numberOfChanges).
       
  4662                 ]
       
  4663         ].
       
  4664         self setChangeList.
       
  4665     ]
       
  4666 
       
  4667     "Modified: / 6.9.1995 / 17:11:16 / claus"
       
  4668     "Modified: / 17.11.2001 / 14:21:13 / cg"
       
  4669 !
       
  4670 
       
  4671 doCompare
       
  4672     "compare change with current system version"
       
  4673 
       
  4674     classesNotToBeAutoloaded removeAll.
       
  4675 
       
  4676     self withSingleSelectedChangeDo:[:changeNr |
       
  4677         self withExecuteCursorDo:[
       
  4678             self compareChange:changeNr
       
  4679         ].
       
  4680         self newLabel:''
       
  4681     ].
       
  4682 
       
  4683     "Modified: 24.2.1996 / 19:37:19 / cg"
       
  4684 !
       
  4685 
       
  4686 doCompareAndCompress
       
  4687     "remove all changes, which are equivalent to the current image version"
       
  4688 
       
  4689     |toDelete|
       
  4690 
       
  4691     classesNotToBeAutoloaded removeAll.
       
  4692     toDelete := OrderedCollection new.
       
  4693     self withExecuteCursorDo:[
       
  4694         1 to:self numberOfChanges do:[:changeNr |
       
  4695             (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  4696                 toDelete add:changeNr
       
  4697             ]
       
  4698         ].
       
  4699     ].
       
  4700 
       
  4701     toDelete reverseDo:[:changeNr |
       
  4702         self silentDeleteChange:changeNr.
       
  4703     ].
       
  4704     self setChangeList.
       
  4705     "
       
  4706      scroll back a bit, if we are left way behind the list
       
  4707     "
       
  4708     changeListView firstLineShown > self numberOfChanges ifTrue:[
       
  4709         changeListView makeLineVisible:self numberOfChanges
       
  4710     ].
       
  4711     self clearCodeView.
       
  4712 
       
  4713     self newLabel:''.
       
  4714     classesNotToBeAutoloaded removeAll.
       
  4715 !
       
  4716 
       
  4717 doCompress
       
  4718     "compress the change-set; this replaces multiple method-changes by the last
       
  4719      (i.e. the most recent) change"
       
  4720 
       
  4721     self compressForClass:nil
       
  4722 
       
  4723     "Modified: / 29.10.1997 / 01:03:26 / cg"
       
  4724 !
       
  4725 
       
  4726 doCompressClass
       
  4727     "compress changes for the selected class.
       
  4728      this replaces multiple method-changes by the last (i.e. the most recent) change."
       
  4729 
       
  4730     self theSingleSelection isNil ifTrue:[
       
  4731 	^ self information:'Only possible if a single change is selected.'.
       
  4732     ].
       
  4733 
       
  4734     self selectedClassNames do:[:classNameToCompress |
       
  4735 	self compressForClass:classNameToCompress.
       
  4736     ]
       
  4737 
       
  4738     "Created: / 29.10.1997 / 01:05:16 / cg"
       
  4739     "Modified: / 19.11.2001 / 21:55:17 / cg"
       
  4740 !
       
  4741 
       
  4742 doCompressSelector
       
  4743     "compress changes for the selected class & selector.
       
  4744      this replaces multiple method-changes by the last (i.e. the most recent) change."
       
  4745 
       
  4746     |classSelectorPairs|
       
  4747 
       
  4748     self theSingleSelection isNil ifTrue:[
       
  4749 	^ self information:'Only possible if a single change is selected.'.
       
  4750     ].
       
  4751 
       
  4752     classSelectorPairs := Set new.
       
  4753     self withSelectedChangesDo:[:changeNr |
       
  4754 	| classNameToCompress selector |
       
  4755 
       
  4756 	classNameToCompress := self classNameOfChange:changeNr.
       
  4757 	classNameToCompress notNil ifTrue:[
       
  4758 	    selector := self selectorOfMethodChange:changeNr.
       
  4759 	    selector notNil ifTrue:[
       
  4760 		classSelectorPairs add:(classNameToCompress -> selector).
       
  4761 	    ]
       
  4762 	]
       
  4763     ].
       
  4764 
       
  4765     classSelectorPairs do:[:pair |
       
  4766 	self compressForClass:pair key selector:pair value.
       
  4767     ]
       
  4768 
       
  4769     "Created: / 19.11.2001 / 21:50:59 / cg"
       
  4770     "Modified: / 19.11.2001 / 22:10:08 / cg"
       
  4771 !
       
  4772 
       
  4773 doDelete
       
  4774     "delete currently selected change(s)"
       
  4775 
       
  4776     |rangeEnd rangeStart firstDeleted|
       
  4777 
       
  4778     changeListView selection size <= 5 ifTrue:[
       
  4779 	self withSelectedChangesReverseDo:[:changeNr |
       
  4780 	    self deleteChange:changeNr.
       
  4781 	    self autoSelectOrEnd:changeNr
       
  4782 	].
       
  4783 	^ self
       
  4784     ].
       
  4785 
       
  4786     self withSelectedChangesReverseDo:[:changeNr |
       
  4787 	rangeEnd isNil ifTrue:[
       
  4788 	    rangeEnd := rangeStart := changeNr
       
  4789 	] ifFalse:[
       
  4790 	    (changeNr = (rangeEnd + 1)) ifTrue:[
       
  4791 		rangeEnd := changeNr
       
  4792 	    ] ifFalse:[
       
  4793 		(changeNr = (rangeStart - 1)) ifTrue:[
       
  4794 		    rangeStart := changeNr
       
  4795 		] ifFalse:[
       
  4796 		    self deleteChangesFrom:rangeStart to:rangeEnd.
       
  4797 		    firstDeleted := (firstDeleted ? rangeStart) min:rangeStart.
       
  4798 		    rangeStart := rangeEnd := nil.
       
  4799 		].
       
  4800 	    ].
       
  4801 	].
       
  4802     ].
       
  4803     rangeStart notNil ifTrue:[
       
  4804 	self deleteChangesFrom:rangeStart to:rangeEnd.
       
  4805 	firstDeleted := (firstDeleted ? rangeStart) min:rangeStart.
       
  4806     ].
       
  4807     self autoSelectOrEnd:firstDeleted
       
  4808 !
       
  4809 
       
  4810 doDeleteAndSelectPrevious
       
  4811     "delete currently selected change(s)"
       
  4812 
       
  4813     self withSelectedChangesReverseDo:[:changeNr |
       
  4814 	self deleteChange:changeNr.
       
  4815 	self autoSelectOrEnd:changeNr-1
       
  4816     ]
       
  4817 !
       
  4818 
       
  4819 doDeleteClassAll
       
  4820     "delete all changes with same class as currently selected change"
       
  4821 
       
  4822     |classNamesToDelete lastChangeNr overAllNumDeletedBefore|
       
  4823 
       
  4824     lastChangeNr := -1.
       
  4825     classNamesToDelete := Set new.
       
  4826     self withSelectedChangesDo:[:changeNr |
       
  4827 	|classNameToDelete|
       
  4828 
       
  4829 	classNameToDelete := self classNameOfChange:changeNr.
       
  4830 	classNameToDelete notNil ifTrue:[
       
  4831 	    classNamesToDelete add:classNameToDelete.
       
  4832 	].
       
  4833 	lastChangeNr := lastChangeNr max:changeNr.
       
  4834     ].
       
  4835 
       
  4836     overAllNumDeletedBefore := 0.
       
  4837     changeListView setSelection:nil.
       
  4838 
       
  4839     self withExecuteCursorDo:[
       
  4840 	classNamesToDelete do:[:classNameToDelete |
       
  4841 	    |numDeletedBefore|
       
  4842 
       
  4843 	    self silentDeleteChangesFor:classNameToDelete
       
  4844 				   from:lastChangeNr
       
  4845 				     to:(self numberOfChanges).
       
  4846 	    numDeletedBefore := self
       
  4847 				   silentDeleteChangesFor:classNameToDelete
       
  4848 				   from:1
       
  4849 				   to:(lastChangeNr-1).
       
  4850 	    lastChangeNr := lastChangeNr - numDeletedBefore.
       
  4851 	    overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  4852 	].
       
  4853     ].
       
  4854 
       
  4855     self setChangeList.
       
  4856     self autoSelectOrEnd:lastChangeNr
       
  4857 
       
  4858     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  4859     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  4860 !
       
  4861 
       
  4862 doDeleteClassAndPrivateClassesAll
       
  4863     "delete all changes with same class and private classes
       
  4864      as currently selected change"
       
  4865 
       
  4866     |lastChangeNr classNamesToDelete overAllNumDeletedBefore|
       
  4867 
       
  4868     lastChangeNr := -1.
       
  4869     classNamesToDelete := Set new.
       
  4870     self withSelectedChangesDo:[:changeNr |
       
  4871 	|classNameToDelete|
       
  4872 
       
  4873 	classNameToDelete := self ownerClassNameOfChange:changeNr.
       
  4874 	classNameToDelete notNil ifTrue:[
       
  4875 	    classNamesToDelete add:classNameToDelete.
       
  4876 	].
       
  4877 	lastChangeNr := lastChangeNr max:changeNr.
       
  4878     ].
       
  4879 
       
  4880     overAllNumDeletedBefore := 0.
       
  4881     changeListView setSelection:nil.
       
  4882 
       
  4883     self withExecuteCursorDo:[
       
  4884 	classNamesToDelete do:[:classNameToDelete |
       
  4885 	    | changeNr numDeletedBefore|
       
  4886 
       
  4887 	    classNameToDelete notNil ifTrue:[
       
  4888 		changeListView setSelection:nil.
       
  4889 		self silentDeleteChangesForClassAndPrivateClasses:classNameToDelete
       
  4890 				       from:lastChangeNr
       
  4891 					 to:(self numberOfChanges).
       
  4892 		numDeletedBefore := self
       
  4893 				       silentDeleteChangesForClassAndPrivateClasses:classNameToDelete
       
  4894 				       from:1
       
  4895 				       to:(lastChangeNr-1).
       
  4896 		lastChangeNr := lastChangeNr - numDeletedBefore.
       
  4897 		overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  4898 	    ]
       
  4899 	]
       
  4900     ].
       
  4901     self setChangeList.
       
  4902     self autoSelectOrEnd:lastChangeNr
       
  4903 
       
  4904     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  4905     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  4906 !
       
  4907 
       
  4908 doDeleteClassFromBeginning
       
  4909     "delete changes with same class as currently selected change from the beginning
       
  4910      up to the selected change.
       
  4911      Useful to get rid of obsolete changes before a fileout or checkin entry."
       
  4912 
       
  4913     self withSingleSelectedChangeDo:[:changeNr |
       
  4914 	|classNameToDelete prevSelection numDeleted|
       
  4915 
       
  4916 	classNameToDelete := self classNameOfChange:changeNr.
       
  4917 	classNameToDelete notNil ifTrue:[
       
  4918 	    prevSelection := changeNr.
       
  4919 	    changeListView setSelection:nil.
       
  4920 	    numDeleted := self
       
  4921 				silentDeleteChangesFor:classNameToDelete
       
  4922 				from:1
       
  4923 				to:changeNr.
       
  4924 	    self setChangeList.
       
  4925 	    self autoSelectOrEnd:(changeNr + 1 - numDeleted)
       
  4926 	]
       
  4927     ].
       
  4928 
       
  4929     "Created: 13.12.1995 / 15:41:58 / cg"
       
  4930     "Modified: 25.5.1996 / 12:26:34 / cg"
       
  4931 !
       
  4932 
       
  4933 doDeleteClassRest
       
  4934     "delete rest of changes with same class as currently selected change"
       
  4935 
       
  4936     self withSingleSelectedChangeDo:[:changeNr |
       
  4937 	| classNameToDelete |
       
  4938 
       
  4939 	classNameToDelete := self classNameOfChange:changeNr.
       
  4940 	classNameToDelete notNil ifTrue:[
       
  4941 	    changeListView setSelection:nil.
       
  4942 	    self silentDeleteChangesFor:classNameToDelete
       
  4943 				   from:changeNr
       
  4944 				     to:(self numberOfChanges).
       
  4945 	    self setChangeList.
       
  4946 	    self autoSelectOrEnd:changeNr
       
  4947 	]
       
  4948     ]
       
  4949 
       
  4950     "Modified: / 18.5.1998 / 14:25:07 / cg"
       
  4951 !
       
  4952 
       
  4953 doDeleteClassSelectorAll
       
  4954     "delete all changes with same class and selector as currently selected change"
       
  4955 
       
  4956     |classNameSelectorPairsToDelete lastChangeNr overAllNumDeletedBefore|
       
  4957 
       
  4958     lastChangeNr := -1.
       
  4959     classNameSelectorPairsToDelete := Set new.
       
  4960     self withSelectedChangesDo:[:changeNr |
       
  4961 	|className selector|
       
  4962 
       
  4963 	className := self classNameOfChange:changeNr.
       
  4964 	selector := self selectorOfMethodChange:changeNr.
       
  4965 	selector notNil ifTrue:[
       
  4966 	    (className notNil and:[selector notNil]) ifTrue:[
       
  4967 		classNameSelectorPairsToDelete add:(className -> selector).
       
  4968 	    ]
       
  4969 	].
       
  4970 	lastChangeNr := lastChangeNr max:changeNr.
       
  4971     ].
       
  4972 
       
  4973     overAllNumDeletedBefore := 0.
       
  4974     changeListView setSelection:nil.
       
  4975 
       
  4976     self withExecuteCursorDo:[
       
  4977 	classNameSelectorPairsToDelete do:[:pair |
       
  4978 	    |numDeletedBefore className selector|
       
  4979 
       
  4980 	    className := pair key.
       
  4981 	    selector  := pair value.
       
  4982 	    self silentDeleteChangesFor:className selector:selector
       
  4983 				   from:lastChangeNr
       
  4984 				     to:(self numberOfChanges).
       
  4985 	    numDeletedBefore := self
       
  4986 				   silentDeleteChangesFor:className selector:selector
       
  4987 				   from:1
       
  4988 				   to:(lastChangeNr-1).
       
  4989 	    lastChangeNr := lastChangeNr - numDeletedBefore.
       
  4990 	    overAllNumDeletedBefore := overAllNumDeletedBefore + numDeletedBefore.
       
  4991 	].
       
  4992     ].
       
  4993 
       
  4994     self setChangeList.
       
  4995     self autoSelectOrEnd:lastChangeNr
       
  4996 
       
  4997     "Created: / 13.12.1995 / 16:07:14 / cg"
       
  4998     "Modified: / 28.1.1998 / 20:42:14 / cg"
       
  4999 !
       
  5000 
       
  5001 doDeleteFromBeginning
       
  5002     "delete all changes from 1 to the current"
       
  5003 
       
  5004     self withSingleSelectedChangeDo:[:changeNr |
       
  5005 	self deleteChangesFrom:1 to:changeNr.
       
  5006 	self clearCodeView.
       
  5007 	self autoSelectOrEnd:changeNr
       
  5008     ]
       
  5009 !
       
  5010 
       
  5011 doDeleteRest
       
  5012     "delete all changes from current to the end"
       
  5013 
       
  5014     self withSingleSelectedChangeDo:[:changeNr |
       
  5015 	self deleteChangesFrom:changeNr to:(self numberOfChanges).
       
  5016 	self clearCodeView.
       
  5017 	self autoSelectOrEnd:changeNr-1
       
  5018     ]
       
  5019 !
       
  5020 
       
  5021 doFileoutAndDeleteClassAll
       
  5022     "first fileOut the selected changes class then delete all changes
       
  5023      for it."
       
  5024 
       
  5025     self withSingleSelectedChangeDo:[:changeNr |
       
  5026 	| className class |
       
  5027 
       
  5028 	className := self classNameOfChange:changeNr.
       
  5029 	className notNil ifTrue:[
       
  5030 	    class := Smalltalk classNamed:className.
       
  5031 	    class notNil ifTrue:[
       
  5032 		Class fileOutErrorSignal handle:[:ex |
       
  5033 		    self warn:('fileout failed: ' , ex description).
       
  5034 		] do:[
       
  5035 		    class fileOut.
       
  5036 		    self doDeleteClassAll
       
  5037 		].
       
  5038 	    ].
       
  5039 
       
  5040 	].
       
  5041     ]
       
  5042 
       
  5043     "Modified: 6.9.1995 / 17:11:16 / claus"
       
  5044 !
       
  5045 
       
  5046 doMakePatch
       
  5047     "user wants a change to be made a patch
       
  5048      - copy it over to the patches file"
       
  5049 
       
  5050     self withSelectedChangesDo:[:changeNr |
       
  5051 	self makeChangeAPatch:changeNr.
       
  5052 	self autoSelect:(changeNr + 1)
       
  5053     ]
       
  5054 !
       
  5055 
       
  5056 doMakePermanent
       
  5057     "user wants a change to be made permanent
       
  5058      - rewrite the source file where this change has to go"
       
  5059 
       
  5060     |yesNoBox|
       
  5061 
       
  5062     (self theSingleSelection) isNil ifTrue:[
       
  5063         ^ self information:'Only possible if a single change is selected.'.
       
  5064     ].
       
  5065 
       
  5066     yesNoBox := YesNoBox new.
       
  5067     yesNoBox title:(resources string:'Warning: this operation cannot be undone').
       
  5068     yesNoBox okText:(resources string:'continue') noText:(resources string:'abort').
       
  5069     yesNoBox okAction:[   |changeNr|
       
  5070 
       
  5071                           changeNr := self theSingleSelection.
       
  5072                           changeNr notNil ifTrue:[
       
  5073                               self makeChangePermanent:changeNr.
       
  5074                               self autoSelect:(changeNr + 1)
       
  5075                           ]
       
  5076                       ].
       
  5077     yesNoBox showAtPointer.
       
  5078     yesNoBox destroy
       
  5079 
       
  5080     "Modified: 7.1.1997 / 23:03:33 / cg"
       
  5081 !
       
  5082 
       
  5083 doSave
       
  5084     "user wants a change to be appended to a file"
       
  5085 
       
  5086     |fileName|
       
  5087 
       
  5088     self withSelectedChangesDo:[:changeNr |
       
  5089         fileName := Dialog
       
  5090                         requestFileNameForSave:(resources string:'Append change to:')
       
  5091                         default:(lastSaveFileName ? '')
       
  5092                         ok:(resources string:'Append')
       
  5093                         abort:(resources string:'Abort')
       
  5094                         pattern:'*.chg'.
       
  5095 
       
  5096         fileName notNil ifTrue:[
       
  5097             lastSaveFileName := fileName.
       
  5098             self withCursor:(Cursor write) do:[
       
  5099                 self appendChange:changeNr toFile:fileName.
       
  5100             ].
       
  5101             self autoSelect:(changeNr + 1)
       
  5102         ].
       
  5103     ]
       
  5104 
       
  5105     "Modified: / 27-10-2010 / 11:30:07 / cg"
       
  5106 !
       
  5107 
       
  5108 doSaveClass
       
  5109     "user wants changes for some class from current to end to be appended to a file"
       
  5110 
       
  5111     (self theSingleSelection) isNil ifTrue:[
       
  5112 	^ self information:'Only possible if a single change is selected.'.
       
  5113     ].
       
  5114     self doSaveClassFrom:1
       
  5115 !
       
  5116 
       
  5117 doSaveClassAll
       
  5118     "user wants changes for some class from current to end to be appended to a file"
       
  5119 
       
  5120     (self theSingleSelection) isNil ifTrue:[
       
  5121 	^ self information:'Only possible if a single change is selected.'.
       
  5122     ].
       
  5123     self doSaveClassFrom:1
       
  5124 !
       
  5125 
       
  5126 doSaveClassFrom:startNr
       
  5127     "user wants changes from current to end to be appended to a file"
       
  5128 
       
  5129     |changeNr classNameToSave|
       
  5130 
       
  5131     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  5132 	^ self information:'Only possible if a single change is selected.'.
       
  5133     ].
       
  5134     classNameToSave := self classNameOfChange:changeNr.
       
  5135     classNameToSave notNil ifTrue:[
       
  5136 	self saveClass:classNameToSave from:startNr
       
  5137     ]
       
  5138 !
       
  5139 
       
  5140 doSaveClassRest
       
  5141     "user wants changes for some class from current to end to be appended to a file"
       
  5142 
       
  5143     |changeNr|
       
  5144 
       
  5145     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  5146         ^ self information:'Only possible if a single change is selected.'.
       
  5147     ].
       
  5148     self doSaveClassFrom:changeNr.
       
  5149 
       
  5150     changeListView setSelection:changeNr.
       
  5151     "/ self changeSelection:changeNr.
       
  5152 !
       
  5153 
       
  5154 doSaveRest
       
  5155     "user wants changes from current to end to be appended to a file"
       
  5156 
       
  5157     |changeNr fileName|
       
  5158 
       
  5159     (changeNr := self theSingleSelection) isNil ifTrue:[
       
  5160         ^ self information:(resources string:'Only possible if a single change is selected.').
       
  5161     ].
       
  5162 
       
  5163     fileName := Dialog
       
  5164                     requestFileNameForSave:(resources string:'Append changes to:')
       
  5165                     default:(lastSaveFileName ? '')
       
  5166                     ok:(resources string:'Append')
       
  5167                     abort:(resources string:'Abort')
       
  5168                     pattern:'*.chg'.
       
  5169 
       
  5170     fileName notNil ifTrue:[
       
  5171         lastSaveFileName := fileName.
       
  5172         self withCursor:(Cursor write) do:[
       
  5173             changeNr to:(self numberOfChanges) do:[:changeNr |
       
  5174                 changeListView setSelection:changeNr.
       
  5175                 (self appendChange:changeNr toFile:fileName) ifFalse:[
       
  5176                     ^ self
       
  5177                 ]
       
  5178             ]
       
  5179         ]
       
  5180     ]
       
  5181 
       
  5182     "Modified: / 27-10-2010 / 11:30:37 / cg"
       
  5183 !
       
  5184 
       
  5185 doUpdate
       
  5186     "reread the changes-file"
       
  5187 
       
  5188     self readChangesFileInBackground:true.
       
  5189     self newLabel:''.
       
  5190     realized ifTrue:[
       
  5191 	self setChangeList.
       
  5192     ]
       
  5193 !
       
  5194 
       
  5195 doWriteBack
       
  5196     "write back the list onto the changes file"
       
  5197 
       
  5198     anyChanges ifTrue:[
       
  5199         (self writeBackChanges) ifTrue:[
       
  5200             realized ifTrue:[
       
  5201                 self readChangesFile.
       
  5202                 realized ifTrue:[
       
  5203                     self setChangeList
       
  5204                 ]
       
  5205             ]
       
  5206         ]
       
  5207     ]
       
  5208 
       
  5209     "Modified: 5.9.1996 / 17:19:46 / cg"
       
  5210 !
       
  5211 
       
  5212 doubleClickOnChange:lineNr
  5728 doubleClickOnChange:lineNr
  5213     "action performed when a change-list entry is doubleClicked"
  5729     "action performed when a change-list entry is doubleClicked"
  5214 
  5730 
  5215     self doBrowse
  5731     self doBrowse
  5216 
  5732 
  5217     "Created: / 6.2.1998 / 13:08:49 / cg"
  5733     "Created: / 6.2.1998 / 13:08:49 / cg"
  5218 !
       
  5219 
       
  5220 findClass
       
  5221     "findClass menu action: let user enter a classes name, and select the next change for that class"
       
  5222 
       
  5223     |current|
       
  5224 
       
  5225     changeNrShown notNil ifTrue:[
       
  5226         current := self classNameOfChange:changeNrShown.
       
  5227     ].
       
  5228 
       
  5229     self
       
  5230         askForSearch:'Class to search for:'
       
  5231         initialAnswer:current
       
  5232         thenSearchUsing:[:searchString :changeNr |
       
  5233                             |thisClassName|
       
  5234 
       
  5235                             thisClassName := self classNameOfChange:changeNr.
       
  5236                             thisClassName notNil
       
  5237                             and:[
       
  5238                                 (thisClassName sameAs: searchString)
       
  5239                                 or:[searchString includesMatchCharacters and:[searchString match:thisClassName ignoreCase:true]]]
       
  5240                         ]
       
  5241         onCancel:[^ self].
       
  5242 
       
  5243     lastSearchType := #class.
       
  5244     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  5245 !
       
  5246 
       
  5247 findFirstForClass
       
  5248     "findNextForClass menu action: select the next change for the selected changes class"
       
  5249 
       
  5250     self findNextForClassStartingAt:1
       
  5251 
       
  5252     "Created: / 20-11-2006 / 16:37:56 / cg"
       
  5253 !
       
  5254 
       
  5255 findLastForClass
       
  5256     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  5257 
       
  5258     self findPreviousForClassStartingAt:(self numberOfChanges)
       
  5259 
       
  5260     "Created: / 20-11-2006 / 16:39:15 / cg"
       
  5261 !
       
  5262 
       
  5263 findLastSnapshot
       
  5264     "findLastSnapshot menu action: select the last change which is for a snapShot-image save action"
       
  5265 
       
  5266     "/ lastSearchType := #snapshot.
       
  5267 
       
  5268     self 
       
  5269         findPreviousForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  5270         startingAt:(self numberOfChanges)
       
  5271 
       
  5272     "Created: / 06-10-2006 / 11:03:39 / cg"
       
  5273 !
       
  5274 
       
  5275 findNext
       
  5276     "findNext menu action: select the next change.
       
  5277      Searches for what the last search was for; i.e. either same class or same selector"
       
  5278 
       
  5279     lastSearchType == #selector ifTrue:[
       
  5280 	^ self findNextForSelector
       
  5281     ].
       
  5282     lastSearchType == #snapshot ifTrue:[
       
  5283 	^ self findNextSnapshot
       
  5284     ].
       
  5285     lastSearchType == #string ifTrue:[
       
  5286 	^ self findNextForString
       
  5287     ].
       
  5288     lastSearchType == #difference ifTrue:[
       
  5289 	^ self findNextDifference
       
  5290     ].
       
  5291 
       
  5292     ^ self findNextForClass
       
  5293 
       
  5294     "Created: / 18.6.1998 / 22:15:00 / cg"
       
  5295     "Modified: / 18.6.1998 / 22:15:25 / cg"
       
  5296 !
       
  5297 
       
  5298 findNextDifference
       
  5299     lastSearchType := #difference.
       
  5300     changeNrShown isNil ifTrue:[^ self].
       
  5301 
       
  5302     self findNextForWhich:[:changeNr |
       
  5303 	    (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  5304 		"/ same
       
  5305 		false
       
  5306 	    ] ifFalse:[
       
  5307 		"/ different
       
  5308 		true
       
  5309 	    ]
       
  5310 	]
       
  5311 !
       
  5312 
       
  5313 findNextForClass
       
  5314     "findNextForClass menu action: select the next change for the selected changes class"
       
  5315 
       
  5316     self findNextForClassStartingAt: changeNrShown + 1
       
  5317 
       
  5318     "Modified: / 20-11-2006 / 16:37:49 / cg"
       
  5319 !
       
  5320 
       
  5321 findNextForClassStartingAt:startNr
       
  5322     "findNextForClass menu action: select the next change for the selected changes class"
       
  5323 
       
  5324     |cls|
       
  5325 
       
  5326     lastSearchType := #class.
       
  5327     changeNrShown isNil ifTrue:[^ self].
       
  5328 
       
  5329     cls := self classNameOfChange:changeNrShown.
       
  5330     cls isNil ifTrue:[^ self].
       
  5331 
       
  5332     self 
       
  5333         findNextForWhich:[:changeNr |
       
  5334                 |thisClass|
       
  5335 
       
  5336                 thisClass := self classNameOfChange:changeNr.
       
  5337                 (thisClass = cls
       
  5338                 or:[cls includesMatchCharacters and:[cls match:thisClass]])]
       
  5339         startingAt:startNr
       
  5340 
       
  5341     "Created: / 20-11-2006 / 16:37:37 / cg"
       
  5342 !
       
  5343 
       
  5344 findNextForSelector
       
  5345     "findNextForSelector menu action: select the next change for the selected changes selector"
       
  5346 
       
  5347     |sel|
       
  5348 
       
  5349     lastSearchType := #selector.
       
  5350     changeNrShown isNil ifTrue:[^ self].
       
  5351 
       
  5352     sel := self selectorOfMethodChange:changeNrShown.
       
  5353     sel isNil ifTrue:[^ self].
       
  5354 
       
  5355     self findNextForWhich: [:changeNr |
       
  5356 		|thisSelector|
       
  5357 
       
  5358 		thisSelector := self selectorOfMethodChange:changeNr.
       
  5359 		(thisSelector = sel or:[sel includesMatchCharacters and:[sel match:thisSelector]])
       
  5360 	]
       
  5361 
       
  5362 !
       
  5363 
       
  5364 findNextForString
       
  5365     lastSearchString isNil ifTrue:[
       
  5366 	^ self findString
       
  5367     ].
       
  5368     self findNextWithString:lastSearchString
       
  5369 !
       
  5370 
       
  5371 findNextForWhich:aBlock
       
  5372     "helper: select the next change for which aBlock evaluates to true"
       
  5373 
       
  5374     ^ self findNextForWhich:aBlock startingAt:changeNrShown + 1
       
  5375 
       
  5376     "Modified: / 20-11-2006 / 16:34:23 / cg"
       
  5377 !
       
  5378 
       
  5379 findNextForWhich:aBlock startingAt:changeNrToStartSearch
       
  5380     "helper: select the next change for which aBlock evaluates to true"
       
  5381 
       
  5382     ^ self     
       
  5383         findNextOrPrevious:#next 
       
  5384         forWhich:aBlock startingAt:changeNrToStartSearch
       
  5385 
       
  5386     "Created: / 20-11-2006 / 16:34:06 / cg"
       
  5387 !
       
  5388 
       
  5389 findNextOrPrevious:direction forWhich:aBlock startingAt:changeNrToStartSearch
       
  5390     "helper: find and select the next or previous change for which aBlock evaluates to true"
       
  5391 
       
  5392     self withCursor:Cursor questionMark do:[
       
  5393         Object userInterruptSignal handle:[:ex |
       
  5394             self beep.
       
  5395             ^ 0
       
  5396         ] do:[
       
  5397             |increment nr lastNr|
       
  5398 
       
  5399             increment := (direction == #previous) ifTrue:[-1] ifFalse:[1].
       
  5400             lastNr := self numberOfChanges.
       
  5401             nr := changeNrToStartSearch.
       
  5402             [ (direction == #previous and:[nr >= 1])
       
  5403               or:[ direction == #next and:[ nr <= lastNr]] 
       
  5404             ] whileTrue:[
       
  5405                 (aBlock value:nr) ifTrue:[
       
  5406                     changeListView setSelection:nr.
       
  5407                     self changeSelection:nr.
       
  5408                     ^ nr
       
  5409                 ].
       
  5410                 nr := nr + increment.
       
  5411             ].
       
  5412         ]
       
  5413     ].
       
  5414     self showNotFound.
       
  5415     self windowGroup sensor flushKeyboard. "/ avoid multiple beeps, in case of type ahead
       
  5416     ^ 0
       
  5417 
       
  5418     "Created: / 08-03-2012 / 11:57:26 / cg"
       
  5419 !
       
  5420 
       
  5421 findNextSnapshot
       
  5422     "findNextSnapshot menu action: select the next change which is for a snapShot-image save action"
       
  5423 
       
  5424     lastSearchType := #snapshot.
       
  5425     changeNrShown isNil ifTrue:[^ self].
       
  5426 
       
  5427     self findNextForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  5428 !
       
  5429 
       
  5430 findNextWithString:searchString
       
  5431     lastSearchType := #string.
       
  5432 
       
  5433     lastSearchString := searchString.
       
  5434 
       
  5435     changeNrShown isNil ifTrue:[
       
  5436 	changeNrShown := 0.
       
  5437     ].
       
  5438 
       
  5439     self findNextForWhich:
       
  5440 	[:changeNr |
       
  5441 	    |s|
       
  5442 
       
  5443 	    s := self sourceOfMethodChange:changeNr.
       
  5444 	    s notNil and:[
       
  5445 		(searchString includesMatchCharacters not
       
  5446 			    and:[(s findString:searchString) ~~ 0])
       
  5447 		or:[ searchString includesMatchCharacters
       
  5448 			    and:[('*' , searchString , '*') match:s ]]]
       
  5449 	].
       
  5450 
       
  5451     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  5452 
       
  5453     codeView setSearchPattern:searchString.
       
  5454     codeView
       
  5455 	searchFwd:searchString
       
  5456 	ignoreCase:false
       
  5457 	startingAtLine:1 col:0
       
  5458 	ifAbsent:nil.
       
  5459 
       
  5460 !
       
  5461 
       
  5462 findPrevious
       
  5463     "findPrevious menu action: select the previous change.
       
  5464      Searches for what the last search was for; i.e. either same class or same selector"
       
  5465 
       
  5466     lastSearchType == #selector ifTrue:[
       
  5467 	^ self findPreviousForSelector
       
  5468     ].
       
  5469     lastSearchType == #snapshot ifTrue:[
       
  5470 	^ self findPreviousSnapshot
       
  5471     ].
       
  5472     lastSearchType == #string ifTrue:[
       
  5473 	^ self findPreviousForString
       
  5474     ].
       
  5475     lastSearchType == #difference ifTrue:[
       
  5476 	^ self findPreviousDifference
       
  5477     ].
       
  5478 
       
  5479     ^ self findPreviousForClass
       
  5480 
       
  5481     "Created: / 18.6.1998 / 22:15:15 / cg"
       
  5482 !
       
  5483 
       
  5484 findPreviousDifference
       
  5485     lastSearchType := #difference.
       
  5486     changeNrShown isNil ifTrue:[^ self].
       
  5487 
       
  5488     self findPreviousForWhich:[:changeNr |
       
  5489 	    (self compareChange:changeNr showResult:false) == true ifTrue:[
       
  5490 		"/ same
       
  5491 		false
       
  5492 	    ] ifFalse:[
       
  5493 		"/ different
       
  5494 		true
       
  5495 	    ]
       
  5496 	]
       
  5497 !
       
  5498 
       
  5499 findPreviousForClass
       
  5500     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  5501 
       
  5502     self findPreviousForClassStartingAt:(changeNrShown - 1)
       
  5503 
       
  5504     "Modified: / 20-11-2006 / 16:39:04 / cg"
       
  5505 !
       
  5506 
       
  5507 findPreviousForClassStartingAt:startNr
       
  5508     "findPreviousForClass menu action: select the previous change for the selected changes class"
       
  5509 
       
  5510     |cls|
       
  5511 
       
  5512     lastSearchType := #class.
       
  5513     changeNrShown isNil ifTrue:[^ self].
       
  5514 
       
  5515     cls := self classNameOfChange:changeNrShown.
       
  5516     cls isNil ifTrue:[^ self].
       
  5517 
       
  5518     self 
       
  5519         findPreviousForWhich:
       
  5520             [:changeNr |
       
  5521                     |thisClass|
       
  5522 
       
  5523                     thisClass := self classNameOfChange:changeNr.
       
  5524                     (thisClass = cls
       
  5525                     or:[cls includesMatchCharacters and:[cls match:thisClass]])]
       
  5526         startingAt:startNr
       
  5527 
       
  5528     "Created: / 20-11-2006 / 16:38:37 / cg"
       
  5529 !
       
  5530 
       
  5531 findPreviousForSelector
       
  5532     "findPreviousForSelector menu action: select the previous change for the selected changes selector"
       
  5533 
       
  5534     |sel|
       
  5535 
       
  5536     lastSearchType := #selector.
       
  5537     changeNrShown isNil ifTrue:[^ self].
       
  5538 
       
  5539     sel := self selectorOfMethodChange:changeNrShown.
       
  5540     sel isNil ifTrue:[^ self].
       
  5541 
       
  5542     self findPreviousForWhich:
       
  5543 	[:changeNr |
       
  5544 		|thisSelector|
       
  5545 
       
  5546 		thisSelector := self selectorOfMethodChange:changeNr.
       
  5547 		(thisSelector = sel
       
  5548 		or:[sel includesMatchCharacters and:[sel match:thisSelector]])
       
  5549 	]
       
  5550 
       
  5551 !
       
  5552 
       
  5553 findPreviousForString
       
  5554     lastSearchString isNil ifTrue:[
       
  5555 	^ self findString
       
  5556     ].
       
  5557     self findPreviousWithString:lastSearchString
       
  5558 !
       
  5559 
       
  5560 findPreviousForWhich:aBlock
       
  5561     "helper: select the previous change for which aBlock evaluates to true"
       
  5562 
       
  5563     ^ self findPreviousForWhich:aBlock startingAt:(changeNrShown - 1)
       
  5564 
       
  5565     "Modified: / 06-10-2006 / 11:01:38 / cg"
       
  5566 !
       
  5567 
       
  5568 findPreviousForWhich:aBlock startingAt:changeNrToStartSearch
       
  5569     "helper: select the previous change for which aBlock evaluates to true"
       
  5570 
       
  5571     ^ self     
       
  5572         findNextOrPrevious:#previous 
       
  5573         forWhich:aBlock startingAt:changeNrToStartSearch
       
  5574 
       
  5575     "Created: / 06-10-2006 / 11:01:09 / cg"
       
  5576 !
       
  5577 
       
  5578 findPreviousSnapshot
       
  5579     "findPreviousSnapshot menu action: select the previous change which is for a snapShot-image save action"
       
  5580 
       
  5581     lastSearchType := #snapshot.
       
  5582     changeNrShown isNil ifTrue:[^ self].
       
  5583 
       
  5584     self findPreviousForWhich: [:changeNr | self changeIsSnapShotInfo:changeNr ]
       
  5585 !
       
  5586 
       
  5587 findPreviousWithString:searchString
       
  5588     lastSearchType := #string.
       
  5589 
       
  5590     lastSearchString := searchString.
       
  5591 
       
  5592     changeNrShown isNil ifTrue:[
       
  5593 	changeNrShown := 0.
       
  5594     ].
       
  5595 
       
  5596     self findPreviousForWhich:
       
  5597 	[:changeNr |
       
  5598 	    |s includesMatchCharacters|
       
  5599 
       
  5600 	    includesMatchCharacters := searchString includesMatchCharacters.
       
  5601 	    s := self sourceOfMethodChange:changeNr.
       
  5602 	    s notNil and:[
       
  5603 		(includesMatchCharacters not and:[(s findString:searchString) ~~ 0])
       
  5604 		or:[includesMatchCharacters and:[('*' , searchString , '*') match:s ]]]
       
  5605 	].
       
  5606 
       
  5607     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  5608 
       
  5609     codeView setSearchPattern:searchString.
       
  5610     codeView
       
  5611 	searchFwd:searchString
       
  5612 	ignoreCase:false
       
  5613 	startingAtLine:1 col:0
       
  5614 	ifAbsent:nil.
       
  5615 
       
  5616 !
       
  5617 
       
  5618 findSelector
       
  5619     "findSelector menu action: let user enter a selector, and select the next change for that selector"
       
  5620 
       
  5621     |current|
       
  5622 
       
  5623     changeNrShown notNil ifTrue:[
       
  5624 	current := self selectorOfMethodChange:changeNrShown.
       
  5625     ].
       
  5626 
       
  5627     self
       
  5628 	askForSearch:'Selector to search for:'
       
  5629 	initialAnswer:current
       
  5630 	thenSearchUsing:[:searchString :changeNr |
       
  5631 			    |thisSelector|
       
  5632 
       
  5633 			    thisSelector := self selectorOfMethodChange:changeNr.
       
  5634 			    (thisSelector = searchString
       
  5635 			    or:[searchString includesMatchCharacters and:[searchString match:thisSelector]])
       
  5636 			]
       
  5637 	onCancel:[^ self].
       
  5638 
       
  5639     lastSearchType := #selector.
       
  5640     changeNrShown == 0 ifTrue:[changeNrShown := nil].
       
  5641 !
       
  5642 
       
  5643 findString
       
  5644     |searchString directionHolder|
       
  5645 
       
  5646     lastSearchType := #string.
       
  5647 
       
  5648     searchString := codeView selection.
       
  5649     searchString size == 0 ifTrue:[searchString := lastSearchString].
       
  5650 
       
  5651     searchString := self
       
  5652 	askForSearchString:'String to search for:'
       
  5653 	initialAnswer:(searchString ? '')
       
  5654 	directionInto:(directionHolder := ValueHolder new).
       
  5655 
       
  5656     searchString size == 0 ifTrue:[
       
  5657 	^ self
       
  5658     ].
       
  5659 
       
  5660     directionHolder value == #backward ifTrue:[
       
  5661 	self findPreviousWithString:searchString.
       
  5662     ] ifFalse:[
       
  5663 	self findNextWithString:searchString.
       
  5664     ]
       
  5665 !
  5734 !
  5666 
  5735 
  5667 noChangesAllowed
  5736 noChangesAllowed
  5668     "show a warning that changes cannot be changed"
  5737     "show a warning that changes cannot be changed"
  5669 
  5738 
  5707 
  5776 
  5708 selectionChanged
  5777 selectionChanged
  5709 self halt
  5778 self halt
  5710 
  5779 
  5711     "Created: / 03-01-2012 / 15:26:36 / cg"
  5780     "Created: / 03-01-2012 / 15:26:36 / cg"
  5712 !
       
  5713 
       
  5714 setEnforcedNameSpace
       
  5715     |nsName listOfKnownNameSpaces keepAsDefaultHolder|
       
  5716 
       
  5717     listOfKnownNameSpaces := Set new.
       
  5718     NameSpace
       
  5719         allNameSpaces
       
  5720             do:[:eachNameSpace |
       
  5721                 listOfKnownNameSpaces add:eachNameSpace name
       
  5722             ].
       
  5723     listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort.
       
  5724 
       
  5725     Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
       
  5726         |box|
       
  5727 
       
  5728         keepAsDefaultHolder := true asValue.
       
  5729         box := ex parameter.
       
  5730         box verticalPanel
       
  5731             add:((CheckBox 
       
  5732                     label:(resources string:'Use this as default in the future')) 
       
  5733                     model:keepAsDefaultHolder).
       
  5734         ex proceed.
       
  5735     ] do:[
       
  5736         nsName := Dialog
       
  5737                 request:'When applying, new classes are created in nameSpace:'
       
  5738                 initialAnswer:(enforcedNameSpace ? LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name)
       
  5739                 list:listOfKnownNameSpaces.
       
  5740     ].
       
  5741     nsName isNil ifTrue:[^ self].
       
  5742 
       
  5743     (nsName isEmpty or:[nsName = 'Smalltalk']) ifTrue:[
       
  5744         applyInOriginalNameSpace value:true.
       
  5745         LastEnforcedNameSpace := enforcedNameSpace := nil.
       
  5746     ] ifFalse:[
       
  5747         applyInOriginalNameSpace value:false.
       
  5748         LastEnforcedNameSpace := enforcedNameSpace := NameSpace name:nsName.
       
  5749         autoCompare value ifTrue:[
       
  5750             self doUpdate
       
  5751         ].
       
  5752     ].
       
  5753     KeepEnforcedNameSpace := keepAsDefaultHolder value
       
  5754 
       
  5755     "Modified: / 07-09-2006 / 15:10:25 / cg"
       
  5756 !
       
  5757 
       
  5758 setEnforcedPackage
       
  5759     |pkg listOfKnownPackages|
       
  5760 
       
  5761     listOfKnownPackages := Set new.
       
  5762     Smalltalk allClassesDo:[:eachClass |
       
  5763 				|package|
       
  5764 
       
  5765 				package := eachClass package.
       
  5766 				package size > 0 ifTrue:[
       
  5767 				    listOfKnownPackages add:package
       
  5768 				]
       
  5769 			   ].
       
  5770     listOfKnownPackages := listOfKnownPackages asOrderedCollection sort.
       
  5771 
       
  5772     pkg := Dialog
       
  5773 		request:'When applying, changes go into package:'
       
  5774 		initialAnswer:(enforcedPackage ? Class packageQuerySignal query)
       
  5775 		list:listOfKnownPackages.
       
  5776     pkg size ~~ 0 ifTrue:[
       
  5777 	enforcedPackage := pkg
       
  5778     ]
       
  5779 ! !
  5781 ! !
  5780 
  5782 
  5781 !ChangesBrowser::ChangeFileReader methodsFor:'accessing'!
  5783 !ChangesBrowser::ChangeFileReader methodsFor:'accessing'!
  5782 
  5784 
  5783 autoCompare:something
  5785 autoCompare:something
  6448 ! !
  6450 ! !
  6449 
  6451 
  6450 !ChangesBrowser class methodsFor:'documentation'!
  6452 !ChangesBrowser class methodsFor:'documentation'!
  6451 
  6453 
  6452 version
  6454 version
  6453     ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.428 2012/04/05 11:12:53 stefan Exp $'
  6455     ^ '$Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.429 2012/05/08 12:07:14 cg Exp $'
  6454 !
  6456 !
  6455 
  6457 
  6456 version_CVS
  6458 version_CVS
  6457     ^ '§Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.428 2012/04/05 11:12:53 stefan Exp §'
  6459     ^ '§Header: /cvs/stx/stx/libtool/ChangesBrowser.st,v 1.429 2012/05/08 12:07:14 cg Exp §'
  6458 !
  6460 !
  6459 
  6461 
  6460 version_SVN
  6462 version_SVN
  6461     ^ '$Id: ChangesBrowser.st 7978 2012-04-13 13:15:47Z vranyj1 $'
  6463     ^ '$Id: ChangesBrowser.st 8007 2012-06-05 14:49:00Z vranyj1 $'
  6462 ! !
  6464 ! !