diff options
author | Torbjörn Svensson | 2018-04-12 10:39:28 +0000 |
---|---|---|
committer | Torbjörn Svensson | 2018-04-12 15:48:53 +0000 |
commit | 47d08ec20444e80ed180e48b29b5c43559e9c26e (patch) | |
tree | 574735bc3e72f3cc4dd07e6eac5757085c28cd79 | |
parent | 91a142fcb71d924425168cd31e268700abbf9eb1 (diff) | |
download | org.eclipse.cdt-47d08ec20444e80ed180e48b29b5c43559e9c26e.tar.gz org.eclipse.cdt-47d08ec20444e80ed180e48b29b5c43559e9c26e.tar.xz org.eclipse.cdt-47d08ec20444e80ed180e48b29b5c43559e9c26e.zip |
Bug 533473 - Dynamically hide option categories
Allow applicabilityCalculator to hide optionCategory items that are
located on the toolchain. Show in the schema that
applicabilityCalculator is a valid attribute for optionCategory.
Change-Id: I6adb22b0af2a2c7fe45ea142049fcc2687d105b9
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
2 files changed, 17 insertions, 3 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd index cc87103afef..14a002e4b7d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd +++ b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd @@ -1186,6 +1186,16 @@ The path is relative to the plug-in directory which defines .buildDefinitions. </appInfo> </annotation> </attribute> + <attribute name="applicabilityCalculator" type="string"> + <annotation> + <documentation> + Optional class which is used to determine dynamically at runtime whether the option category is visible. This class must implement the IOptionCategoryApplicability interface. If no calculator is specified then the option category is always visible. + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn=":org.eclipse.cdt.managedbuilder.core.IOptionCategoryApplicability"/> + </appInfo> + </annotation> + </attribute> </complexType> </element> @@ -1451,7 +1461,7 @@ Additional special types exist to flag options of special relevance to the build <attribute name="applicabilityCalculator" type="string"> <annotation> <documentation> - Optional class which is used to determine dynamically at runtime whether the option is visible, enabled, and used in command line generation. This class must impelment the IOptionApplicability interface. If no calculator is specified then the option is always visible, enabled, and used in command line generation. + Optional class which is used to determine dynamically at runtime whether the option is visible, enabled, and used in command line generation. This class must implement the IOptionApplicability interface. If no calculator is specified then the option is always visible, enabled, and used in command line generation. </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.cdt.managedbuilder.core.IOptionApplicability"/> diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java index 674daaad240..f8a3962deba 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ToolListContentProvider.java @@ -9,6 +9,7 @@ * Timesys - Initial API and implementation * IBM Rational Software * Miwako Tokugawa (Intel Corporation) - bug 222817 (OptionCategoryApplicability) + * Torbjörn Svensson (STMicroelectronics) - bug #533473 *******************************************************************************/ package org.eclipse.cdt.managedbuilder.ui.properties; @@ -60,8 +61,11 @@ public class ToolListContentProvider implements ITreeContentProvider{ // Create an element for each one for (int i=0; i<toolChainCategories.length; i++) { ToolListElement e = new ToolListElement(null, toolChain, toolChainCategories[i]); - elementList.add(e); - createChildElements(e); + IOptionCategoryApplicability applicabilityCalculator = toolChainCategories[i].getApplicabilityCalculator(); + if (applicabilityCalculator == null || applicabilityCalculator.isOptionCategoryVisible(config, e.getHoldOptions(), e.getOptionCategory())) { + elementList.add(e); + createChildElements(e); + } } // Get the tools to be displayed filteredTools = config.getFilteredTools(); |