1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

Only show Language Setting property on old build system projects.

Change-Id: I21e71af0f5e701939d133707353e5bde7e4ab0e1
This commit is contained in:
Doug Schaefer 2016-08-10 13:52:49 -04:00
parent 20c4e5ba88
commit cc5287f548
5 changed files with 88 additions and 1 deletions

View file

@ -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>

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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;
}
}
}

View file

@ -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>