Mercurial > projects > dwt-addons
comparison dwtx/jface/internal/text/link/contentassist/ContextInformationPopup2.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | f70d9508c95c |
children | 1a5b8f8129df |
comparison
equal
deleted
inserted
replaced
157:7f75eaa8103a | 158:25f1f92fa3df |
---|---|
116 * Shows all possible contexts for the given cursor position of the viewer. | 116 * Shows all possible contexts for the given cursor position of the viewer. |
117 * | 117 * |
118 * @param autoActivated <code>true</code> if auto activated | 118 * @param autoActivated <code>true</code> if auto activated |
119 * @return a potential error message or <code>null</code> in case of no error | 119 * @return a potential error message or <code>null</code> in case of no error |
120 */ | 120 */ |
121 public String showContextProposals(final bool autoActivated) { | 121 public String showContextProposals(bool autoActivated) { |
122 final StyledText styledText= fViewer.getTextWidget(); | 122 final StyledText styledText= fViewer.getTextWidget(); |
123 BusyIndicator.showWhile(styledText.getDisplay(), new class() Runnable { | 123 BusyIndicator.showWhile(styledText.getDisplay(), dgRunnable( (bool autoActivated_, StyledText styledText_ ) { |
124 public void run() { | 124 int position= fViewer.getSelectedRange().x; |
125 | 125 |
126 int position= fViewer.getSelectedRange().x; | 126 IContextInformation[] contexts= computeContextInformation(position); |
127 | 127 int count = (contexts is null ? 0 : contexts.length); |
128 IContextInformation[] contexts= computeContextInformation(position); | 128 if (count is 1) { |
129 int count = (contexts is null ? 0 : contexts.length); | 129 |
130 if (count is 1) { | 130 // Show context information directly |
131 | 131 internalShowContextInfo(contexts[0], position); |
132 // Show context information directly | 132 |
133 internalShowContextInfo(contexts[0], position); | 133 } else if (count > 0) { |
134 | 134 // Precise context must be selected |
135 } else if (count > 0) { | 135 |
136 // Precise context must be selected | 136 if (fLineDelimiter is null) |
137 | 137 fLineDelimiter= styledText_.getLineDelimiter(); |
138 if (fLineDelimiter is null) | 138 |
139 fLineDelimiter= styledText.getLineDelimiter(); | 139 createContextSelector(); |
140 | 140 setContexts(contexts); |
141 createContextSelector(); | 141 displayContextSelector(); |
142 setContexts(contexts); | 142 hideContextInfoPopup(); |
143 displayContextSelector(); | 143 |
144 hideContextInfoPopup(); | 144 } else if (!autoActivated_) { |
145 | 145 styledText_.getDisplay().beep(); |
146 } else if (!autoActivated) { | 146 } |
147 styledText.getDisplay().beep(); | 147 }, autoActivated, styledText )); |
148 } | |
149 } | |
150 }); | |
151 | 148 |
152 return getErrorMessage(); | 149 return getErrorMessage(); |
153 } | 150 } |
154 | 151 |
155 /** | 152 /** |
157 * | 154 * |
158 * @param info the context information | 155 * @param info the context information |
159 * @param position the offset | 156 * @param position the offset |
160 * @since 2.0 | 157 * @since 2.0 |
161 */ | 158 */ |
162 public void showContextInformation(final IContextInformation info, final int position) { | 159 public void showContextInformation(IContextInformation info, int position) { |
163 Control control= fViewer.getTextWidget(); | 160 Control control= fViewer.getTextWidget(); |
164 BusyIndicator.showWhile(control.getDisplay(), new class() Runnable { | 161 BusyIndicator.showWhile(control.getDisplay(), dgRunnable( (IContextInformation info_, int position_) { |
165 public void run() { | 162 internalShowContextInfo(info_, position_); |
166 internalShowContextInfo(info, position); | 163 hideContextSelector(); |
167 hideContextSelector(); | 164 }, info, position)); |
168 } | |
169 }); | |
170 } | 165 } |
171 | 166 |
172 /** | 167 /** |
173 * Displays the given context information for the given offset. | 168 * Displays the given context information for the given offset. |
174 * | 169 * |