Lines 148-154
Link Here
|
148 |
Registry.addChangeListener(this); |
148 |
Registry.addChangeListener(this); |
149 |
completionAutoPopupTimer = new Timer(0, new ActionListener() { |
149 |
completionAutoPopupTimer = new Timer(0, new ActionListener() { |
150 |
public void actionPerformed(ActionEvent e) { |
150 |
public void actionPerformed(ActionEvent e) { |
151 |
showCompletion(); |
151 |
queryResultSets(completionResult.getResultSets()); |
|
|
152 |
completionResult.queryInvoked(); |
152 |
} |
153 |
} |
153 |
}); |
154 |
}); |
154 |
completionAutoPopupTimer.setRepeats(false); |
155 |
completionAutoPopupTimer.setRepeats(false); |
Lines 207-213
Link Here
|
207 |
} |
208 |
} |
208 |
if (completionResultNull && (type & CompletionProvider.COMPLETION_QUERY_TYPE) != 0 && |
209 |
if (completionResultNull && (type & CompletionProvider.COMPLETION_QUERY_TYPE) != 0 && |
209 |
CompletionSettings.INSTANCE.completionAutoPopup()) { |
210 |
CompletionSettings.INSTANCE.completionAutoPopup()) { |
210 |
restartCompletionAutoPopupTimer(); |
211 |
showCompletion(false, true); |
211 |
} |
212 |
} |
212 |
|
213 |
|
213 |
boolean tooltipResultNull; |
214 |
boolean tooltipResultNull; |
Lines 448-454
Link Here
|
448 |
} |
449 |
} |
449 |
} |
450 |
} |
450 |
|
451 |
|
451 |
void completionQuery() { |
452 |
void completionQuery(boolean delayQuery) { |
452 |
pleaseWaitTimer.restart(); |
453 |
pleaseWaitTimer.restart(); |
453 |
refreshedQuery = false; |
454 |
refreshedQuery = false; |
454 |
|
455 |
|
Lines 471-478
Link Here
|
471 |
} |
472 |
} |
472 |
|
473 |
|
473 |
// Query the tasks |
474 |
// Query the tasks |
474 |
queryResultSets(completionResultSets); |
475 |
if (delayQuery) { |
475 |
newCompletionResult.queryInvoked(); |
476 |
restartCompletionAutoPopupTimer(); |
|
|
477 |
} else { |
478 |
queryResultSets(completionResultSets); |
479 |
newCompletionResult.queryInvoked(); |
480 |
} |
476 |
} |
481 |
} |
477 |
|
482 |
|
478 |
/** |
483 |
/** |
Lines 510-519
Link Here
|
510 |
* May be called from any thread but it will be rescheduled into AWT. |
515 |
* May be called from any thread but it will be rescheduled into AWT. |
511 |
*/ |
516 |
*/ |
512 |
public void showCompletion() { |
517 |
public void showCompletion() { |
513 |
showCompletion(false); |
518 |
showCompletion(false, false); |
514 |
} |
519 |
} |
515 |
|
520 |
|
516 |
private void showCompletion(boolean explicitQuery) { |
521 |
private void showCompletion(boolean explicitQuery, boolean delayQuery) { |
517 |
if (!SwingUtilities.isEventDispatchThread()) { |
522 |
if (!SwingUtilities.isEventDispatchThread()) { |
518 |
// Re-call this method in AWT if necessary |
523 |
// Re-call this method in AWT if necessary |
519 |
SwingUtilities.invokeLater(new ParamRunnable(ParamRunnable.SHOW_COMPLETION)); |
524 |
SwingUtilities.invokeLater(new ParamRunnable(ParamRunnable.SHOW_COMPLETION)); |
Lines 523-529
Link Here
|
523 |
this.explicitQuery = explicitQuery; |
528 |
this.explicitQuery = explicitQuery; |
524 |
if (activeProviders != null) { |
529 |
if (activeProviders != null) { |
525 |
completionCancel(); // cancel possibly pending query |
530 |
completionCancel(); // cancel possibly pending query |
526 |
completionQuery(); |
531 |
completionQuery(delayQuery); |
527 |
} |
532 |
} |
528 |
} |
533 |
} |
529 |
|
534 |
|
Lines 1042-1048
Link Here
|
1042 |
|
1047 |
|
1043 |
private final class CompletionShowAction extends AbstractAction { |
1048 |
private final class CompletionShowAction extends AbstractAction { |
1044 |
public void actionPerformed(ActionEvent e) { |
1049 |
public void actionPerformed(ActionEvent e) { |
1045 |
showCompletion(true); |
1050 |
showCompletion(true, false); |
1046 |
} |
1051 |
} |
1047 |
} |
1052 |
} |
1048 |
|
1053 |
|
Lines 1125-1135
Link Here
|
1125 |
} |
1130 |
} |
1126 |
} |
1131 |
} |
1127 |
|
1132 |
|
1128 |
private static void refreshResultSets(List resultSets) { |
1133 |
private static void refreshResultSets(List resultSets, boolean beforeQuery) { |
1129 |
int size = resultSets.size(); |
1134 |
int size = resultSets.size(); |
1130 |
for (int i = 0; i < size; i++) { |
1135 |
for (int i = 0; i < size; i++) { |
1131 |
CompletionResultSetImpl result = (CompletionResultSetImpl)resultSets.get(i); |
1136 |
CompletionResultSetImpl result = (CompletionResultSetImpl)resultSets.get(i); |
1132 |
result.getTask().refresh(result.getResultSet()); |
1137 |
result.getTask().refresh(beforeQuery ? null : result.getResultSet()); |
1133 |
} |
1138 |
} |
1134 |
} |
1139 |
} |
1135 |
|
1140 |
|
Lines 1171-1179
Link Here
|
1171 |
|
1176 |
|
1172 |
private final List/*<CompletionResultSetImpl>*/ resultSets; |
1177 |
private final List/*<CompletionResultSetImpl>*/ resultSets; |
1173 |
|
1178 |
|
1174 |
private boolean invoked; |
1179 |
private boolean invoked; |
1175 |
|
|
|
1176 |
private boolean cancelled; |
1180 |
private boolean cancelled; |
|
|
1181 |
private boolean beforeQuery = true; |
1177 |
|
1182 |
|
1178 |
Result(int resultSetsSize) { |
1183 |
Result(int resultSetsSize) { |
1179 |
resultSets = new ArrayList(resultSetsSize); |
1184 |
resultSets = new ArrayList(resultSetsSize); |
Lines 1221-1226
Link Here
|
1221 |
assert (!invoked); |
1226 |
assert (!invoked); |
1222 |
invoked = true; |
1227 |
invoked = true; |
1223 |
canc = cancelled; |
1228 |
canc = cancelled; |
|
|
1229 |
beforeQuery = false; |
1224 |
} |
1230 |
} |
1225 |
if (canc) { |
1231 |
if (canc) { |
1226 |
cancelResultSets(resultSets); |
1232 |
cancelResultSets(resultSets); |
Lines 1237-1246
Link Here
|
1237 |
if (cancelled) { |
1243 |
if (cancelled) { |
1238 |
return null; |
1244 |
return null; |
1239 |
} |
1245 |
} |
|
|
1246 |
if (beforeQuery) { |
1247 |
return this; |
1248 |
} |
1240 |
assert (invoked); // had to be invoked |
1249 |
assert (invoked); // had to be invoked |
1241 |
invoked = false; |
1250 |
invoked = false; |
1242 |
} |
1251 |
} |
1243 |
Result refreshResult = new Result(getResultSets().size()); |
1252 |
Result refreshResult = new Result(getResultSets().size()); |
|
|
1253 |
refreshResult.beforeQuery = beforeQuery; |
1244 |
createRefreshResultSets(resultSets, refreshResult); |
1254 |
createRefreshResultSets(resultSets, refreshResult); |
1245 |
return refreshResult; |
1255 |
return refreshResult; |
1246 |
} |
1256 |
} |
Lines 1251-1258
Link Here
|
1251 |
* {@link #createRefreshResult()}. |
1261 |
* {@link #createRefreshResult()}. |
1252 |
*/ |
1262 |
*/ |
1253 |
void invokeRefresh() { |
1263 |
void invokeRefresh() { |
1254 |
refreshResultSets(getResultSets()); |
1264 |
refreshResultSets(getResultSets(), beforeQuery); |
1255 |
queryInvoked(); |
1265 |
if (!beforeQuery) |
|
|
1266 |
queryInvoked(); |
1256 |
} |
1267 |
} |
1257 |
|
1268 |
|
1258 |
} |
1269 |
} |