mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Clean up
This commit is contained in:
parent
56f5df2f68
commit
2949c7da2f
12 changed files with 2615 additions and 2613 deletions
|
@ -161,6 +161,7 @@ public class CfgScannerConfigUtil {
|
||||||
if (toolchain!=null) {
|
if (toolchain!=null) {
|
||||||
String toolchainProfileId = null;
|
String toolchainProfileId = null;
|
||||||
if (toolchain instanceof ToolChain) {
|
if (toolchain instanceof ToolChain) {
|
||||||
|
// still allow a user a choice to select any legacy profiles
|
||||||
toolchainProfileId = ((ToolChain) toolchain).getLegacyScannerConfigDiscoveryProfileId();
|
toolchainProfileId = ((ToolChain) toolchain).getLegacyScannerConfigDiscoveryProfileId();
|
||||||
} else {
|
} else {
|
||||||
toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId();
|
toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId();
|
||||||
|
|
|
@ -47,7 +47,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
||||||
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
||||||
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
|
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
|
||||||
/** @since 8.1 */
|
/** @since 8.1 */
|
||||||
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
|
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$
|
||||||
public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
|
public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
|
||||||
public static final String PARENT = "parent"; //$NON-NLS-1$
|
public static final String PARENT = "parent"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
|
||||||
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
|
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** @since 8.1 */
|
/** @since 8.1 */
|
||||||
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
|
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configuration that is the parent of this tool-chain.
|
* Returns the configuration that is the parent of this tool-chain.
|
||||||
|
|
|
@ -786,7 +786,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
// Get the semicolon separated list of IDs of the error parsers
|
// Get the semicolon separated list of IDs of the error parsers
|
||||||
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
|
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
|
||||||
|
|
||||||
// Get the initial/default language setttings providers IDs
|
// Get the initial/default language settings providers IDs
|
||||||
defaultLanguageSettingsProvidersAttribute = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS));
|
defaultLanguageSettingsProvidersAttribute = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS));
|
||||||
|
|
||||||
// Get the artifact extension
|
// Get the artifact extension
|
||||||
|
|
|
@ -1842,9 +1842,9 @@ public class InputType extends BuildObject implements IInputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method to support compatibility during SD transition.
|
* Check if legacy scanner discovery method should be used.
|
||||||
*/
|
*/
|
||||||
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
|
private boolean isLegacyScannerDiscovery() {
|
||||||
boolean isLanguageSettingsProvidersEnabled = false;
|
boolean isLanguageSettingsProvidersEnabled = false;
|
||||||
ITool tool = getParent();
|
ITool tool = getParent();
|
||||||
if (tool!=null) {
|
if (tool!=null) {
|
||||||
|
@ -1860,7 +1860,7 @@ public class InputType extends BuildObject implements IInputType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isLanguageSettingsProvidersEnabled;
|
return !isLanguageSettingsProvidersEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1879,18 +1879,20 @@ public class InputType extends BuildObject implements IInputType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDiscoveryProfileIdAttribute() {
|
public String getDiscoveryProfileIdAttribute() {
|
||||||
if (!isLanguageSettingsProvidersFunctionalityEnabled())
|
if (isLegacyScannerDiscovery()) {
|
||||||
return getLegacyDiscoveryProfileIdAttribute();
|
return getLegacyDiscoveryProfileIdAttribute();
|
||||||
|
}
|
||||||
|
|
||||||
return getDiscoveryProfileIdAttributeInternal();
|
return getDiscoveryProfileIdAttributeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method extracted temporarily to support compatibility during SD transition.
|
* Do not inline! This method needs to call itself recursively.
|
||||||
*/
|
*/
|
||||||
private String getDiscoveryProfileIdAttributeInternal() {
|
private String getDiscoveryProfileIdAttributeInternal() {
|
||||||
if(buildInfoDicsoveryProfileId == null && superClass instanceof InputType)
|
if (buildInfoDicsoveryProfileId == null && superClass instanceof InputType) {
|
||||||
return ((InputType)superClass).getDiscoveryProfileIdAttributeInternal();
|
return ((InputType)superClass).getDiscoveryProfileIdAttributeInternal();
|
||||||
|
}
|
||||||
return buildInfoDicsoveryProfileId;
|
return buildInfoDicsoveryProfileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getDefaultLanguageSettingsProviderIds() {
|
public String[] getDefaultLanguageSettingsProviderIds() {
|
||||||
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode");
|
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode"); //$NON-NLS-1$
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -558,7 +558,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
// Get the target tool id
|
// Get the target tool id
|
||||||
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
|
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
|
||||||
|
|
||||||
// Get the initial/default language setttings providers IDs
|
// Get the initial/default language settings providers IDs
|
||||||
defaultLanguageSettingsProviderIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
|
defaultLanguageSettingsProviderIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
|
||||||
|
|
||||||
// Get the scanner config discovery profile id
|
// Get the scanner config discovery profile id
|
||||||
|
@ -1545,9 +1545,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method to support compatibility during SD transition.
|
* Check if legacy scanner discovery method should be used.
|
||||||
*/
|
*/
|
||||||
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
|
private boolean isLegacyScannerDiscovery() {
|
||||||
boolean isLanguageSettingsProvidersEnabled = false;
|
boolean isLanguageSettingsProvidersEnabled = false;
|
||||||
IConfiguration cfg = getParent();
|
IConfiguration cfg = getParent();
|
||||||
if (cfg != null) {
|
if (cfg != null) {
|
||||||
|
@ -1557,11 +1557,11 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
|
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isLanguageSettingsProvidersEnabled;
|
return !isLanguageSettingsProvidersEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method to support compatibility during SD transition.
|
* Get list of scanner discovery profiles supported by previous version.
|
||||||
* @see ScannerDiscoveryLegacySupport#getDeprecatedLegacyProfiles(String)
|
* @see ScannerDiscoveryLegacySupport#getDeprecatedLegacyProfiles(String)
|
||||||
*
|
*
|
||||||
* @noreference This method is not intended to be referenced by clients.
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
@ -1580,21 +1580,17 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
return profileId;
|
return profileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getScannerConfigDiscoveryProfileId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getScannerConfigDiscoveryProfileId() {
|
public String getScannerConfigDiscoveryProfileId() {
|
||||||
if (!isLanguageSettingsProvidersFunctionalityEnabled())
|
if (isLegacyScannerDiscovery()) {
|
||||||
return getLegacyScannerConfigDiscoveryProfileId();
|
return getLegacyScannerConfigDiscoveryProfileId();
|
||||||
|
}
|
||||||
|
|
||||||
return getScannerConfigDiscoveryProfileIdInternal();
|
return getScannerConfigDiscoveryProfileIdInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method extracted temporarily to support compatibility during SD transition.
|
* Do not inline! This method needs to call itself recursively.
|
||||||
*/
|
*/
|
||||||
private String getScannerConfigDiscoveryProfileIdInternal() {
|
private String getScannerConfigDiscoveryProfileIdInternal() {
|
||||||
if (scannerConfigDiscoveryProfileId == null && superClass instanceof ToolChain) {
|
if (scannerConfigDiscoveryProfileId == null && superClass instanceof ToolChain) {
|
||||||
|
|
|
@ -496,7 +496,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription, IProgressMonitor monitor) throws CoreException {
|
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription,
|
||||||
|
IProgressMonitor monitor)
|
||||||
|
throws CoreException {
|
||||||
if(cfgDescription.isPreferenceConfiguration())
|
if(cfgDescription.isPreferenceConfiguration())
|
||||||
return loadPreferences(cfgDescription);
|
return loadPreferences(cfgDescription);
|
||||||
|
|
||||||
|
|
|
@ -263,18 +263,16 @@ public class CDTPrefUtil {
|
||||||
private static final Object[] getListForDisplay(Object[][] input, int mode, Comparator<Object> cmp) {
|
private static final Object[] getListForDisplay(Object[][] input, int mode, Comparator<Object> cmp) {
|
||||||
if (input == null || input.length == 0)
|
if (input == null || input.length == 0)
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
|
|
||||||
if (input.length == 1) {
|
if (input.length == 1) {
|
||||||
return (input[0] == null) ?
|
return (input[0] == null) ? EMPTY_ARRAY : input[0];
|
||||||
EMPTY_ARRAY :
|
|
||||||
input[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] s1 = input[0];
|
Object[] s1 = input[0];
|
||||||
if (s1 == null ||
|
if (s1 == null || s1.length == 0)
|
||||||
s1.length == 0)
|
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
if (getMultiCfgStringListDisplayMode() == DMODE_CONJUNCTION)
|
|
||||||
{
|
if (getMultiCfgStringListDisplayMode() == DMODE_CONJUNCTION) {
|
||||||
ArrayList<Object> lst = new ArrayList<Object>();
|
ArrayList<Object> lst = new ArrayList<Object>();
|
||||||
for (int i=0; i<s1.length; i++) {
|
for (int i=0; i<s1.length; i++) {
|
||||||
if (s1[i] == null)
|
if (s1[i] == null)
|
||||||
|
@ -282,10 +280,12 @@ public class CDTPrefUtil {
|
||||||
boolean found = true;
|
boolean found = true;
|
||||||
for (int k = 1; k<input.length; k++) {
|
for (int k = 1; k<input.length; k++) {
|
||||||
Object[] s2 = input[k];
|
Object[] s2 = input[k];
|
||||||
if (s2 == null || s2.length == 0)
|
if (s2 == null || s2.length == 0) {
|
||||||
return EMPTY_ARRAY;
|
return EMPTY_ARRAY;
|
||||||
if (i == 0)
|
}
|
||||||
|
if (i == 0) {
|
||||||
Arrays.sort(s2, cmp);
|
Arrays.sort(s2, cmp);
|
||||||
|
}
|
||||||
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
|
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
|
||||||
found = false;
|
found = false;
|
||||||
break;
|
break;
|
||||||
|
@ -299,12 +299,13 @@ public class CDTPrefUtil {
|
||||||
}
|
}
|
||||||
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
|
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
|
||||||
for (Object[] element : input) {
|
for (Object[] element : input) {
|
||||||
if (element == null ||
|
if (element == null || element.length == 0) {
|
||||||
element.length == 0)
|
|
||||||
continue;
|
continue;
|
||||||
for (Object element2 : element)
|
}
|
||||||
|
for (Object element2 : element) {
|
||||||
lst.add(element2);
|
lst.add(element2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
s1 = lst.toArray();
|
s1 = lst.toArray();
|
||||||
Arrays.sort(s1, cmp);
|
Arrays.sort(s1, cmp);
|
||||||
return s1;
|
return s1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue