diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml index 002d57859e9..511eb8174e3 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ b/build/org.eclipse.cdt.make.ui/plugin.xml @@ -494,11 +494,11 @@ ` - + - + diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index e047bf87483..3f7063be9c3 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -543,7 +543,7 @@ - + @@ -573,7 +573,7 @@ - + diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 96f00a9b5b3..307d6916148 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -3375,9 +3375,12 @@ class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage" category="org.eclipse.cdt.ui.newui.Page_head_general"> - - - + + + + + + @@ -3940,10 +3943,10 @@ + * 2. Checks value of a preference. Usage: + * + * * @noextend This class is not intended to be subclassed by clients. */ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester { - private static final String KEY_SRC = "isSource"; //$NON-NLS-1$ - private static final String KEY_PAGE = "pageEnabled"; //$NON-NLS-1$ - private static final String VAL_EXP = "export"; //$NON-NLS-1$ - private static final String VAL_TOOL = "toolEdit"; //$NON-NLS-1$ + private static final String KEY_SRC = "isSource"; //$NON-NLS-1$ + private static final String KEY_PREF = "checkPreference"; //$NON-NLS-1$ @Override - public boolean test(Object receiver, String property, Object[] args, - Object expectedValue) { + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (KEY_SRC.equals(property)) { if (receiver instanceof ITranslationUnit) { - return ((ITranslationUnit)receiver).isSourceUnit(); - } - else if (receiver instanceof IFile) { - IFile file = (IFile)receiver; + return ((ITranslationUnit) receiver).isSourceUnit(); + } else if (receiver instanceof IFile) { + IFile file = (IFile) receiver; return CoreModel.isValidSourceUnitName(file.getProject(), file.getName()); } - } else if (KEY_PAGE.equals(property) - && expectedValue instanceof String) { - String s = (String) expectedValue; - if (VAL_EXP.equalsIgnoreCase(s)) - return CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT); - if (VAL_TOOL.equalsIgnoreCase(s)) - return !CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOTOOLM); + } else if (KEY_PREF.equals(property) && expectedValue instanceof String) { + boolean result = false; + final Pattern pat = Pattern.compile("(.*):(.*)=(.*)"); //$NON-NLS-1$ + Matcher matcher = pat.matcher((String) expectedValue); + if (matcher.matches()) { + String pluginId = matcher.group(1); + String preference = matcher.group(2); + String wantedValue = matcher.group(3); + + IEclipsePreferences node = InstanceScope.INSTANCE.getNode(pluginId); + if (wantedValue != null) { + String actualValue = node.get(preference, ""); //$NON-NLS-1$ + result = wantedValue.equals(actualValue) || (wantedValue.equals("false") && actualValue.isEmpty()); //$NON-NLS-1$ + } else { + try { + result = Arrays.asList(node.keys()).contains(preference); + } catch (BackingStoreException e) { + CUIPlugin.log(e); + } + } + } + return result; } return false; }