Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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