author | Stefan Vogel <sv@exept.de> |
Fri, 17 May 2019 17:11:44 +0200 | |
changeset 18767 | 0478d93cdb75 |
parent 16980 | 46aba5fba348 |
child 17136 | cb908d2ba02e |
permissions | -rw-r--r-- |
9981 | 1 |
" |
10075 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
3 |
All Rights Reserved |
|
9981 | 4 |
|
10075 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9981 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
CodeViewService subclass:#CodeCompletionService |
|
31 |
instanceVariableNames:'' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-CodeView' |
|
35 |
! |
|
36 |
||
37 |
!CodeCompletionService class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
10075 | 41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
42 |
All Rights Reserved |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
9981 | 52 |
|
10075 | 53 |
The above copyright notice and this permission notice shall be |
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9981 | 64 |
" |
65 |
! ! |
|
66 |
||
16363 | 67 |
|
9981 | 68 |
!CodeCompletionService class methodsFor:'accessing'! |
69 |
||
70 |
label |
|
13100 | 71 |
"Answers a short label - for UI" |
9981 | 72 |
|
73 |
^'Code Completion' |
|
74 |
||
75 |
"Created: / 07-03-2010 / 14:00:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
76 |
! ! |
|
77 |
||
78 |
!CodeCompletionService class methodsFor:'testing'! |
|
79 |
||
80 |
isAvailable |
|
81 |
||
82 |
"CodeCompletionService is superseded by SmallSense" |
|
83 |
||
10259 | 84 |
"^(Smalltalk at:#SmallSenseService) isNil" |
85 |
||
10274 | 86 |
"Sure, it is broken, but we need it!!" |
10302 | 87 |
"JV2011-07-09: And I preferr SmallSense: this should work for both |
88 |
unless SmallSense is loaded in your image" |
|
10259 | 89 |
|
10302 | 90 |
^(Smalltalk at:#SmallSenseService) isNil. |
9981 | 91 |
|
92 |
"Created: / 03-04-2011 / 23:08:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10274 | 93 |
"Modified: / 08-07-2011 / 08:42:52 / cg" |
10413 | 94 |
"Modified: / 27-07-2011 / 11:47:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13204 | 95 |
! |
96 |
||
97 |
isUsefulFor:aCodeView |
|
98 |
"this filters useful services. |
|
99 |
Redefined to return true for myself - not for subclasses" |
|
100 |
||
101 |
^ self == Tools::CodeCompletionService |
|
102 |
||
103 |
"Created: / 22-07-2013 / 13:59:54 / cg" |
|
9981 | 104 |
! ! |
105 |
||
106 |
!CodeCompletionService methodsFor:'event handling'! |
|
107 |
||
108 |
keyPress: key x:x y:y in: view |
|
109 |
"Handles an event in given view (a subview of codeView). |
|
110 |
If the method returns true, the event will not be processed |
|
111 |
by the view." |
|
112 |
||
16980 | 113 |
(view == textView and:[key == #'CodeCompletion']) ifTrue:[ |
114 |
self complete. |
|
115 |
^ true |
|
116 |
]. |
|
117 |
^ false |
|
9981 | 118 |
|
119 |
"Created: / 07-03-2010 / 09:36:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
120 |
! ! |
|
121 |
||
122 |
!CodeCompletionService methodsFor:'private'! |
|
123 |
||
124 |
complete |
|
13445
72f632746eb4
class: Tools::CodeCompletionService
Claus Gittinger <cg@exept.de>
parents:
13204
diff
changeset
|
125 |
|cls| |
9981 | 126 |
|
16363 | 127 |
codeView languageHolder value isSmalltalk ifFalse:[^self]. |
9981 | 128 |
|
129 |
cls := codeView classHolder value. |
|
130 |
cls isNil ifTrue:[ |
|
131 |
self showInfo:'No class'. |
|
132 |
^ self. |
|
133 |
]. |
|
134 |
UserInformation handle:[:ex | |
|
135 |
codeView showInfo:(ex messageText). |
|
136 |
ex proceed. |
|
137 |
] do:[ |
|
138 |
codeView withWaitCursorDo:[ |
|
13558
70dbfd5f726d
Pass programming language when asking DWIM to complete code
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13445
diff
changeset
|
139 |
DoWhatIMeanSupport codeCompletionForLanguage: codeView language class:cls context:nil codeView:textView. |
9981 | 140 |
] |
141 |
]. |
|
142 |
^ self. |
|
143 |
||
144 |
"Modified: / 04-07-2006 / 18:48:26 / fm" |
|
145 |
"Modified: / 20-11-2006 / 12:30:59 / cg" |
|
146 |
"Created: / 07-03-2010 / 09:37:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
147 |
! ! |
|
148 |
||
149 |
!CodeCompletionService class methodsFor:'documentation'! |
|
150 |
||
151 |
version_CVS |
|
16363 | 152 |
^ '$Header$' |
9981 | 153 |
! |
154 |
||
155 |
version_SVN |
|
16363 | 156 |
^ '$Id$' |
9981 | 157 |
! ! |
13100 | 158 |