tools/JavaSourceDocument.st
author Claus Gittinger <cg@exept.de>
Tue, 18 Dec 2018 12:30:28 +0100
branchcvs_MAIN
changeset 3874 0959ceec60a9
parent 3609 2cfd15eb78cc
child 3978 97b846032b01
permissions -rw-r--r--
#OTHER by cg changed: #description
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
3609
2cfd15eb78cc #OTHER by mawalch
mawalch
parents: 3412
diff changeset
     3
"{ NameSpace: Smalltalk }"
2cfd15eb78cc #OTHER by mawalch
mawalch
parents: 3412
diff changeset
     4
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
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
     6
	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
     7
		sourceTreeLock'
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
     8
	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
     9
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
	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
    11
!
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
!JavaSourceDocument class methodsFor:'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
documentation
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
    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
    18
    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
    19
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
    [author:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
        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
    22
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    [instance 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
    [class variables:]
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
    [see also:]
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
! !
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
!JavaSourceDocument class methodsFor:'initialization'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
    "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
    36
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
    "/ 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
    38
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    CacheSize := 25.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    40
    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
    41
    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
    42
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    43
    "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
    44
! !
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
!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
    47
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
for: aJavaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
    ^self new javaClass: aJavaClass.
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
    "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
    52
! !
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
!JavaSourceDocument class methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
cachedDocumentFor: aJavaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    "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
    58
     document is found."
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    Cache withIndexDo:[:document :index|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
        document javaClass == aJavaClass ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
            "/ 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
    63
            "/ to be removed
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
            index < Cache size ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
                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
    66
            ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
            ^ document.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
        ]
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
    ^ nil
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
    "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
    73
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
cachedDocumentFor: aJavaClass put: aJavaSourceDocument
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    "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
    77
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    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
    79
    Cache size = CacheSize ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
        Cache removeFirst.
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
    Cache addLast: aJavaSourceDocument
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
    "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
    85
! !
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
!JavaSourceDocument methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    ^ javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    93
javaClass:aJavaClass    
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    94
    aJavaClass == javaClass ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    95
        ^ self
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
    96
    ].
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    97
    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
    98
    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
    99
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    javaClass := aJavaClass.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   101
    self initializeSourceTree.
2697
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   103
    "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
   104
!
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   106
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
   107
    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
   108
    ^  (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
   109
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   110
    "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
   111
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
2721
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   113
sourceOffsetToLine: offset
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   114
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   115
    |low    "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   116
     high   "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   117
     middle "{ Class: SmallInteger}"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   118
     element|
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
2721
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
     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
   122
    "
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   123
    low := 1.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   124
    high := sourceLineEnds size.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   125
    [low > high] whileFalse:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   126
        middle := (low + high) // 2.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   127
        element := sourceLineEnds at:middle.
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   128
        element < offset ifTrue:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   129
            "middleelement is smaller than object"
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   130
            low := middle + 1
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   131
        ] ifFalse:[
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   132
            high := middle - 1
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   133
        ]
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
    ^ low
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   136
ceb9ed115183 Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   137
    "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
   138
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    ^ sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
sourceText:aText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
    sourceText := aText.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
sourceTree
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   149
    "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
   150
    sourceTree isNil ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   151
        sourceTreeLock notNil ifTrue:[
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   152
            sourceTreeLock wait.
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   153
        ].
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   154
    ].
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
    ^ sourceTree
2697
d5110c6822c6 Introducion a JavaSourceDocument.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   157
    "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
   158
    "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
   159
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   160
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   161
sourceTreeForClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   162
    "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
   163
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   164
    ^ 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
   165
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   166
    "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
   167
    "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
   168
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   170
sourceTreeForClass: aJavaClass
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   171
    "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
   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 enclosingClassNode nm |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   174
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   175
    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
   176
    ^ enclosingClass notNil ifTrue:[
2854
ca49798e0a5d More fixes for new naming scheme
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2841
diff changeset
   177
        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
   178
        (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
   179
            "/ 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
   180
            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
   181
        ] ifFalse:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   182
            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
   183
            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
   184
        ]
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   185
    ] ifFalse:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   186
        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
   187
        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
   188
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   189
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   190
    "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
   191
    "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
   192
