author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 17 Sep 2013 11:22:20 +0100 | |
branch | development |
changeset 2735 | e20dd8496371 |
parent 2732 | 7d1a1fb5b01a |
child 2738 | a633a2e8e67e |
permissions | -rw-r--r-- |
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 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
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 |
]. |
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
95 |
javaClass notNil ifTrue:[ |
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
96 |
self error: 'Class already set!!' |
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
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 |
|
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
101 |
"Modified: / 06-09-2013 / 17:51:59 / 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:[ |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
175 |
nm := aJavaClass name copyFrom: enclosingClass name size + 2. |
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>" |
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 |
|
2735
e20dd8496371
Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
191 |
sourceTreeIndex |
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 |
! |
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 |
sourceTreeIndex:aParseTreeIndex |
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 |
! |
e20dd8496371
Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
198 |
|
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
199 |
sourceTreeOrNilIfParsing |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
200 |
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
|
201 |
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
|
202 |
^ nil |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
203 |
]. |
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 |
^ sourceTree |
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 |
"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
|
208 |
! ! |
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 |
!JavaSourceDocument methodsFor:'debugging'! |
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 |
inspector2TabParseTree |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
213 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
214 |
SmallSense::ParseNodeInspector notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
215 |
^self newInspector2Tab |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
216 |
label: 'Parse Tree'; |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
217 |
priority: 35; |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
218 |
application: (SmallSense::ParseNodeInspector new node: sourceTree source: sourceText) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
219 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
220 |
^nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
221 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
222 |
"Created: / 30-08-2013 / 01:59:15 / 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
|
223 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
224 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
225 |
inspector2Tabs |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
226 |
| tabs | |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
227 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
228 |
tabs := super inspector2Tabs. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
229 |
(SmallSense::ParseNodeInspector notNil and:[sourceTree notNil and:[sourceText notNil]]) ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
230 |
tabs := tabs , #(inspector2TabParseTree) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
231 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
232 |
^tabs |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
233 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
234 |
"Created: / 30-08-2013 / 02:00: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
|
235 |
! ! |
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 |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
240 |
| enclosingMethod typeName typeNode | |
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
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 | |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
248 |
method setSource: (enclosingMethod source; getSource). |
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
249 |
]. |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
250 |
^ 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
|
251 |
]. |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
252 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
253 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
254 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
255 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
256 |
typeNode := self sourceTreeForClass. |
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 |
javaClass methodDictionary |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
258 |
keysAndValuesDo: [:selector :method | |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
259 |
| descriptor methodName methodNodes methodNode source | |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
260 |
|
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
261 |
method isJavaMethod ifTrue:[ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
262 |
descriptor := method descriptor. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
263 |
methodName := descriptor name. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
264 |
methodName = '<init>' ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
265 |
methodName := typeName. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
266 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
267 |
methodNodes := typeNode methods |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
268 |
select: [:each | |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
269 |
each selector = methodName |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
270 |
and: [ each arguments size == descriptor parameters size ] |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
271 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
272 |
methodNodes notEmptyOrNil ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
273 |
methodNodes size == 1 ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
274 |
methodNode := methodNodes anElement. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
275 |
] ifFalse: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
276 |
method hasLineNumberInformation ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
277 |
| line0 offset0 | |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
278 |
|
2726
6971720de5a4
More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2721
diff
changeset
|
279 |
line0 := method lineNumberForPC0: 1. |
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
280 |
offset0 := self sourceLineToOffset: line0. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
281 |
methodNodes := typeNode methods |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
282 |
select: [:each | |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
283 |
offset0 between: each declarationSourceStart |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
284 |
and: each declarationSourceEnd + 1 |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
285 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
286 |
methodNodes size == 1 ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
287 |
methodNode := methodNodes anElement. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
288 |
] |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
289 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
290 |
methodNode isNil ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
291 |
| |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
292 |
"/ OK, search by parameter types... |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
293 |
i | |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
294 |
|
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
295 |
i := 1. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
296 |
[ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
297 |
(methodNodes size > 1) and: [ i <= descriptor parameters size ] |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
298 |
] whileTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
299 |
| descr descrArgTypeName descrArgDimensions | |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
300 |
|
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
301 |
descr := descriptor parameters at: i. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
302 |
descrArgTypeName := descr javaClassName. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
303 |
descrArgDimensions := descr dimensions. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
304 |
descrArgTypeName first == $[ ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
305 |
descrArgTypeName := (JavaDescriptor baseTypes at: descrArgTypeName second) |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
306 |
javaName. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
307 |
descrArgDimensions := descrArgDimensions + 1. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
308 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
309 |
methodNodes := methodNodes |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
310 |
select: [:each | |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
311 |
| nodeArgType nodeArgDimensions | |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
312 |
|
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
313 |
nodeArgType := (each arguments at: i) type getTypeName asStringWith: $/. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
314 |
nodeArgDimensions := (each arguments at: i) type dimensions. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
315 |
descrArgDimensions == nodeArgDimensions |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
316 |
and: [ descrArgTypeName includesSubString: nodeArgType ] |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
317 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
318 |
i := i + 1. |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
319 |
]. |
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
320 |
methodNodes isEmpty ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
321 |
self error: 'No matching method node!!'. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
322 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
323 |
methodNodes size > 1 ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
324 |
self error: 'Cannot determine method!!'. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
325 |
]. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
326 |
methodNode := methodNodes anElement. |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
327 |
]. |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
328 |
]. |
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
329 |
methodNode notNil ifTrue: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
330 |
source := JavaSourceRef new. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
331 |
source offset: methodNode declarationSourceStart. |
2721
ceb9ed115183
Added source line number to JavaSourceRef.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2718
diff
changeset
|
332 |
source length: methodNode declarationSourceEnd - methodNode declarationSourceStart + 1. |
2726
6971720de5a4
More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2721
diff
changeset
|
333 |
source line0: (self sourceOffsetToLine: methodNode declarationSourceStart). |
6971720de5a4
More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2721
diff
changeset
|
334 |
source lineH: (self sourceOffsetToLine: methodNode sourceStart). |
2718
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
335 |
method setSource: source. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
336 |
] ifFalse: [ |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
337 |
self error: 'Cannot determine method!!'. |
b3fe904a2fc7
Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2717
diff
changeset
|
338 |
] |
2717
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
339 |
]. |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
340 |
]. |
16564a7101b8
Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2716
diff
changeset
|
341 |
] |
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
342 |
|
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
343 |
"Created: / 07-09-2013 / 01:43:06 / 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
|
344 |
"Modified: / 13-09-2013 / 11:24:46 / 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
|
345 |
! |
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
346 |
|
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
347 |
initializeSourceTree |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
348 |
| task | |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
349 |
|
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
350 |
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
|
351 |
"Job add:" |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
352 |
task := [ |
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 |
| 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
|
355 |
|
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
356 |
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
|
357 |
source notNil ifTrue: [ |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
358 |
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
|
359 |
unit setContents: source. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
360 |
parser := (Java classForName: 'stx.libjava.tools.parser.Parser') |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
361 |
new. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
362 |
sourceTree := parser parse: unit diet: true resolve: false. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
363 |
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
|
364 |
self initializeSourceRefsInMethods. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
365 |
]. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
366 |
] ensure: [ |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
367 |
sourceTreeLock signal. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
368 |
sourceTreeLock := nil. |
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
369 |
] |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
370 |
] newProcess. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
371 |
task name: 'Parse task for ', javaClass name. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
372 |
task resume. |
2716
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
373 |
|
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
374 |
"Created: / 06-09-2013 / 17:50:54 / 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
|
375 |
"Modified: / 13-09-2013 / 17:35:37 / 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
|
376 |
! ! |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
377 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
378 |
!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
|
379 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
380 |
printOn:aStream |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
381 |
"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
|
382 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
383 |
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
|
384 |
aStream nextPutAll:'('. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
385 |
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
|
386 |
aStream nextPutAll:')'. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
387 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
388 |
"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
|
389 |
! ! |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
390 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
391 |
!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
|
392 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
393 |
resolve |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
394 |
| resolver | |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
395 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
396 |
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
|
397 |
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
|
398 |
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
|
399 |
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
|
400 |
]. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
401 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2728
diff
changeset
|
402 |
"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
|
403 |
"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
|
404 |
! ! |
1cca77810e04
Initial support for source file partitioning using eclipse parser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2708
diff
changeset
|
405 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
406 |
!JavaSourceDocument class methodsFor:'documentation'! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
407 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
408 |
version_CVS |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
409 |
^ '$Header: /cvs/stx/stx/libjava/tools/JavaSourceDocument.st,v 1.1 2013-09-06 00:45:28 vrany Exp $' |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
410 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
411 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
412 |
version_HG |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
413 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
414 |
^ '$Changeset: <not expanded> $' |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
415 |
! ! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
416 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
417 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff
changeset
|
418 |
JavaSourceDocument initialize! |