tools/JavaSourceDocument.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 04 Feb 2019 00:24:10 +0000
changeset 3886 292b73957757
parent 3412 df11bb428463
child 3609 2cfd15eb78cc
permissions -rw-r--r--
Fix initialization of system propertirs ...and use `amd64` consistenly instead of `x86_64`.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:libjava/tools' }"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Object subclass:#JavaSourceDocument
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
     4
	instanceVariableNames:'javaClass sourceText sourceTree sourceTreeIndex sourceLineEnds
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
     5
		sourceTreeLock'
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
     6
	classVariableNames:'Cache CacheSize Job'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	category:'Languages-Java-Tools-Source'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
!JavaSourceDocument class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
documentation
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
    JavaSourceDocument object keeps various useful information about one source 
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    16
    file. In particular, it keeps parse tree and pre-highlighted source.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
    [author:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
        Jan Vrany <jan.vrany@fit.cvut.cz>
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
    [instance variables:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    [class variables:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
    [see also:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!JavaSourceDocument class methodsFor:'initialization'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    "Invoked at system start or when the class is dynamically loaded."
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
    "/ please change as required (and remove this comment)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
    CacheSize := 25.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    38
    Cache := OrderedCollection new: CacheSize * 2 "To avoid excessive shifting...".
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    39
    Job := BackgroundQueueProcessingJob named: 'java parsing job' on:[:block | block value ].
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    41
    "Modified: / 06-09-2013 / 17:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
!JavaSourceDocument class methodsFor:'instance creation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
for: aJavaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    ^self new javaClass: aJavaClass.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    "Created: / 30-08-2013 / 01:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
!JavaSourceDocument class methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
cachedDocumentFor: aJavaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    "Returns a cached document for given class or nil if no cached 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
     document is found."
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    Cache withIndexDo:[:document :index|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
        document javaClass == aJavaClass ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
            "/ Move that document towards the end so it'll be less likely
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
            "/ to be removed
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
            index < Cache size ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
                Cache swap: index with: index + 1.                
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
            ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
            ^ document.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
        ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
    ^ nil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
    "Created: / 30-08-2013 / 01:27:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
cachedDocumentFor: aJavaClass put: aJavaSourceDocument
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    "Stores given source document in the cache"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    self assert: aJavaSourceDocument javaClass == aJavaClass.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    Cache size = CacheSize ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
        Cache removeFirst.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
    Cache addLast: aJavaSourceDocument
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    "Created: / 30-08-2013 / 01:42:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
!JavaSourceDocument methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    ^ javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    91
javaClass:aJavaClass    
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    92
    aJavaClass == javaClass ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    93
        ^ self
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    94
    ].
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    95
    self assert: javaClass isNil message: 'javaClass already set'.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    96
    self assert: aJavaClass isJavaClass message: 'aJavaClass not a Java class'.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    97
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    javaClass := aJavaClass.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    99
    self initializeSourceTree.
2697
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   101
    "Modified: / 21-09-2013 / 04:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2697
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
!
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   104
sourceLineToOffset: lineNr
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   105
    lineNr == 1 ifTrue:[ ^ 1 ].
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   106
    ^  (sourceLineEnds at: lineNr - 1) + 1.
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   107
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   108
    "Created: / 08-09-2013 / 10:52:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
2721
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   111
sourceOffsetToLine: offset
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   112
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   113
    |low    "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   114
     high   "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   115
     middle "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   116
     element|
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
2721
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   118
    "
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   119
     we can of course use a binary search - since the elements are sorted
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   120
    "
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   121
    low := 1.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   122
    high := sourceLineEnds size.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   123
    [low > high] whileFalse:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   124
        middle := (low + high) // 2.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   125
        element := sourceLineEnds at:middle.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   126
        element < offset ifTrue:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   127
            "middleelement is smaller than object"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   128
            low := middle + 1
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   129
        ] ifFalse:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   130
            high := middle - 1
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   131
        ]
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   132
    ].
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   133
    ^ low
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   134
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   135
    "Created: / 10-09-2013 / 03:40:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
    ^ sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
sourceText:aText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    sourceText := aText.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
sourceTree
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   147
    "Return source tree for my class's compilation unit (i.e., CompilationUnitDeclaration)"
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   148
    sourceTree isNil ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   149
        sourceTreeLock notNil ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   150
            sourceTreeLock wait.
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   151
        ].
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   152
    ].
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
    ^ sourceTree
