Tools__ClassList.st
changeset 17516 b7b3597d66f2
parent 17482 e5390555ee86
child 17606 d028acd721db
equal deleted inserted replaced
17515:b047dbe6d95c 17516:b7b3597d66f2
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2004 by eXept Software AG
     4  COPYRIGHT (c) 2004 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  1469 
  1471 
  1470                 bucket := privateClassesPerClass at:eachClass ifAbsent:nil.
  1472                 bucket := privateClassesPerClass at:eachClass ifAbsent:nil.
  1471                 bucket notNil ifTrue:[
  1473                 bucket notNil ifTrue:[
  1472                     bucket do:action.
  1474                     bucket do:action.
  1473                 ]
  1475                 ]
  1474         ].
  1476             ].
  1475 
  1477 
  1476         classesOrdered do:action.
  1478         classesOrdered do:action.
  1477         classesOrdered := stream contents.
  1479         classesOrdered := stream contents.
  1478     ].
  1480     ].
  1479 
  1481 
  1485     "Modified: / 18-08-2000 / 20:34:10 / cg"
  1487     "Modified: / 18-08-2000 / 20:34:10 / cg"
  1486     "Modified: / 21-01-2008 / 19:43:04 / janfrog"
  1488     "Modified: / 21-01-2008 / 19:43:04 / janfrog"
  1487     "Modified: / 24-08-2010 / 20:17:07 / Jan Vrany"
  1489     "Modified: / 24-08-2010 / 20:17:07 / Jan Vrany"
  1488     "Created: / 04-07-2011 / 18:27:34 / cg"
  1490     "Created: / 04-07-2011 / 18:27:34 / cg"
  1489     "Modified: / 06-08-2014 / 14:14:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1491     "Modified: / 06-08-2014 / 14:14:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1492     "Modified (format): / 22-05-2017 / 13:44:50 / stefan"
  1490 !
  1493 !
  1491 
  1494 
  1492 makeDependent
  1495 makeDependent
  1493     environment addDependent:self.
  1496     environment addDependent:self.
  1494     ChangeSet addDependent:self.
  1497     ChangeSet addDependent:self.
  1502 !
  1505 !
  1503 
  1506 
  1504 nameListForClasses:aClassList
  1507 nameListForClasses:aClassList
  1505     |orgMode namespaces showNamespaces fullNameList nameList
  1508     |orgMode namespaces showNamespaces fullNameList nameList
  1506      filteredPackages filteredNameSpaces classesInRemoteChangeSet
  1509      filteredPackages filteredNameSpaces classesInRemoteChangeSet
  1507      classNamesInChangeSet classNamesInRemoteChangeSet javaClassCountsByBname|
  1510      classNamesInChangeSet classNamesInRemoteChangeSet javaClassCountsByBname widthOfSpace|
  1508 
  1511 
  1509     showNamespaces := false.
  1512     showNamespaces := false.
  1510     filteredNameSpaces := nameSpaceFilter value.
  1513     filteredNameSpaces := nameSpaceFilter value.
  1511     orgMode := organizerMode value.
  1514     orgMode := organizerMode value.
  1512 
  1515 
  1545             javaClassCountsByBname
  1548             javaClassCountsByBname
  1546                 at:eachClass binaryName 
  1549                 at:eachClass binaryName 
  1547                 put:(javaClassCountsByBname at:eachClass ifAbsent:[0]) + 1
  1550                 put:(javaClassCountsByBname at:eachClass ifAbsent:[0]) + 1
  1548         ]
  1551         ]
  1549     ].
  1552     ].
       
  1553     widthOfSpace := ' ' widthOn:self window.
  1550 
  1554 
  1551     nameList := aClassList 
  1555     nameList := aClassList 
  1552                     collect:[:eachClass | 
  1556                     collect:[:eachClass | 
  1553                             |className nm pkg emPkg hasExtensions 
  1557                             |className nm pkg emPkg hasExtensions 
  1554                              isInChangeSet isInRemoteChangeSet icon clr|
  1558                              isInChangeSet isInRemoteChangeSet icon clr|
  1660                             eachClass isObsolete ifTrue:[ 
  1664                             eachClass isObsolete ifTrue:[ 
  1661                                 icon := SystemBrowser doNotEnterIcon. 
  1665                                 icon := SystemBrowser doNotEnterIcon. 
  1662                             ] ifFalse:[
  1666                             ] ifFalse:[
  1663                                 markApplicationsHolder value == true ifTrue:[
  1667                                 markApplicationsHolder value == true ifTrue:[
  1664                                     icon := self iconForClass:eachClass theNonMetaclass.
  1668                                     icon := self iconForClass:eachClass theNonMetaclass.
  1665                                     icon isNil ifTrue:[
  1669 "/                                    icon isNil ifTrue:[
  1666                                         "/ icon := SystemBrowser emptyIcon
  1670 "/                                        icon := SystemBrowser emptyIcon
  1667                                     ].
  1671 "/                                    ].
  1668                                 ]
  1672                                 ]
  1669                             ].
  1673                             ].
  1670                             icon notNil ifTrue:[
  1674                             icon notNil ifTrue:[
       
  1675                                 |indent iconWidth|
       
  1676 
       
  1677                                 (nm startsWith:Character space) ifTrue:[
       
  1678                                     "make sure, that indent is reduced by icon width (hack)"
       
  1679                                     iconWidth := icon width.
       
  1680                                     indent := (iconWidth // widthOfSpace)+1 min:nm leftIndent.
       
  1681                                     indent ~~ 0 ifTrue:[
       
  1682                                         nm := nm copyFrom:indent.
       
  1683                                     ].
       
  1684                                 ].
  1671                                 nm := LabelAndIcon icon:icon string:nm
  1685                                 nm := LabelAndIcon icon:icon string:nm
  1672                             ].
  1686                             ].
  1673                             nm
  1687                             nm
  1674                        ].   
  1688                        ].   
  1675 
  1689 
  1676     ^ nameList
  1690     ^ nameList
  1677 
  1691 
  1678     "Modified: / 27-10-2012 / 12:32:20 / cg"
  1692     "Modified: / 27-10-2012 / 12:32:20 / cg"
  1679     "Modified: / 11-08-2014 / 12:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1693     "Modified: / 11-08-2014 / 12:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1694     "Modified: / 23-05-2017 / 13:43:06 / stefan"
  1680 !
  1695 !
  1681 
  1696 
  1682 reconstructNameList
  1697 reconstructNameList
  1683     "only reconstruct the names - class list & selection remains unschanged.
  1698     "only reconstruct the names - class list & selection remains unschanged.
  1684      Invoked when the organizerMode mode changes"
  1699      Invoked when the organizerMode mode changes"
  1998     aClass == (self class nameListEntryForALL) ifTrue:[ ^ aClass ].
  2013     aClass == (self class nameListEntryForALL) ifTrue:[ ^ aClass ].
  1999 
  2014 
  2000     sortByNameAndInheritanceValue := self sortByNameAndInheritance value.
  2015     sortByNameAndInheritanceValue := self sortByNameAndInheritance value.
  2001 
  2016 
  2002     sortByNameAndInheritanceValue ifTrue:[
  2017     sortByNameAndInheritanceValue ifTrue:[
  2003         nm := (self nameListIndentStringFor: aClass withNameSpace: useFullName) , aClass nameInBrowser.
  2018         nm := (self nameListIndentStringFor:aClass) , aClass nameInBrowser.
  2004     ] ifFalse:[
  2019     ] ifFalse:[
  2005         nm := aClass nameInBrowser.
  2020         nm := aClass nameInBrowser.
  2006     ].
  2021     ].
  2007 
  2022 
  2008     aClass isLoaded ifFalse:[
  2023     aClass isLoaded ifTrue:[
       
  2024         aClass isAbstract ifTrue:[ nm := nm allItalic ].
       
  2025         nm := nm, ((' (%1+%2) ' bindWith:(aClass methodsCount ? '?') with:(aClass class methodsCount ? '?')) 
       
  2026                     withColor:self class pseudoEntryForegroundColor).
       
  2027     ] ifFalse:[
  2009         unloadedClassesColor notNil ifTrue:[
  2028         unloadedClassesColor notNil ifTrue:[
  2010             nm := nm withColor:unloadedClassesColor
  2029             nm := nm withColor:unloadedClassesColor
  2011         ]
       
  2012     ] ifTrue:[
       
  2013         | instMethodCount classMethodCount |   
       
  2014 
       
  2015         aClass isAbstract ifTrue:[ nm := nm allItalic ].
       
  2016         instMethodCount := aClass methodsCount.
       
  2017         classMethodCount := aClass class methodsCount.
       
  2018 
       
  2019         (instMethodCount notNil or:[ classMethodCount notNil ]) ifTrue:[ 
       
  2020             nm := nm, ((' (%1+%2) ' bindWith:(instMethodCount ? '?') with:(classMethodCount ? '?')) 
       
  2021                         withColor:self class pseudoEntryForegroundColor).
       
  2022         ]
  2030         ]
  2023     ].
  2031     ].
  2024 
  2032 
  2025     orgMode := organizerMode value.
  2033     orgMode := organizerMode value.
  2026     orgMode == OrganizerCanvas organizerModeHierarchy ifTrue:[
  2034     orgMode == OrganizerCanvas organizerModeHierarchy ifTrue:[
  2052     ].
  2060     ].
  2053 
  2061 
  2054     useFullName ifFalse:[
  2062     useFullName ifFalse:[
  2055         aClass isPrivate ifFalse:[
  2063         aClass isPrivate ifFalse:[
  2056             sortByNameAndInheritanceValue ifTrue:[
  2064             sortByNameAndInheritanceValue ifTrue:[
  2057                 ^ (self nameListIndentStringFor: aClass withNameSpace: useFullName) , aClass nameWithoutNameSpacePrefix 
  2065                 ^ (self nameListIndentStringFor:aClass) , aClass nameWithoutNameSpacePrefix 
  2058             ].
  2066             ].
  2059             ^ aClass nameWithoutNameSpacePrefix 
  2067             ^ aClass nameWithoutNameSpacePrefix 
  2060         ]
  2068         ]
  2061     ].
  2069     ].
  2062 
  2070 
  2063     "/ full name required if owner is not in the list
  2071     "/ full name required if owner is not in the list
  2064     owner := aClass owningClass.
  2072     owner := aClass owningClass.
  2065     (owner isNil
  2073     (owner notNil
  2066      or:[(self classList value includesIdentical:owner) not]) ifFalse:[
  2074      and:[self classList value includesIdentical:owner]) ifTrue:[
  2067         "/ namespace
  2075         "/ namespace
  2068         indent := (nm count:[:char | char == $:]) // 2.
  2076         indent := (nm count:[:char | char == $:]) // 2.
  2069         indent > 0 ifTrue:[
  2077         indent > 0 ifTrue:[
  2070             indent := indent * self indentPerPrivacyLevel.
  2078             indent := indent * self indentPerPrivacyLevel.
  2071             indentString := String new:indent withAll:Character space.
  2079             indentString := String new:indent withAll:Character space.
  2072             sortByNameAndInheritanceValue ifTrue:[
  2080             sortByNameAndInheritanceValue ifTrue:[
  2073                 nm := (self nameListIndentStringFor:owner withNameSpace:useFullName)
  2081                 nm := (self nameListIndentStringFor:owner)
  2074                         , indentString , '::' , aClass nameWithoutPrefix.
  2082                         , indentString , '::' , aClass nameWithoutPrefix.
  2075             ] ifFalse:[
  2083             ] ifFalse:[
  2076                 nm := indentString , '::' , aClass nameWithoutPrefix
  2084                 nm := indentString , '::' , aClass nameWithoutPrefix
  2077             ]
  2085             ]
  2078         ].
  2086         ].
  2080 
  2088 
  2081     ^ nm
  2089     ^ nm
  2082 
  2090 
  2083     "Modified: / 04-07-2011 / 19:00:45 / cg"
  2091     "Modified: / 04-07-2011 / 19:00:45 / cg"
  2084     "Modified: / 27-03-2015 / 16:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2092     "Modified: / 27-03-2015 / 16:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2085 !
  2093     "Modified: / 22-05-2017 / 13:32:22 / stefan"
  2086 
  2094 !
  2087 nameListIndentStringFor:aClass withNameSpace:useFullName 
  2095 
       
  2096 nameListIndentStringFor:aClass     
  2088     |indent indentString cls|
  2097     |indent indentString cls|
  2089 
  2098 
  2090     indent := 0.
  2099     indent := 0.
  2091     indentString := ''.
  2100     indentString := ''.
  2092     cls := aClass superclass.
  2101     cls := aClass superclass.
  2107             indentString := String new:indent * 2 withAll:Character space.
  2116             indentString := String new:indent * 2 withAll:Character space.
  2108         ].
  2117         ].
  2109     ].
  2118     ].
  2110     ^ indentString
  2119     ^ indentString
  2111 
  2120 
  2112     "Modified: / 24-02-2000 / 17:52:28 / cg"
  2121     "Created: / 22-05-2017 / 13:28:31 / stefan"
  2113     "Created: / 21-01-2008 / 19:02:07 / janfrog"
       
  2114     "Modified (format): / 04-07-2011 / 18:30:20 / cg"
       
  2115 ! !
  2122 ! !
  2116 
  2123 
  2117 !ClassList methodsFor:'queries'!
  2124 !ClassList methodsFor:'queries'!
  2118 
  2125 
  2119 supportsSearch
  2126 supportsSearch