tools/JavaSetInspectorView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Jan 2013 17:57:06 +0000
branchrefactoring-vmdata
changeset 2002 ef3da336a6c9
parent 1879 7d232ff32dde
child 2069 75d40b7b986f
permissions -rw-r--r--
Merged ad1a490462ed and 1949478fd05e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1210
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     1
"{ Package: 'stx:libjava/tools' }"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     2
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     3
SetInspectorView subclass:#JavaSetInspectorView
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     4
	instanceVariableNames:''
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     5
	classVariableNames:''
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     6
	poolDictionaries:''
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     7
	category:'Languages-Java-Tools-Inspectors'
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     8
!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
     9
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    10
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    11
!JavaSetInspectorView methodsFor:'private'!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    12
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    13
baseInspectedObjectClass
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    14
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    15
    | cls |
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    16
    cls := inspectedObject class.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    17
    [ cls name startsWith: 'java/util/' ] whileFalse:[
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    18
        cls := cls superclass.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    19
    ].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    20
    ^cls.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    21
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    22
    "Created: / 04-12-2011 / 17:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    23
!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    24
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    25
indexList 
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    26
    "return a list of indexes to show in the selectionList.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    27
     Set hasMore to true, if a '...' entry should be added."
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    28
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    29
    | coll iterator | 
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    30
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    31
    coll := OrderedCollection new.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    32
    iterator := inspectedObject perform: #'iterator()Ljava/util/Iterator;'.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    33
    [ ( iterator perform: #'hasNext()Z' ) == 1 ] whileTrue:[
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    34
        coll add: ( iterator perform: #'next()Ljava/lang/Object;' ).
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    35
        coll size >= nShown ifTrue:[ 
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    36
            hasMore := true.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    37
            ^ coll asSortedCollection:[:a :b | a displayString < b displayString].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    38
        ].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    39
    ].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    40
    ^coll asSortedCollection:[:a :b | a displayString < b displayString].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    41
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    42
    "Created: / 04-12-2011 / 17:57:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    43
! !
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    44
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    45
!JavaSetInspectorView class methodsFor:'documentation'!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    46
1879
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    47
version_HG
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    48
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    49
    ^ '$Changeset: <not expanded> $'
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    50
!
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    51
1210
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    52
version_SVN
1879
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    53
    ^ '§Id§'
1210
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    54
! !