diff --git a/core/org.eclipse.cdt.core/plugin.xml b/core/org.eclipse.cdt.core/plugin.xml index 9c5e8589f27..d70a94d885f 100644 --- a/core/org.eclipse.cdt.core/plugin.xml +++ b/core/org.eclipse.cdt.core/plugin.xml @@ -880,5 +880,15 @@ + + + + diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java index b0f5d1d5f52..34aa66a9457 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor; * to CDT build configuration. * * @since 6.0 + * @noimplement This interface is not intended to be implemented by clients. */ public interface ICBuildConfigurationManager { @@ -59,5 +60,17 @@ public interface ICBuildConfigurationManager { * @return the matching CDT build configuration */ ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException; - + + /** + * Does this build system support this project. This is determined by + * searching the build configuration providers looking to see if any of them + * support this project. + * + * @param project + * @return is this project supported by this build system + * @throws CoreException + * @since 6.1 + */ + boolean supports(IProject project) throws CoreException; + } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java index 84991efc3aa..ad0105bbcf3 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java @@ -281,4 +281,25 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager, } } + @Override + public boolean supports(IProject project) throws CoreException { + initProviders(); + + // First see if we have a build config registered + for (IBuildConfiguration config : project.getBuildConfigs()) { + if (configs.containsKey(config)) { + return true; + } + } + + // See if one of the providers supports this project + for (Provider provider : providers.values()) { + if (provider.supports(project)) { + return true; + } + } + + return false; + } + } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildPropertyTester.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildPropertyTester.java new file mode 100644 index 00000000000..0245fd9c4a8 --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildPropertyTester.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2016, QNX Software Systems 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 + *******************************************************************************/ +package org.eclipse.cdt.internal.core.build; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.build.ICBuildConfigurationManager; +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; + +public class CBuildPropertyTester extends PropertyTester { + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + switch (property) { + case "isSupported": //$NON-NLS-1$ + if (receiver instanceof IResource) { + IProject project = ((IResource) receiver).getProject(); + try { + return CCorePlugin.getService(ICBuildConfigurationManager.class).supports(project); + } catch (CoreException e) { + CCorePlugin.log(e.getStatus()); + return false; + } + } + return false; + default: + return false; + } + } + +} diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 78f6a992e8c..c79fe1ed8b4 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -3502,6 +3502,11 @@ + + + +