summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2018-05-04 17:34:08 -0400
committerDawid Pakuła2018-05-16 09:39:59 -0400
commit8914d96dd8db9bf3ad4a748c5ffc2f536596fc55 (patch)
tree2700a2789704c5aa8aae0b433141b0840f6392c7
parenta5dd573797121a653605780eac2090b9183ff743 (diff)
downloadeclipse.platform.text-8914d96dd8db9bf3ad4a748c5ffc2f536596fc55.zip
eclipse.platform.text-8914d96dd8db9bf3ad4a748c5ffc2f536596fc55.tar.gz
eclipse.platform.text-8914d96dd8db9bf3ad4a748c5ffc2f536596fc55.tar.xz
Change-Id: If52b8960ae1be26045ea715eb4726d80dbdfe05a Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
index f67612f..b1a02d8 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
@@ -202,6 +202,13 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
List<ICompletionProposal> newProposals = new ArrayList<>(computedProposals);
fComputedProposals = newProposals;
Display.getDefault().asyncExec(() -> {
+ if (!autoActivated && remaining.isEmpty() && newProposals.size() == 1 && canAutoInsert(newProposals.get(0))) {
+ if (Helper.okToUse(fProposalShell)) {
+ insertProposal(newProposals.get(0), (char) 0, 0, fInvocationOffset);
+ hide();
+ }
+ return;
+ }
setProposals(newProposals, false);
displayProposals();
});
@@ -229,7 +236,16 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
@Override
void createProposalSelector() {
super.createProposalSelector();
- fProposalShell.addDisposeListener(e -> hide());
+ fProposalShell.addDisposeListener(e -> cancelFutures());
+ }
+
+ void cancelFutures() {
+ if (fFutures != null) {
+ for (Future<?> future : fFutures) {
+ future.cancel(true);
+ }
+ fFutures= null;
+ }
}
@Override
@@ -252,11 +268,7 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
@Override
public void hide() {
super.hide();
- if (fFutures != null) {
- for (Future<?> future : fFutures) {
- future.cancel(true);
- }
- }
+ cancelFutures();
}
protected List<CompletableFuture<List<ICompletionProposal>>> buildCompletionFuturesOrJobs(int invocationOffset) {