Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-12-03 09:50:34 +0000
committerMickael Istria2019-12-03 16:34:39 +0000
commit51d5ac2140a667c6020818f5303480ab74aac410 (patch)
treee14246524466accf1bc31fd6494f73599e944432
parentba8184ce0177f0bd80b2c7c049df6b5eb2ff91c6 (diff)
downloadeclipse.platform.text-51d5ac2140a667c6020818f5303480ab74aac410.tar.gz
eclipse.platform.text-51d5ac2140a667c6020818f5303480ab74aac410.tar.xz
eclipse.platform.text-51d5ac2140a667c6020818f5303480ab74aac410.zip
This change restores the previous behavior in case of a single IContextInformationValidator, so it removes the regression. The case of multiple validators will be treated in a separate change, as it's not a regression but more a missing feature for mulitple completion processors. Change-Id: I9a826bc5ec43ea59c48d304b330d4a3ed2d7739b Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompositeContextInformationValidator.java11
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java4
2 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompositeContextInformationValidator.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompositeContextInformationValidator.java
index 1f2bd35cf..31ac39e2c 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompositeContextInformationValidator.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/CompositeContextInformationValidator.java
@@ -13,8 +13,9 @@ package org.eclipse.jface.text.contentassist;
import java.util.Arrays;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextPresentation;
-class CompositeContextInformationValidator implements IContextInformationValidator {
+class CompositeContextInformationValidator implements IContextInformationValidator, IContextInformationPresenter {
private final IContextInformationValidator[] children;
@@ -32,4 +33,12 @@ class CompositeContextInformationValidator implements IContextInformationValidat
return Arrays.stream(children).anyMatch(child -> child.isContextInformationValid(offset));
}
+ @Override
+ public boolean updatePresentation(int offset, TextPresentation presentation) {
+ if (children.length == 1 && children[0] instanceof IContextInformationPresenter) {
+ return ((IContextInformationPresenter) children[0]).updatePresentation(offset, presentation);
+ }
+ return false;
+ }
+
}
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 04c7e632a..4da58e275 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
@@ -2120,6 +2120,8 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
.toArray(IContextInformationValidator[]::new);
if (validators.length == 0) {
return null;
+ } else if (validators.length == 1) {
+ return validators[0];
}
return new CompositeContextInformationValidator(validators);
}
@@ -2146,6 +2148,8 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
.toArray(IContextInformationValidator[]::new);
if (validators.length == 0) {
return null;
+ } else if (validators.length == 1) {
+ return validators[0];
}
return new CompositeContextInformationValidator(validators);
}

Back to the top