tools/JavaListInspectorView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 15 Dec 2012 23:25:19 +0100
branchdevelopment
changeset 1883 b36e52129040
parent 1879 7d232ff32dde
child 2069 75d40b7b986f
permissions -rw-r--r--
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
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
OrderedCollectionInspectorView subclass:#JavaListInspectorView
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
!JavaListInspectorView 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
    |n|
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
    n := inspectedObject perform: #'size()I'.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    32
    (n > nShown) ifTrue:[
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    33
        n := nShown.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    34
        hasMore := true.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    35
    ].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    36
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    37
    ^ (1 to:n)
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
    "Created: / 04-12-2011 / 16:55:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    40
! !
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
!JavaListInspectorView methodsFor:'user interaction'!
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
indexedValueAtIndex:idx
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    45
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    46
    ^inspectedObject perform: #'get(I)Ljava/lang/Object;' with: idx - 1
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    47
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    48
    "Created: / 04-12-2011 / 16:58:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    49
!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    50
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    51
indexedValueAtIndex:idx put: value
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    52
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    53
    ^inspectedObject 
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    54
        perform: #'set(ILjava/lang/Object;)Ljava/lang/Object;'
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    55
        with: idx - 1
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    56
        with: value.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    57
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    58
    "Created: / 04-12-2011 / 16:58:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    59
!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    60
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    61
indexedValueAtKey: idx
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    62
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    63
    ^self indexedValueAtIndex: idx
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    64
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    65
    "Created: / 04-12-2011 / 17:25:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    66
!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    67
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    68
removeIndex
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    69
    "remove selected item from the collection"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    70
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    71
    |idx|
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    72
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    73
    idx := self keyIndexForLine:selectionIndex.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    74
    idx notNil ifTrue:[
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    75
        inspectedObject perform: #'remove(I)Ljava/lang/Object;' with:idx.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    76
        selectionIndex := selectedLine := nil.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    77
        inspectedObject changed.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    78
        self reinspect.
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    79
    ].
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    80
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    81
    "Created: / 04-12-2011 / 17:08:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    82
! !
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    83
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    84
!JavaListInspectorView class methodsFor:'documentation'!
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    85
1879
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    86
version_HG
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    87
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    88
    ^ '$Changeset: <not expanded> $'
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    89
!
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    90
1210
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    91
version_SVN
1879
7d232ff32dde Refactoring of JavaParserII>>importDeclaration
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1818
diff changeset
    92
    ^ '§Id§'
1210
52dcaa706df5 Added custom inspector classes to ease working with java objects
vranyj1
parents:
diff changeset
    93
! !