Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f24d9bd4e20ab6aac91ebdee22525e1b582a8a4b (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
/*******************************************************************************
 * Copyright (c) 2018 STMicroelectronics and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * STMicroelectronics
 *******************************************************************************/
package org.eclipse.cdt.managedbuilder.ui.tests.properties;

import java.util.Arrays;

import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.IOptionCategoryApplicability;

public class HideEmptyOptionCategoryApplicabilityCalculator implements IOptionCategoryApplicability {

	public HideEmptyOptionCategoryApplicabilityCalculator() {
	}

	@Override
	public boolean isOptionCategoryVisible(IBuildObject configuration, IHoldsOptions optHolder,
			IOptionCategory category) {
		// Check that the category contains at least one option
		return Arrays.asList(optHolder.getOptions())
			.stream()
			.map((opt) -> opt.getCategory())
			.anyMatch((cat) -> cat != null && cat.equals(category));
	}
}

Back to the top