Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-08-10 17:52:49 +0000
committerDoug Schaefer2016-08-10 17:52:49 +0000
commitcc5287f548e588eee5bc0adacd7db1d485c0b2b5 (patch)
tree3c71c8ffdd84d61895c6386c629fb735fb324b6b
parent20c4e5ba88ba4fa3be972642f5f03de546e9b864 (diff)
downloadorg.eclipse.cdt-cc5287f548e588eee5bc0adacd7db1d485c0b2b5.tar.gz
org.eclipse.cdt-cc5287f548e588eee5bc0adacd7db1d485c0b2b5.tar.xz
org.eclipse.cdt-cc5287f548e588eee5bc0adacd7db1d485c0b2b5.zip
Only show Language Setting property on old build system projects.
-rw-r--r--core/org.eclipse.cdt.core/plugin.xml10
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ICBuildConfigurationManager.java15
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java21
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildPropertyTester.java38
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml5
5 files changed, 88 insertions, 1 deletions
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 @@
</run>
</builder>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.cdt.internal.core.build.CBuildPropertyTester"
+ id="buildPropertyTester"
+ namespace="org.eclipse.cdt.core.build"
+ properties="isSupported"
+ type="org.eclipse.core.resources.IResource">
+ </propertyTester>
+ </extension>
</plugin>
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 @@
<and>
<test property="org.eclipse.core.resources.projectNature"
value="org.eclipse.cdt.core.cnature"/>
+ <not>
+ <test
+ property="org.eclipse.cdt.core.build.isSupported">
+ </test>
+ </not>
<test property="org.eclipse.cdt.ui.checkPreference"
value="org.eclipse.cdt.core/language.settings.providers.disabled=false"/>
</and>

Back to the top