aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Dietrich2018-08-10 12:34:48 -0400
committerAndrey Loskutov2018-08-11 16:26:50 -0400
commit03eaf378e3ebbb6a7c9c4776319201f80acc6f05 (patch)
treeb1f01545dc8d877d64557f4c7a440da86ebae2b1
parent6c6aae6bed242e6de3183a4a53c8851573c91b74 (diff)
downloadeclipse.platform.text-03eaf378e3ebbb6a7c9c4776319201f80acc6f05.tar.gz
eclipse.platform.text-03eaf378e3ebbb6a7c9c4776319201f80acc6f05.tar.xz
eclipse.platform.text-03eaf378e3ebbb6a7c9c4776319201f80acc6f05.zip
Bug 537719 - Proper treatment of null as a return value from proposal andI20180814-0910I20180814-0900I20180813-2000I20180812-2000
context information providers Change-Id: Icade86ba7a772b2d3ee5ff09ed23c35e5677af74 Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java19
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java5
2 files changed, 18 insertions, 6 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
index bf28a1439..64327e340 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
@@ -1971,8 +1971,11 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
SafeRunner.run(new ExceptionLoggingSafeRunnable(COMPLETION_ERROR_MESSAGE_KEY) {
@Override
public void run() throws Exception {
- result.addAll(Arrays.asList( ((ISubjectControlContentAssistProcessor) p)
- .computeCompletionProposals(contentAssistSubjectControl, offset)));
+ ICompletionProposal[] proposals= ((ISubjectControlContentAssistProcessor) p)
+ .computeCompletionProposals(contentAssistSubjectControl, offset);
+ if (proposals != null) {
+ result.addAll(Arrays.asList(proposals));
+ }
fLastErrorMessage= p.getErrorMessage();
}
});
@@ -2037,7 +2040,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
@Override
public void run() throws Exception {
processors.forEach(p -> {
- result.addAll(Arrays.asList(p.computeContextInformation(viewer, offset)));
+ IContextInformation[] contextInformation= p.computeContextInformation(viewer, offset);
+ if (contextInformation != null) {
+ result.addAll(Arrays.asList(contextInformation));
+ }
fLastErrorMessage= p.getErrorMessage();
});
}
@@ -2071,8 +2077,11 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
SafeRunner.run(new ExceptionLoggingSafeRunnable(CONTEXT_ERROR_MESSAGE_KEY) {
@Override
public void run() throws Exception {
- result.addAll(Arrays.asList( ((ISubjectControlContentAssistProcessor) p)
- .computeContextInformation(contentAssistSubjectControl, offset)));
+ IContextInformation[] contextInformation= ((ISubjectControlContentAssistProcessor) p)
+ .computeContextInformation(contentAssistSubjectControl, offset);
+ if (contextInformation != null) {
+ result.addAll(Arrays.asList(contextInformation));
+ }
fLastErrorMessage= p.getErrorMessage();
}
});
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
index 06ca42db1..b270e15da 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
@@ -58,7 +58,10 @@ public class CompositeContentAssistProcessor implements IContentAssistProcessor
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
List<IContextInformation> res = new ArrayList<>();
for (IContentAssistProcessor processor : this.fContentAssistProcessors) {
- res.addAll(Arrays.asList(processor.computeContextInformation(viewer, offset)));
+ IContextInformation[] contextInformation = processor.computeContextInformation(viewer, offset);
+ if (contextInformation != null) {
+ res.addAll(Arrays.asList(contextInformation));
+ }
}
return res.toArray(new IContextInformation[res.size()]);
}