Tools__MethodList.st
changeset 14105 efc7e0052de5
parent 14100 bf291c1fe96f
child 14108 63d31145e7bb
equal deleted inserted replaced
14104:4d926da55a90 14105:efc7e0052de5
  1635 !
  1635 !
  1636 
  1636 
  1637 listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst suppressInheritanceInfo:suppressInheritanceInfo
  1637 listEntryForMethod:aMethod selector:selector class:cls showClass:showClass showCategory:showCategory classFirst:showClassFirst suppressInheritanceInfo:suppressInheritanceInfo
  1638     "answer a method list entry
  1638     "answer a method list entry
  1639      gimmics:
  1639      gimmics:
  1640 	adding a little image to breakPointed methods,
  1640         adding a little image to breakPointed methods,
  1641 	inheritance indicators,
  1641         inheritance indicators,
  1642 	highlight accessors of variable"
  1642         highlight accessors of variable"
  1643 
  1643 
  1644     |s icn variablesToHighlight classVarsToHighLight
  1644     |s icn variablesToHighlight classVarsToHighLight
  1645      doHighLight doHighLightRed clr emp cat l redefIcon
  1645      doHighLight doHighLightRed clr emp cat l redefIcon
  1646      metrics complexity complexityString complexityIcon mark lastResultOrNil|
  1646      metrics complexity complexityString complexityIcon mark lastResultOrNil|
  1647 
  1647 
  1648     aMethod isNil ifTrue:[
  1648     aMethod isNil ifTrue:[
  1649 	"/ a non-existing (pseudo) method (such as required protocol)
  1649         "/ a non-existing (pseudo) method (such as required protocol)
  1650 	^ selector colorizeAllWith:Color red.
  1650         ^ selector colorizeAllWith:Color red.
  1651     ].
  1651     ].
  1652 
  1652 
  1653     showClassFirst ifTrue:[
  1653     showClassFirst ifTrue:[
  1654 	s := aMethod printStringForBrowserWithSelector:selector allBold inClass:cls.
  1654         s := aMethod printStringForBrowserWithSelector:selector allBold inClass:cls.
  1655 	s := cls nameInBrowser , ' ' , s
  1655         s := cls nameInBrowser , ' ' , s
  1656     ] ifFalse:[
  1656     ] ifFalse:[
  1657 	s := aMethod printStringForBrowserWithSelector:selector inClass:cls.
  1657         s := aMethod printStringForBrowserWithSelector:selector inClass:cls.
  1658     ].
  1658     ].
  1659 
  1659 
  1660     "/
  1660     "/
  1661     "/ wrap icons (i.e. break- or trace points on the method)
  1661     "/ wrap icons (i.e. break- or trace points on the method)
  1662     "/ have higher prio ...
  1662     "/ have higher prio ...
  1663     "/
  1663     "/
  1664     (aMethod notNil and:[aMethod isWrapped]) ifTrue:[
  1664     (aMethod notNil and:[aMethod isWrapped]) ifTrue:[
  1665 	(s endsWith:' !!') ifTrue:[
  1665         (s endsWith:' !!') ifTrue:[
  1666 	    s := s copyButLast:2
  1666             s := s copyButLast:2
  1667 	].
  1667         ].
  1668 	aMethod isBreakpointed ifTrue:[
  1668         aMethod isBreakpointed ifTrue:[
  1669 	    icn := self stopIcon
  1669             icn := self stopIcon
  1670 	] ifFalse:[
  1670         ] ifFalse:[
  1671 	    aMethod isTimed ifTrue:[
  1671             aMethod isTimed ifTrue:[
  1672 		icn := self timeIcon
  1672                 icn := self timeIcon
  1673 	    ] ifFalse:[
  1673             ] ifFalse:[
  1674 		icn := self traceIcon
  1674                 icn := self traceIcon
  1675 	    ]
  1675             ]
  1676 	].
  1676         ].
  1677     ].
  1677     ].
  1678 
  1678 
  1679     "/
  1679     "/
  1680     "/ breakpoint icons (i.e. break- or trace points inside)
  1680     "/ breakpoint icons (i.e. break- or trace points inside)
  1681     "/
  1681     "/
  1682     icn isNil ifTrue:[
  1682     icn isNil ifTrue:[
  1683 	(aMethod notNil and:[aMethod isMethodWithBreakpoints]) ifTrue:[
  1683         (aMethod notNil and:[aMethod isMethodWithBreakpoints]) ifTrue:[
  1684 	    icn := self breakPointedIcon
  1684             icn := self breakPointedIcon
  1685 	].
  1685         ].
  1686     ].
  1686     ].
  1687 
  1687 
  1688     icn isNil ifTrue:[
  1688     icn isNil ifTrue:[
  1689 	self showImageResourceMethodsImages value ~~ false ifTrue:[
  1689         self showImageResourceMethodsImages value ~~ false ifTrue:[
  1690 	    (aMethod hasImageResource) ifTrue:[
  1690             (aMethod hasImageResource) ifTrue:[
  1691 		aMethod mclass isMeta ifTrue:[
  1691                 aMethod mclass isMeta ifTrue:[
  1692 		    icn := aMethod valueWithReceiver:nil arguments:nil .
  1692                     icn := aMethod valueWithReceiver:nil arguments:nil .
  1693 		].
  1693                 ].
  1694 	    ].
  1694             ].
  1695 	].
  1695         ].
  1696     ].
  1696     ].
  1697 
  1697 
  1698     icn isNil ifTrue:[
  1698     icn isNil ifTrue:[
  1699 	showMethodTypeIcon value ~~ false ifTrue:[
  1699         showMethodTypeIcon value ~~ false ifTrue:[
  1700 	    icn := self resourceIconForMethod:aMethod.
  1700             icn := self resourceIconForMethod:aMethod.
  1701 	].
  1701         ].
  1702 	icn isNil ifTrue:[
  1702         icn isNil ifTrue:[
  1703 	    aMethod isProtected ifTrue:[
  1703             aMethod isProtected ifTrue:[
  1704 		icn := self protectedMethodIcon
  1704                 icn := self protectedMethodIcon
  1705 	    ] ifFalse:[
  1705             ] ifFalse:[
  1706 		aMethod isPrivate ifTrue:[
  1706                 aMethod isPrivate ifTrue:[
  1707 		    icn := self privateMethodIcon
  1707                     icn := self privateMethodIcon
  1708 		] ifFalse:[
  1708                 ] ifFalse:[
  1709 		    (aMethod isIgnored) ifTrue:[
  1709                     (aMethod isIgnored) ifTrue:[
  1710 			icn := self ignoredMethodIcon
  1710                         icn := self ignoredMethodIcon
  1711 		    ] ifFalse:[
  1711                     ] ifFalse:[
  1712 			(aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[
  1712                         (aMethod isJavaMethod and:[aMethod isAbstract]) ifTrue:[
  1713 			    icn := self abstractMethodIcon
  1713                             icn := self abstractMethodIcon
  1714 			]
  1714                         ]
  1715 		    ]
  1715                     ]
  1716 		]
  1716                 ]
  1717 	    ].
  1717             ].
  1718 	].
  1718         ].
  1719     ].
  1719     ].
  1720     icn isNil ifTrue:[
  1720     icn isNil ifTrue:[
  1721 	(selector startsWith:'test') ifTrue:[
  1721         (selector startsWith:'test') ifTrue:[
  1722 	    ((cls isSubclassOf:TestCase)
  1722             ((cls isSubclassOf:TestCase)
  1723 	    and:[cls isAbstract not]) ifTrue:[
  1723             and:[cls isAbstract not]) ifTrue:[
  1724 		"JV@2011-11-17: Show thumbs even if not all test were run"
  1724                 "JV@2011-11-17: Show thumbs even if not all test were run"
  1725 
  1725 
  1726 		lastResultOrNil := cls rememberedOutcomeFor:selector.
  1726                 lastResultOrNil := cls rememberedOutcomeFor:selector.
  1727 		lastResultOrNil notNil ifTrue:[
  1727                 lastResultOrNil notNil ifTrue:[
  1728 		    |state|
  1728                     |state|
  1729 
  1729 
  1730 		    state := lastResultOrNil result.
  1730                     state := lastResultOrNil result.
  1731 		    (state == TestResult statePass) ifTrue:[
  1731                     (state == TestResult statePass) ifTrue:[
  1732 			icn := ToolbarIconLibrary testCasePassedIcon
  1732                         icn := ToolbarIconLibrary testCasePassedIcon
  1733 		    ] ifFalse:[
  1733                     ] ifFalse:[
  1734 			(state == TestResult stateError) ifTrue:[
  1734                         (state == TestResult stateError) ifTrue:[
  1735 			    icn := ToolbarIconLibrary testCaseErrorIcon
  1735                             icn := ToolbarIconLibrary testCaseErrorIcon
  1736 			] ifFalse:[
  1736                         ] ifFalse:[
  1737 			    (state == TestResult stateFail) ifTrue:[
  1737                             (state == TestResult stateFail) ifTrue:[
  1738 				icn := ToolbarIconLibrary testCaseFailedIcon
  1738                                 icn := ToolbarIconLibrary testCaseFailedIcon
  1739 			    ] ifFalse:[
  1739                             ] ifFalse:[
  1740 				icn := ToolbarIconLibrary testCaseSkippedIcon
  1740                                 icn := ToolbarIconLibrary testCaseSkippedIcon
  1741 			    ]
  1741                             ]
  1742 			]
  1742                         ]
  1743 		    ]
  1743                     ]
  1744 		].
  1744                 ].
  1745 	    ].
  1745             ].
  1746 	]
  1746         ]
  1747     ].
  1747     ].
  1748 
  1748 
  1749     showClass ifTrue:[
  1749     showClass ifTrue:[
  1750 	showClassFirst ifFalse:[
  1750         showClassFirst ifFalse:[
  1751 	    s := s , ' [' , cls name allBold , ']'.
  1751             s := s , ' [' , cls name allBold , ']'.
  1752 	]
  1752         ]
  1753     ].
  1753     ].
  1754     (showCategory and:[aMethod mclass supportsMethodCategories]) ifTrue:[
  1754     (showCategory and:[aMethod mclass supportsMethodCategories]) ifTrue:[
  1755 	cat := aMethod category.
  1755         cat := aMethod category.
  1756 	cat notNil ifTrue:[
  1756         cat notNil ifTrue:[
  1757 	    s := s , ' {' , (cat "asText allItalic" colorizeAllWith:Color grey), '}'
  1757             s := s , ' {' , (cat "asText allItalic" colorizeAllWith:Color grey), '}'
  1758 	]
  1758         ]
  1759     ].
  1759     ].
  1760 
  1760 
  1761     self showCoverageInformation value ifTrue:[
  1761     (self showCoverageInformation value and:[(clr := self colorForCoverageInformationOfMethod:aMethod) notNil]) ifTrue:[
  1762 	clr := self colorForCoverageInformationOfMethod:aMethod.
  1762         s := self colorize:s with:(#color->clr).
  1763 	clr notNil ifTrue:[
  1763         "/ aMethod isInstrumented ifTrue:[
  1764 	    s := self colorize:s with:(#color->clr).
  1764         "/     icn := self instrumentationIcon
  1765 	    "/ aMethod isInstrumented ifTrue:[
  1765         "/ ].
  1766 	    "/     icn := self instrumentationIcon
       
  1767 	    "/ ].
       
  1768 	].
       
  1769     ] ifFalse:[
  1766     ] ifFalse:[
  1770 	(ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[
  1767         (ChangeSet current includesChangeForClass:cls selector:selector) ifTrue:[
  1771 	    mark := self class markForBeingInChangeList.
  1768             mark := self class markForBeingInChangeList.
  1772 	    "/ mark := self colorizeForChangedCode:mark.
  1769             "/ mark := self colorizeForChangedCode:mark.
  1773 	    s := s , mark.
  1770             s := s , mark.
  1774 	    "/ cg: I dont know why this was disabled - it is req'd to
  1771             "/ cg: I dont know why this was disabled - it is req'd to
  1775 	    "/ see changed methods in a method list (implementors...)
  1772             "/ see changed methods in a method list (implementors...)
  1776 	    s := self colorizeForChangedCode:s.
  1773             s := self colorizeForChangedCode:s.
  1777 	].
  1774         ].
  1778 
  1775 
  1779 	(SmallTeam notNil and:[SmallTeam includesChangeForClass:cls selector:selector]) ifTrue:[
  1776         (SmallTeam notNil and:[SmallTeam includesChangeForClass:cls selector:selector]) ifTrue:[
  1780 	    s := (self colorizeForChangedCodeInSmallTeam:'!! '),s
  1777             s := (self colorizeForChangedCodeInSmallTeam:'!! '),s
  1781 	].
  1778         ].
  1782     ].
  1779     ].
  1783 
  1780 
  1784     variablesToHighlight := variableFilter value.
  1781     variablesToHighlight := variableFilter value.
  1785     variablesToHighlight size > 0 ifTrue:[
  1782     variablesToHighlight size > 0 ifTrue:[
  1786 	classVarsToHighLight := filterClassVars value.
  1783         classVarsToHighLight := filterClassVars value.
  1787 	classVarsToHighLight ifTrue:[
  1784         classVarsToHighLight ifTrue:[
  1788 	    doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight.
  1785             doHighLight := self method:aMethod includesRefsToClassVariable:variablesToHighlight.
  1789 	    doHighLight ifTrue:[
  1786             doHighLight ifTrue:[
  1790 		doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight.
  1787                 doHighLightRed := self method:aMethod includesModsOfClassVariable:variablesToHighlight.
  1791 	    ].
  1788             ].
  1792 	] ifFalse:[
  1789         ] ifFalse:[
  1793 	    doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight.
  1790             doHighLight := self method:aMethod includesRefsToInstanceVariable:variablesToHighlight.
  1794 	    doHighLight ifTrue:[
  1791             doHighLight ifTrue:[
  1795 		doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight
  1792                 doHighLightRed := self method:aMethod includesModsOfInstanceVariable:variablesToHighlight
  1796 	    ]
  1793             ]
  1797 	].
  1794         ].
  1798 	doHighLight ifTrue:[
  1795         doHighLight ifTrue:[
  1799 	    s := s allBold.
  1796             s := s allBold.
  1800 	    doHighLightRed ifTrue:[
  1797             doHighLightRed ifTrue:[
  1801 		emp := (UserPreferences current emphasisForWrittenVariable)
  1798                 emp := (UserPreferences current emphasisForWrittenVariable)
  1802 	    ] ifFalse:[
  1799             ] ifFalse:[
  1803 		emp := (UserPreferences current emphasisForReadVariable)
  1800                 emp := (UserPreferences current emphasisForReadVariable)
  1804 	    ].
  1801             ].
  1805 	    s := s emphasisAllAdd:emp
  1802             s := s emphasisAllAdd:emp
  1806 	]
  1803         ]
  1807     ].
  1804     ].
  1808 
  1805 
  1809     (showMethodComplexity value == true
  1806     (showMethodComplexity value == true
  1810     and:[ OOM::MethodMetrics notNil ]) ifTrue:[
  1807     and:[ OOM::MethodMetrics notNil ]) ifTrue:[
  1811 	icn isNil ifTrue:[
  1808         icn isNil ifTrue:[
  1812 		metrics := OOM::MethodMetrics forMethod:aMethod.
  1809                 metrics := OOM::MethodMetrics forMethod:aMethod.
  1813 		complexity := metrics complexity ? 0.
  1810                 complexity := metrics complexity ? 0.
  1814 		complexityIcon := OOM::MethodMetrics iconForComplexity:complexity.
  1811                 complexityIcon := OOM::MethodMetrics iconForComplexity:complexity.
  1815 
  1812 
  1816 		ShowComplexityValue == true ifTrue:[
  1813                 ShowComplexityValue == true ifTrue:[
  1817 		    complexityString := '{' , complexity printString , '}'.
  1814                     complexityString := '{' , complexity printString , '}'.
  1818 		    s := complexityString , ' ' , s.
  1815                     s := complexityString , ' ' , s.
  1819 		].
  1816                 ].
  1820 		"/ icn := icn ? complexityIcon.
  1817                 "/ icn := icn ? complexityIcon.
  1821 		s := LabelAndIcon icon:complexityIcon string:s.
  1818                 s := LabelAndIcon icon:complexityIcon string:s.
  1822 	].
  1819         ].
  1823     ].
  1820     ].
  1824 
  1821 
  1825     (showMethodInheritance value ? true) ifTrue:[
  1822     (showMethodInheritance value ? true) ifTrue:[
  1826 	suppressInheritanceInfo ifTrue:[
  1823         suppressInheritanceInfo ifTrue:[
  1827 	    redefIcon := self methodEmptyInheritedIcon.
  1824             redefIcon := self methodEmptyInheritedIcon.
  1828 	] ifFalse:[
  1825         ] ifFalse:[
  1829 	    redefIcon := self redefinedOrInheritedIconFor:aMethod.
  1826             redefIcon := self redefinedOrInheritedIconFor:aMethod.
  1830 	].
  1827         ].
  1831     ].
  1828     ].
  1832 
  1829 
  1833     (icn notNil or:[redefIcon notNil]) ifTrue:[
  1830     (icn notNil or:[redefIcon notNil]) ifTrue:[
  1834 	"/eXept version
  1831         "/eXept version
  1835 	"/l := LabelAndIcon icon:redefIcon string:s.
  1832         "/l := LabelAndIcon icon:redefIcon string:s.
  1836 	"/l image:icn.
  1833         "/l image:icn.
  1837 	"/JV:
  1834         "/JV:
  1838 	l := LabelAndIcon icon:icn string:s.
  1835         l := LabelAndIcon icon:icn string:s.
  1839 	l image:redefIcon.
  1836         l image:redefIcon.
  1840 	icn isNil ifTrue:[l offset: 13].
  1837         icn isNil ifTrue:[l offset: 13].
  1841 	l gap:1.
  1838         l gap:1.
  1842 	^ l
  1839         ^ l
  1843     ].
  1840     ].
  1844     ^ s
  1841     ^ s
  1845 
  1842 
  1846     "Created: / 22-10-1996 / 19:51:00 / cg"
  1843     "Created: / 22-10-1996 / 19:51:00 / cg"
  1847     "Modified: / 15-08-2009 / 13:13:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1844     "Modified: / 15-08-2009 / 13:13:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
  1848     "Modified: / 07-03-2012 / 19:06:09 / cg"
  1845     "Modified: / 07-03-2012 / 19:06:09 / cg"
  1849     "Modified: / 16-10-2013 / 01:10:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1846     "Modified: / 05-03-2014 / 10:07:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1850 ! !
  1847 ! !
  1851 
  1848 
  1852 !MethodList methodsFor:'private-watching'!
  1849 !MethodList methodsFor:'private-watching'!
  1853 
  1850 
  1854 startWatchProcess
  1851 startWatchProcess
  1894 ! !
  1891 ! !
  1895 
  1892 
  1896 !MethodList class methodsFor:'documentation'!
  1893 !MethodList class methodsFor:'documentation'!
  1897 
  1894 
  1898 version
  1895 version
  1899     ^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.98 2014-03-04 09:11:59 cg Exp $'
  1896     ^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.99 2014-03-05 10:12:25 vrany Exp $'
  1900 !
  1897 !
  1901 
  1898 
  1902 version_CVS
  1899 version_CVS
  1903     ^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.98 2014-03-04 09:11:59 cg Exp $'
  1900     ^ '$Header: /cvs/stx/stx/libtool/Tools__MethodList.st,v 1.99 2014-03-05 10:12:25 vrany Exp $'
  1904 ! !
  1901 ! !
       
  1902