diff options
author | Mickael Istria | 2019-12-03 09:50:34 +0000 |
---|---|---|
committer | Mickael Istria | 2019-12-03 16:34:39 +0000 |
commit | 51d5ac2140a667c6020818f5303480ab74aac410 (patch) | |
tree | e14246524466accf1bc31fd6494f73599e944432 | |
parent | ba8184ce0177f0bd80b2c7c049df6b5eb2ff91c6 (diff) | |
download | eclipse.platform.text-R4_14_maintenance.tar.gz eclipse.platform.text-R4_14_maintenance.tar.xz eclipse.platform.text-R4_14_maintenance.zip |
Bug 553622 - Highlighting in context information no longer worksS4_14_0_RC2aS4_14_0_RC2R4_14I20191210-0610I20191204-1800I20191204-0600I20191203-1800R4_14_maintenance
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>
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 1f2bd35cfd6..31ac39e2cfb 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 04c7e632a69..4da58e27542 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); } |