mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 15:55:47 +02:00
Only show Language Setting property on old build system projects.
Change-Id: I21e71af0f5e701939d133707353e5bde7e4ab0e1
This commit is contained in:
parent
20c4e5ba88
commit
cc5287f548
5 changed files with 88 additions and 1 deletions
|
@ -880,5 +880,15 @@
|
||||||
</run>
|
</run>
|
||||||
</builder>
|
</builder>
|
||||||
</extension>
|
</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>
|
</plugin>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
* to CDT build configuration.
|
* to CDT build configuration.
|
||||||
*
|
*
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICBuildConfigurationManager {
|
public interface ICBuildConfigurationManager {
|
||||||
|
|
||||||
|
@ -60,4 +61,16 @@ public interface ICBuildConfigurationManager {
|
||||||
*/
|
*/
|
||||||
ICBuildConfiguration getBuildConfiguration(IBuildConfiguration buildConfig) throws CoreException;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3502,6 +3502,11 @@
|
||||||
<and>
|
<and>
|
||||||
<test property="org.eclipse.core.resources.projectNature"
|
<test property="org.eclipse.core.resources.projectNature"
|
||||||
value="org.eclipse.cdt.core.cnature"/>
|
value="org.eclipse.cdt.core.cnature"/>
|
||||||
|
<not>
|
||||||
|
<test
|
||||||
|
property="org.eclipse.cdt.core.build.isSupported">
|
||||||
|
</test>
|
||||||
|
</not>
|
||||||
<test property="org.eclipse.cdt.ui.checkPreference"
|
<test property="org.eclipse.cdt.ui.checkPreference"
|
||||||
value="org.eclipse.cdt.core/language.settings.providers.disabled=false"/>
|
value="org.eclipse.cdt.core/language.settings.providers.disabled=false"/>
|
||||||
</and>
|
</and>
|
||||||
|
|
Loading…
Add table
Reference in a new issue