!
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   193
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   194
sourceTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   195
    ^ sourceTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   196
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   197
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   198
sourceTreeIndex:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   199
    sourceTreeIndex := aParseTreeIndex.
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   200
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2732
diff changeset
   201
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   202
sourceTreeOrNilIfParsing
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   203
    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
   204
        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
   205
            ^ nil
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   206
        ].
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
    ^ sourceTree
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   209
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   210
    "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
   211
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
2779
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   213
!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
   214
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   215
inspector2TabParseTreeInspector
2783
4756cc015954 Fix in JavaSourceDocument>>#inspector2TabParseTreeInspector - added missing notNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2782
diff changeset
   216
    (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
   217
        | source |
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   218
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   219
        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
   220
        ^ 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
   221
            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
   222
            priority: 50;
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   223
            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
   224
                            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
   225
            yourself
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
    ^ nil
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   228
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   229
    "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
   230
    "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
   231
!
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   232
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   233
inspector2Tabs
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   234
    ^ 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
   235
18d2c83ecb3c Added parse tree inspector tab to JavaSourceDocument to ease debugging.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   236
    "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
   237
! !
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   238
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   239
!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
   240
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   241
initializeSourceRefsInMethods
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   242
    | enclosingMethod typeNode selectorToMethodNodeMap |
2743
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   243
2729
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 enclosingMethod.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   245
    (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
   246
        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
   247
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   248
    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
   249
        javaClass methodDictionary  keysAndValuesDo: [:selector :method | 
2743
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   250
            "/ ensure class is parsed...
0db3e311a7e7 - JavaMethodDeclarationNode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   251
            enclosingMethod sourceDocument sourceTree.
2895
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   252
            enclosingMethod getSource notNil ifTrue:[
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   253
                method setSource: (enclosingMethod getSource).
70df89fe0af0 Fix in JavaSourceDocument>>#initializeSourceRefsInMethods
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2874
diff changeset
   254
            ].
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
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
        ^ 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
   257
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   258
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   259
    "
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   260
    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
   261
    "
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   262
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   263
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   264
    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
   265
    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
   266
    (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
   267
        | 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
   268
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   269
        name := method selector.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   270
        selector := name = '<clinit>' 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   271
                        ifTrue:[#'<clinit>()V']
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   272
                        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
   273
        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
   274
    ].
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   275
    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
   276
        | 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
   277
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   278
        (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
   279
            methodNode := selectorToMethodNodeMap 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   280
                            at: selector 
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   281
                            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
   282
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   283
            source := JavaSourceRef new.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   284
            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
   285
            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
   286
            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
   287
            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
   288
            method setSource: source.
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   289
        ].
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   290
    ]
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   291
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   292
    "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
   293
    "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
   294
!
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   295
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   296
initializeSourceTree
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   297
    | task |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   298
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   299
    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
   300
    "Job add:"
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   301
    task := [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   302
        [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   303
            | 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
   304
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   305
            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
   306
            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
   307
                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
   308
                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
   309
                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
   310
                JavaCompiler synchronized:[
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   311
                    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
   312
                            new.
a633a2e8e67e Make sure eclipse Parser is initialized before actually start parsing.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2735
diff changeset
   313
                ].
2809
e3b939ba5a5d Fix in JavaSourceDocument>>initializeSourceRefsInMethods - match methods using their descriptors...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   314
                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
   315
                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
   316
                self initializeSourceRefsInMethods.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   317
            ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   318
        ] ensure: [
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   319
            sourceTreeLock signal.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   320
            sourceTreeLock := nil.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   321
        ]
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   322
    ] newProcess.
2841
6fa1bcf9c997 JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2809
diff changeset
   323
    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
   324
    task resume.
2716
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   325
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   326
    "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
   327
    "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
   328
! !
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
!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
   331
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   332
printOn:aStream
3609
2cfd15eb78cc #OTHER by mawalch
mawalch
parents: 3412
diff changeset
   333
    "append a printed representation of the receiver to the argument, aStream"
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   334
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   335
    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
   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
    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
   338
    aStream nextPutAll:')'.
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
    "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
   341
! !
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
!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
   344
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   345
resolve
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   346
    | resolver |
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   347
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   348
    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
   349
    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
   350
        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
   351
        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
   352
    ].
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   353
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2728
diff changeset
   354
    "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
   355
    "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
   356
! !
1cca77810e04 Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2708
diff changeset
   357
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
!JavaSourceDocument class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
version_CVS
3609
2cfd15eb78cc #OTHER by mawalch
mawalch
parents: 3412
diff changeset
   361
    ^ '$Header$'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   362
!
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
version_HG
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
    ^ '$Changeset: <not expanded> $'
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
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   369
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   370
JavaSourceDocument initialize!