2697
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   155
    "Modified: / 06-09-2013 / 22:58:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   156
    "Modified (comment): / 13-09-2013 / 04:22:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   157
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   158
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   159
sourceTreeForClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   160
    "Returns a root node (i.e., instance of TypeDeclaration) for my javaClass"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   161
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   162
    ^ self sourceTreeForClass: javaClass.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   163
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   164
    "Created: / 13-09-2013 / 04:20:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   165
    "Modified: / 13-09-2013 / 11:08:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   168
sourceTreeForClass: aJavaClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   169
    "Returns a root node (i.e., instance of TypeDeclaration) for my javaClass"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   170
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   171
    | enclosingClass enclosingClassNode nm |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   172
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   173
    enclosingClass := aJavaClass enclosingClass.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   174
    ^ enclosingClass notNil ifTrue:[
2854
ca49798e0a5d More fixes for new naming scheme
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2841
diff changeset
   175
        nm := aJavaClass binaryName copyFrom: enclosingClass binaryName size + 2.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   176
        (nm conform: [:c|c isDigit]) ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   177
            "/ Could only by anonymous class created in static initializer
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   178
            self error: 'Should not happen'
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   179
        ] ifFalse:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   180
            enclosingClassNode := self sourceTreeForClass: enclosingClass.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   181
            enclosingClassNode memberTypes detect: [:type | type name = nm ] ifNone:[self error:'No member type'].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   182
        ]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   183
    ] ifFalse:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   184
        nm := aJavaClass lastName.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   185
        sourceTree types detect: [:type | type name = nm] ifNone:[self error:'No type'].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   186
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   187
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   188
    "Created: / 13-09-2013 / 11:06:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2854
ca49798e0a5d More fixes for new naming scheme
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2841
diff changeset
   189
    "Modified: / 14-10-2013 / 16:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   190
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   191
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   192
sourceTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   193
    ^ sourceTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   194
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   195
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   196
sourceTreeIndex:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   197
    sourceTreeIndex := aParseTreeIndex.
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   198
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   199
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   200
sourceTreeOrNilIfParsing
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   201
    sourceTree isNil ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   202
        sourceTreeLock notNil ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   203
            ^ nil
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   204
        ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   205
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   206
    ^ sourceTree
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   207
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   208
    "Created: / 12-09-2013 / 21:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   210
