Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Melcher2018-09-12 18:01:30 -0400
committerTobias Melcher2018-09-12 18:01:30 -0400
commitbfe82f0bb31a47bcf040d4e0520058a382daff1c (patch)
tree6dfe40dcd1d5044c5f21a4a484dd0e84e3734125
parent8a3790a6e9400bc98ae8ad422f70c2f29c2b1bd1 (diff)
downloadeclipse.platform.text-bfe82f0bb31a47bcf040d4e0520058a382daff1c.tar.gz
eclipse.platform.text-bfe82f0bb31a47bcf040d4e0520058a382daff1c.tar.xz
eclipse.platform.text-bfe82f0bb31a47bcf040d4e0520058a382daff1c.zip
Bug 538876: catch exceptions thrown in AsyncCompletionProposalPopupY20180912-2200I20180913-1800I20180913-0415I20180912-2240
Change-Id: I456288d4e02824673ac4731ec8d54a436e3cf560 Signed-off-by: Tobias Melcher <Tobias.Melcher@sap.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java20
1 files changed, 15 insertions, 5 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 77ed304e6..9bcb4ef06 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
@@ -33,6 +33,9 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
+
import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
import org.eclipse.jface.text.BadLocationException;
@@ -341,11 +344,18 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
List<CompletableFuture<List<ICompletionProposal>>> futures = new ArrayList<>(processors.size());
for (IContentAssistProcessor processor : processors) {
futures.add(CompletableFuture.supplyAsync(() -> {
- ICompletionProposal[] proposals= processor.computeCompletionProposals(fViewer, invocationOffset);
- if (proposals == null) {
- return Collections.emptyList();
- }
- return Arrays.asList(proposals);
+ final List<ICompletionProposal>[] result= new List[] { null };
+ SafeRunner.run(new ISafeRunnable() {
+ @Override
+ public void run() throws Exception {
+ ICompletionProposal[] proposals= processor.computeCompletionProposals(fViewer, invocationOffset);
+ if (proposals == null) {
+ result[0]= Collections.emptyList();
+ }
+ result[0]= Arrays.asList(proposals);
+ }
+ });
+ return result[0];
}));
}
return futures;

Back to the top