Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1f2bd35cfd60308d3034187b4273b30d7d400227 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*******************************************************************************
 * Copyright (c) 2019 Red Hat Inc. and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
package org.eclipse.jface.text.contentassist;

import java.util.Arrays;

import org.eclipse.jface.text.ITextViewer;

class CompositeContextInformationValidator implements IContextInformationValidator {

	private final IContextInformationValidator[] children;

	public CompositeContextInformationValidator(IContextInformationValidator[] validators) {
		this.children= validators;
	}

	@Override
	public void install(IContextInformation info, ITextViewer viewer, int offset) {
		Arrays.stream(children).forEach(child -> child.install(info, viewer, offset));
	}

	@Override
	public boolean isContextInformationValid(int offset) {
		return Arrays.stream(children).anyMatch(child -> child.isContextInformationValid(offset));
	}

}

Back to the top