2779
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   211
!JavaSourceDocument methodsFor:'debugging'!
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   212
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   213
inspector2TabParseTreeInspector
2783
4756cc015954 Fix in JavaSourceDocument>>#inspector2TabParseTreeInspector - added missing notNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2782
diff changeset
   214
    (Smalltalk at:#'SmallSense::ParseNodeInspector') notNil ifTrue:[
2779
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   215
        | source |
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   216
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   217
        source := sourceText notNil ifTrue:[sourceText] ifFalse:[javaClass source].
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   218
        ^ Tools::Inspector2Tab new
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   219
            label: 'Parse tree';
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   220
            priority: 50;
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   221
            application: ((Smalltalk at:#'SmallSense::ParseNodeInspector') new
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   222
                            node: self sourceTree source: source);
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   223
            yourself
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   224
    ].
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   225
    ^ nil
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   226
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   227
    "Created: / 19-09-2013 / 18:10:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2783
4756cc015954 Fix in JavaSourceDocument>>#inspector2TabParseTreeInspector - added missing notNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2782
diff changeset
   228
    "Modified: / 02-10-2013 / 00:58:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2779
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   229
!
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   230
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   231
inspector2Tabs
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   232
    ^ super inspector2Tabs , #(inspector2TabParseTreeInspector)
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   233
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   234
    "Created: / 19-09-2013 / 18:11:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   235
! !
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   237
!JavaSourceDocument methodsFor:'initialization-private'!
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   238
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   239
initializeSourceRefsInMethods
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   240
    | enclosingMethod typeNode selectorToMethodNodeMap |
2743
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   241
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   242
    enclosingMethod := javaClass enclosingMethod.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   243
    (enclosingMethod isNil and:[javaClass isAnonymous]) ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   244
        enclosingMethod := javaClass topEnclosingClass compiledMethodAt: #'<clinit>()V'. 
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   245
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   246
    enclosingMethod notNil ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   247
        javaClass methodDictionary  keysAndValuesDo: [:selector :method | 
2743
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   248
            "/ ensure class is parsed...
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   249
            enclosingMethod sourceDocument sourceTree.
2895
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   250
            enclosingMethod getSource notNil ifTrue:[
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   251
                method setSource: (enclosingMethod getSource).
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   252
            ].
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   253
        ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   254
        ^ self
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   255
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   256
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   257
    "
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   258
    SmallSense::ParseNodeInspector openOnNode: typeNode source: javaClass source
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   259
    "
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   260
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   261
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   262
    typeNode := self sourceTreeForClass.
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   263
    selectorToMethodNodeMap := Dictionary new.
2874
e62187297585 Fix in JavaSourceDocument - care for types with no method declarations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2854
diff changeset
   264
    (typeNode methods ? #()) do:[:method |
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   265
        | name descriptor selector |
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   266
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   267
        name := method selector.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   268
        selector := name = '<clinit>' 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   269
                        ifTrue:[#'<clinit>()V']
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   270
                        ifFalse:[(method isConstructor ifTrue:['<init>'] ifFalse:[method selector]) , method binding signature].
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   271
        selectorToMethodNodeMap at: selector put: method.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   272
    ].
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   273
    javaClass methodDictionary keysAndValuesDo: [:selector :method | 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   274
        | descriptor  methodName  methodNodes  methodNode  source |
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   275
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   276
        (method isJavaMethod and:[method isSynthetic not]) ifTrue:[
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   277
            methodNode := selectorToMethodNodeMap 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   278
                            at: selector 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   279
                            ifAbsent:[ self error: 'Cannot find method node for selector ' , selector ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   280
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   281
            source := JavaSourceRef new.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   282
            source offset: methodNode declarationSourceStart.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   283
            source length: methodNode declarationSourceEnd - methodNode declarationSourceStart + 1.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   284
            source line0: (self sourceOffsetToLine: methodNode declarationSourceStart).
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   285
            source lineH: (self sourceOffsetToLine: methodNode sourceStart).
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   286
            method setSource: source.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   287
        ].
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   288
    ]
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   289
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   290
    "Created: / 07-09-2013 / 01:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2895
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   291
    "Modified: / 27-10-2013 / 09:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   292
!
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   293
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   294
initializeSourceTree
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   295
    | task |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   296
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   297
    sourceTreeLock := Semaphore new.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   298
    "Job add:"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   299
    task := [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   300
        [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   301
            | source  unit  parser |
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   302
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   303
            source := javaClass theNonMetaclass source.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   304
            source notNil ifTrue: [
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2895
diff changeset
   305
                JavaVM booted ifFalse:[JavaVM boot].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   306
                unit := (Java classForName: 'stx.libjava.tools.Source') new.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   307
                unit setContents: source.
2738
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   308
                JavaCompiler synchronized:[
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   309
                    parser := (Java classForName: 'stx.libjava.tools.parser.Parser') 
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   310
                            new.
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   311
                ].
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   312
                sourceTree := parser parse: unit diet: true"JavaMethod showFullSource not" resolve: true.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   313
                sourceLineEnds := parser scanner getLineEnds.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   314
                self initializeSourceRefsInMethods.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   315
            ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   316
        ] ensure: [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   317
            sourceTreeLock signal.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   318
            sourceTreeLock := nil.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   319
        ]
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   320
    ] newProcess.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2809
diff changeset
   321
    task name: 'Parse task for ', javaClass binaryName.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   322
    task resume.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   323
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   324
    "Created: / 06-09-2013 / 17:50:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2895
diff changeset
   325
    "Modified: / 26-11-2013 / 23:04:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   326
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   327
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   328
!JavaSourceDocument methodsFor:'printing & storing'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   329
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   330
printOn:aStream
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   331
    "append a printed representation if the receiver to the argument, aStream"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   332
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   333
    super printOn:aStream.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   334
    aStream nextPutAll:'('.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   335
    javaClass printOn:aStream.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   336
    aStream nextPutAll:')'.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   337
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   338
    "Modified: / 12-09-2013 / 01:04:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   339
! !
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   340
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   341
!JavaSourceDocument methodsFor:'resolving'!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   342
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   343
resolve
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   344
    | resolver |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   345
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   346
    self sourceTree. "/Ensure source is parsed.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   347
    sourceTree scope isNil ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   348
        resolver := (Java classForName: 'stx.libjava.tools.environment.Resolver') new.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   349
        resolver resolve: sourceTree.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   350
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   351
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   352
    "Created: / 12-09-2013 / 22:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   353
    "Modified: / 13-09-2013 / 02:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   354
! !
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   355
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
!JavaSourceDocument class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   357
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
version_CVS
3412
df11bb428463 Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3360
diff changeset
   359
    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaSourceDocument.st,v 1.3 2015-03-20 13:29:52 vrany Exp $'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   362
version_HG
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
    ^ '$Changeset: <not expanded> $'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   368
JavaSourceDocument initialize!