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
95886b4f65
commit
1e208208ed
17 changed files with 2615 additions and 2686 deletions
File diff suppressed because it is too large
Load diff
|
@ -174,11 +174,11 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
|||
|
||||
/**
|
||||
* Returns default language settings providers IDs specified for the configuration.
|
||||
* @return default language settings providers IDs.
|
||||
* @return default language settings providers IDs or {@code null}.
|
||||
*
|
||||
* @since 8.1
|
||||
*/
|
||||
public String[] getDefaultLanguageSettingsProvidersIds();
|
||||
public String[] getDefaultLanguageSettingsProviderIds();
|
||||
|
||||
/**
|
||||
* Projects have C or CC natures. Tools can specify a filter so they are not
|
||||
|
|
|
@ -271,7 +271,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
|
|||
*
|
||||
* @since 8.1
|
||||
*/
|
||||
public String getDefaultLanguageSettingsProvidersIds();
|
||||
public String getDefaultLanguageSettingsProviderIds();
|
||||
|
||||
/**
|
||||
* Returns the scanner config discovery profile id or <code>null</code> if none.
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Vector;
|
|||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
|
@ -84,10 +83,8 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.osgi.framework.Version;
|
||||
|
||||
|
@ -96,6 +93,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||
private static final String EMPTY_CFG_ID = "org.eclipse.cdt.build.core.emptycfg"; //$NON-NLS-1$
|
||||
private static final String LANGUAGE_SETTINGS_PROVIDER_DELIMITER = ";"; //$NON-NLS-1$
|
||||
private static final String LANGUAGE_SETTINGS_PROVIDER_NEGATION_SIGN = "-"; //$NON-NLS-1$
|
||||
private static final String $TOOLCHAIN = "${Toolchain}"; //$NON-NLS-1$
|
||||
|
||||
// Parent and children
|
||||
private String parentId;
|
||||
|
@ -107,7 +106,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
private String artifactExtension;
|
||||
private String errorParserIds;
|
||||
private String defaultLanguageSettingsProvidersAttribute;
|
||||
private String[] defaultLanguageSettingsProvidersIds;
|
||||
private String[] defaultLanguageSettingsProviderIds;
|
||||
private String prebuildStep;
|
||||
private String postbuildStep;
|
||||
private String preannouncebuildStep;
|
||||
|
@ -1462,6 +1461,10 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of attribute {@link IConfiguration#LANGUAGE_SETTINGS_PROVIDERS}
|
||||
* It not defined, it will try to pull the attribute from the parent configuration.
|
||||
*/
|
||||
private String getDefaultLanguageSettingsProvidersAttribute() {
|
||||
if (defaultLanguageSettingsProvidersAttribute == null && parent instanceof Configuration) {
|
||||
defaultLanguageSettingsProvidersAttribute = ((Configuration) parent).getDefaultLanguageSettingsProvidersAttribute();
|
||||
|
@ -1470,29 +1473,32 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
return defaultLanguageSettingsProvidersAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* This function will try to find default provider Ids specified in this instance.
|
||||
* It none defined, it will try to pull Ids from the parent configuration.
|
||||
*/
|
||||
@Override
|
||||
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||
defaultLanguageSettingsProvidersIds = null;
|
||||
if (defaultLanguageSettingsProvidersIds == null) {
|
||||
getDefaultLanguageSettingsProvidersAttribute();
|
||||
public String[] getDefaultLanguageSettingsProviderIds() {
|
||||
defaultLanguageSettingsProviderIds = null;
|
||||
if (defaultLanguageSettingsProviderIds == null) {
|
||||
defaultLanguageSettingsProvidersAttribute = getDefaultLanguageSettingsProvidersAttribute();
|
||||
if (defaultLanguageSettingsProvidersAttribute != null) {
|
||||
List<String> ids = new ArrayList<String>();
|
||||
String[] defaultIds = defaultLanguageSettingsProvidersAttribute.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER);
|
||||
for (String id : defaultIds) {
|
||||
if (id != null && !id.isEmpty()) {
|
||||
if (id.startsWith("-")) {
|
||||
if (id.startsWith(LANGUAGE_SETTINGS_PROVIDER_NEGATION_SIGN)) {
|
||||
id = id.substring(1);
|
||||
ids.remove(id);
|
||||
} else if (!ids.contains(id)){
|
||||
if (id.contains("${Toolchain}")) {
|
||||
} else if (!ids.contains(id)) {
|
||||
if (id.contains($TOOLCHAIN)) {
|
||||
IToolChain toolchain = getToolChain();
|
||||
if (toolchain != null) {
|
||||
String toolchainProvidersIds = toolchain.getDefaultLanguageSettingsProvidersIds();
|
||||
String toolchainProvidersIds = toolchain.getDefaultLanguageSettingsProviderIds();
|
||||
if (toolchainProvidersIds != null) {
|
||||
ids.addAll(Arrays.asList(toolchainProvidersIds.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER)));
|
||||
} else {
|
||||
String message = "Invalid use of ${Toolchain} tag, toolchain does not specify language settings providers. cfg=" + getId();
|
||||
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, message, new Exception()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1502,13 +1508,13 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
}
|
||||
|
||||
}
|
||||
defaultLanguageSettingsProvidersIds = ids.toArray(new String[ids.size()]);
|
||||
defaultLanguageSettingsProviderIds = ids.toArray(new String[ids.size()]);
|
||||
} else if (parent != null) {
|
||||
defaultLanguageSettingsProvidersIds = parent.getDefaultLanguageSettingsProvidersIds();
|
||||
defaultLanguageSettingsProviderIds = parent.getDefaultLanguageSettingsProviderIds();
|
||||
}
|
||||
}
|
||||
|
||||
return defaultLanguageSettingsProvidersIds;
|
||||
return defaultLanguageSettingsProviderIds;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -441,7 +441,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||
public String[] getDefaultLanguageSettingsProviderIds() {
|
||||
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode");
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
|||
private String targetToolIds;
|
||||
private String secondaryOutputIds;
|
||||
private Boolean isAbstract;
|
||||
private String defaultLanguageSettingsProvidersIds;
|
||||
private String defaultLanguageSettingsProviderIds;
|
||||
private String scannerConfigDiscoveryProfileId;
|
||||
private String versionsSupported;
|
||||
private String convertToId;
|
||||
|
@ -559,7 +559,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
|||
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
|
||||
|
||||
// Get the initial/default language setttings providers IDs
|
||||
defaultLanguageSettingsProvidersIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
|
||||
defaultLanguageSettingsProviderIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
|
||||
|
||||
// Get the scanner config discovery profile id
|
||||
scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
|
||||
|
@ -1537,13 +1537,11 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLanguageSettingsProvidersIds() {
|
||||
if (defaultLanguageSettingsProvidersIds == null) {
|
||||
if (superClass instanceof IToolChain) {
|
||||
defaultLanguageSettingsProvidersIds = ((IToolChain) superClass).getDefaultLanguageSettingsProvidersIds();
|
||||
}
|
||||
public String getDefaultLanguageSettingsProviderIds() {
|
||||
if (defaultLanguageSettingsProviderIds == null && superClass instanceof IToolChain) {
|
||||
defaultLanguageSettingsProviderIds = ((IToolChain) superClass).getDefaultLanguageSettingsProviderIds();
|
||||
}
|
||||
return defaultLanguageSettingsProvidersIds;
|
||||
return defaultLanguageSettingsProviderIds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1552,9 +1550,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
|||
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
|
||||
boolean isLanguageSettingsProvidersEnabled = false;
|
||||
IConfiguration cfg = getParent();
|
||||
if (cfg!=null) {
|
||||
if (cfg != null) {
|
||||
IResource rc = cfg.getOwner();
|
||||
if (rc!=null) {
|
||||
if (rc != null) {
|
||||
IProject project = rc.getProject();
|
||||
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
|
||||
}
|
||||
|
@ -1564,11 +1562,13 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
|||
|
||||
/**
|
||||
* Temporary method to support compatibility during SD transition.
|
||||
* @see ScannerDiscoveryLegacySupport#getDeprecatedLegacyProfiles(String)
|
||||
*
|
||||
* @noreference This method is not intended to be referenced by clients.
|
||||
*/
|
||||
public String getLegacyScannerConfigDiscoveryProfileId() {
|
||||
String profileId = scannerConfigDiscoveryProfileId;
|
||||
if (profileId==null) {
|
||||
if (profileId == null) {
|
||||
profileId = ScannerDiscoveryLegacySupport.getDeprecatedLegacyProfiles(id);
|
||||
if (profileId == null) {
|
||||
IToolChain superClass = getSuperClass();
|
||||
|
|
|
@ -519,7 +519,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
|
||||
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg) {
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||
String[] ids = cfg.getDefaultLanguageSettingsProvidersIds();
|
||||
String[] ids = cfg.getDefaultLanguageSettingsProviderIds();
|
||||
if (ids != null) {
|
||||
for (String id : ids) {
|
||||
ILanguageSettingsProvider provider = null;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class TestConfiguration implements IConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||
public String[] getDefaultLanguageSettingsProviderIds() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ public class TestToolchain extends HoldsOptions implements IToolChain {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultLanguageSettingsProvidersIds() {
|
||||
public String getDefaultLanguageSettingsProviderIds() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ PropertyPageDefsTab_7=Show disc. page names if they are unique. Else show profil
|
|||
PropertyPageDefsTab_8=Always show names + profile IDs
|
||||
PropertyPageDefsTab_9=Always show profile IDs only
|
||||
PropertyPageDefsTab_showIncludeFileTab=Display "Include Files" tab
|
||||
PropertyPageDefsTab_showProvidersTab=Display "Preprocessor Include Paths" tabs
|
||||
PropertyPageDefsTab_showProvidersTab=Display "Preprocessor Include Paths" tab and enable language settings providers
|
||||
ProjectConvert_convertersList=Converters List
|
||||
|
||||
AbstractPrefPage_0=\ Preference settings will be applied to new projects \n only when there were no toolchains selected.
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
|
@ -23,7 +22,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||
|
||||
/**
|
||||
* @since 5.1
|
||||
*
|
||||
*
|
||||
* @noextend This class is not intended to be subclassed by clients.
|
||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||
*/
|
||||
|
@ -31,7 +30,6 @@ public class WizardDefaultsTab extends AbstractCPropertyTab {
|
|||
|
||||
private Button show_sup;
|
||||
private Button show_oth;
|
||||
private Button checkBoxTryNewSD;
|
||||
|
||||
@Override
|
||||
public void createControls(Composite parent) {
|
||||
|
@ -39,34 +37,27 @@ public class WizardDefaultsTab extends AbstractCPropertyTab {
|
|||
usercomp.setLayout(new GridLayout(1, false));
|
||||
|
||||
show_sup = new Button(usercomp, SWT.CHECK);
|
||||
show_sup.setText(Messages.WizardDefaultsTab_0);
|
||||
show_sup.setText(Messages.WizardDefaultsTab_0);
|
||||
show_sup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
show_oth = new Button(usercomp, SWT.CHECK);
|
||||
show_oth.setText(Messages.WizardDefaultsTab_1);
|
||||
show_oth.setText(Messages.WizardDefaultsTab_1);
|
||||
show_oth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
checkBoxTryNewSD = new Button(usercomp, SWT.CHECK);
|
||||
checkBoxTryNewSD.setText(org.eclipse.cdt.internal.ui.newui.Messages.LanguageSettingsProviders_EnableForProject);
|
||||
checkBoxTryNewSD.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
||||
show_oth.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS));
|
||||
checkBoxTryNewSD.setSelection(CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NEWSD));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void performOK() {
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, !show_sup.getSelection());
|
||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_OTHERS, show_oth.getSelection());
|
||||
CDTPrefUtil.setBool(LanguageSettingsProvidersPage.KEY_NEWSD, checkBoxTryNewSD.getSelection());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void performDefaults() {
|
||||
show_sup.setSelection(true);
|
||||
show_oth.setSelection(false);
|
||||
checkBoxTryNewSD.setSelection(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.internal.ui.wizards.ICDTCommonProjectWizard;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
|
@ -598,20 +599,12 @@ public class MBSWizardHandler extends CWizardHandler {
|
|||
cfgFirst = cfgDes;
|
||||
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
boolean isTryingNewSD = false;
|
||||
IWizardPage page = getStartingPage();
|
||||
if (page instanceof CDTMainWizardPage) {
|
||||
isTryingNewSD = ((CDTMainWizardPage)page).isTryingNewSD();
|
||||
}
|
||||
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||
List<ILanguageSettingsProvider> providers;
|
||||
if (isTryingNewSD) {
|
||||
boolean isEnableProvidersPreference = !CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NO_SHOW_PROVIDERS);
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isEnableProvidersPreference);
|
||||
if (isEnableProvidersPreference) {
|
||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||
} else {
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
} else {
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
|
@ -31,6 +32,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
|||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
|
@ -73,7 +75,6 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
|||
final String locationStr = page.getLocation();
|
||||
final boolean isCPP = page.isCPP();
|
||||
final IToolChain toolChain = page.getToolChain();
|
||||
final boolean isTryingNewSD = page.isTryingNewSD();
|
||||
|
||||
IRunnableWithProgress op = new WorkspaceModifyOperation() {
|
||||
@Override
|
||||
|
@ -118,13 +119,12 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
|||
ICConfigurationDescription cfgDes = projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||
if (isTryingNewSD) {
|
||||
boolean isEnableProvidersPreference = !CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NO_SHOW_PROVIDERS);
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isEnableProvidersPreference);
|
||||
if (isEnableProvidersPreference) {
|
||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||
} else {
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
} else {
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||
|
|
|
@ -16,12 +16,9 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
@ -62,8 +59,8 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
IWorkspaceRoot root;
|
||||
List tcList;
|
||||
Map<String, IToolChain> tcMap = new HashMap<String, IToolChain>();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* True if the user entered a non-empty string in the project name field. In that state, we avoid
|
||||
* automatically filling the project name field with the directory name (last segment of the location) he
|
||||
|
@ -71,9 +68,6 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
*/
|
||||
boolean projectNameSetByUser;
|
||||
|
||||
private Button checkBoxTryNewSD;
|
||||
|
||||
|
||||
protected NewMakeProjFromExistingPage() {
|
||||
super(Messages.NewMakeProjFromExistingPage_0);
|
||||
setTitle(Messages.NewMakeProjFromExistingPage_1);
|
||||
|
@ -93,22 +87,6 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
addSourceSelector(comp);
|
||||
addLanguageSelector(comp);
|
||||
addToolchainSelector(comp);
|
||||
|
||||
checkBoxTryNewSD = new Button(comp, SWT.CHECK);
|
||||
checkBoxTryNewSD.setText(org.eclipse.cdt.internal.ui.newui.Messages.LanguageSettingsProviders_EnableForProject);
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
checkBoxTryNewSD.setLayoutData(gd);
|
||||
|
||||
|
||||
// restore settings from preferences
|
||||
boolean isTryNewSD = true;
|
||||
boolean contains = CUIPlugin.getDefault().getPreferenceStore().contains(LanguageSettingsProvidersPage.KEY_NEWSD);
|
||||
if (contains) {
|
||||
isTryNewSD = CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NEWSD);
|
||||
}
|
||||
checkBoxTryNewSD.setSelection(isTryNewSD);
|
||||
|
||||
setControl(comp);
|
||||
}
|
||||
|
||||
|
@ -131,7 +109,7 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Note that the modify listener gets called not only when the user enters text but also when we
|
||||
// programatically set the field. This listener only gets called when the user modifies the field
|
||||
projectName.addKeyListener(new KeyAdapter() {
|
||||
|
@ -141,17 +119,17 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validates the contents of the page, setting the page error message and Finish button state accordingly
|
||||
*
|
||||
*
|
||||
* @since 8.1
|
||||
*/
|
||||
protected void validatePage() {
|
||||
// Don't generate an error if project name or location is empty, but do disable Finish button.
|
||||
// Don't generate an error if project name or location is empty, but do disable Finish button.
|
||||
String msg = null;
|
||||
boolean complete = true; // ultimately treated as false if msg != null
|
||||
|
||||
|
||||
String name = getProjectName();
|
||||
if (name.isEmpty()) {
|
||||
complete = false;
|
||||
|
@ -279,11 +257,11 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
|
||||
tcList = new List(group, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
|
||||
|
||||
// Base the List control size on the number of total toolchains, up to 15 entries, but allocate for no
|
||||
// less than five (small list boxes look strange). A vertical scrollbar will appear as needed
|
||||
updateTcMap(false);
|
||||
gd.heightHint = tcList.getItemHeight() * (1 + Math.max(Math.min(tcMap.size(), 15), 5)); // +1 for <none>
|
||||
gd.heightHint = tcList.getItemHeight() * (1 + Math.max(Math.min(tcMap.size(), 15), 5)); // +1 for <none>
|
||||
tcList.setLayoutData(gd);
|
||||
tcList.add(Messages.NewMakeProjFromExistingPage_11);
|
||||
|
||||
|
@ -301,11 +279,11 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
|
||||
supportedOnly.setSelection(true);
|
||||
updateTcWidget(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load our map and with the suitable toolchains and then populate the List control
|
||||
*
|
||||
*
|
||||
* @param supportedOnly
|
||||
* if true, consider only supported toolchains
|
||||
*/
|
||||
|
@ -324,7 +302,7 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
|
||||
/**
|
||||
* Load our map with the suitable toolchains.
|
||||
*
|
||||
*
|
||||
* @param supportedOnly
|
||||
* if true, add only toolchains that are available and which support the host platform
|
||||
*/
|
||||
|
@ -364,11 +342,4 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
return selection.length != 0 ? tcMap.get(selection[0]) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* AG FIXME temporary method to be removed before CDT Juno release.
|
||||
* @since 8.1
|
||||
*/
|
||||
public boolean isTryingNewSD() {
|
||||
return checkBoxTryNewSD.getSelection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
|
@ -28,6 +29,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -52,7 +54,7 @@ public class STDWizardHandler extends MBSWizardHandler {
|
|||
full_tcs.put(Messages.StdProjectTypeHandler_0, null);
|
||||
} else {
|
||||
if (tc.isAbstract() || tc.isSystemObject()) return;
|
||||
// unlike CWizardHandler, we don't check for configs
|
||||
// unlike CWizardHandler, we don't check for configs
|
||||
full_tcs.put(tc.getUniqueRealName(), tc);
|
||||
}
|
||||
}
|
||||
|
@ -76,61 +78,54 @@ public class STDWizardHandler extends MBSWizardHandler {
|
|||
}
|
||||
|
||||
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
throws CoreException {
|
||||
|
||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||
ManagedProject mProj = new ManagedProject(des);
|
||||
info.setManagedProject(mProj);
|
||||
monitor.worked(20);
|
||||
cfgs = CfgHolder.unique(getCfgItems(false));
|
||||
cfgs = CfgHolder.reorder(cfgs);
|
||||
int work = 50/cfgs.length;
|
||||
for (int i=0; i<cfgs.length; i++) {
|
||||
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||
cfgs[i].setConfiguration(cfg);
|
||||
IBuilder bld = cfg.getEditableBuilder();
|
||||
if (bld != null) {
|
||||
if(bld.isInternalBuilder()){
|
||||
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
||||
IBuilder prefBuilder = prefCfg.getBuilder();
|
||||
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
||||
bld = cfg.getEditableBuilder();
|
||||
bld.setBuildPath(null);
|
||||
}
|
||||
bld.setManagedBuildOn(false);
|
||||
} else {
|
||||
System.out.println(Messages.StdProjectTypeHandler_3);
|
||||
}
|
||||
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
||||
CConfigurationData data = cfg.getConfigurationData();
|
||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||
ManagedProject mProj = new ManagedProject(des);
|
||||
info.setManagedProject(mProj);
|
||||
monitor.worked(20);
|
||||
cfgs = CfgHolder.unique(getCfgItems(false));
|
||||
cfgs = CfgHolder.reorder(cfgs);
|
||||
int work = 50/cfgs.length;
|
||||
for (int i=0; i<cfgs.length; i++) {
|
||||
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||
cfgs[i].setConfiguration(cfg);
|
||||
IBuilder bld = cfg.getEditableBuilder();
|
||||
if (bld != null) {
|
||||
if(bld.isInternalBuilder()){
|
||||
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
||||
IBuilder prefBuilder = prefCfg.getBuilder();
|
||||
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
||||
bld = cfg.getEditableBuilder();
|
||||
bld.setBuildPath(null);
|
||||
}
|
||||
bld.setManagedBuildOn(false);
|
||||
} else {
|
||||
System.out.println(Messages.StdProjectTypeHandler_3);
|
||||
}
|
||||
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
||||
CConfigurationData data = cfg.getConfigurationData();
|
||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
boolean isTryingNewSD = false;
|
||||
IWizardPage page = getStartingPage();
|
||||
if (page instanceof CDTMainWizardPage) {
|
||||
isTryingNewSD = ((CDTMainWizardPage)page).isTryingNewSD();
|
||||
}
|
||||
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||
if (isTryingNewSD) {
|
||||
boolean isEnableProvidersPreference = !CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NO_SHOW_PROVIDERS);
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isEnableProvidersPreference);
|
||||
if (isEnableProvidersPreference) {
|
||||
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(cfg, cfgDes);
|
||||
} else {
|
||||
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||
}
|
||||
} else {
|
||||
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||
}
|
||||
|
||||
monitor.worked(work);
|
||||
}
|
||||
mngr.setProjectDescription(project, des);
|
||||
}
|
||||
monitor.worked(work);
|
||||
}
|
||||
mngr.setProjectDescription(project, des);
|
||||
}
|
||||
|
||||
public boolean canCreateWithoutToolchain() {
|
||||
return true;
|
||||
|
@ -138,7 +133,7 @@ public class STDWizardHandler extends MBSWizardHandler {
|
|||
|
||||
@Override
|
||||
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
|
||||
setProjectDescription(proj, true, true, monitor);
|
||||
setProjectDescription(proj, true, true, monitor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.eclipse.cdt.ui.newui.ICPropertyTab;
|
|||
public class LanguageSettingsProvidersPage extends AbstractPage {
|
||||
/** @since 5.4 */ // temporary key, subject to removal
|
||||
public static final String KEY_NO_SHOW_PROVIDERS = "properties.providers.tab.disable"; //$NON-NLS-1$
|
||||
/** @since 5.4 */ // temporary key, subject to removal
|
||||
public static final String KEY_NEWSD = "wizard.try.new.sd.enable"; //$NON-NLS-1$
|
||||
|
||||
private static boolean isLanguageSettingsProvidersEnabled = false;
|
||||
private static IProject project = null;
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
|||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||
import org.eclipse.cdt.ui.newui.PageLayout;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProvidersPage;
|
||||
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||
|
||||
public class CDTMainWizardPage extends WizardNewProjectCreationPage implements IWizardItemsListListener {
|
||||
|
@ -68,7 +67,6 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
private Tree tree;
|
||||
private Composite right;
|
||||
private Button show_sup;
|
||||
private Button checkBoxTryNewSD;
|
||||
private Label right_label;
|
||||
|
||||
public CWizardHandler h_selected = null;
|
||||
|
@ -156,20 +154,6 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
|
||||
// restore settings from preferences
|
||||
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
||||
|
||||
checkBoxTryNewSD = new Button(c, SWT.CHECK);
|
||||
checkBoxTryNewSD.setText(Messages.LanguageSettingsProviders_EnableForProject);
|
||||
/* GridData */gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
checkBoxTryNewSD.setLayoutData(gd);
|
||||
|
||||
// restore settings from preferences
|
||||
boolean isTryNewSD = true;
|
||||
boolean contains = CUIPlugin.getDefault().getPreferenceStore().contains(LanguageSettingsProvidersPage.KEY_NEWSD);
|
||||
if (contains) {
|
||||
isTryNewSD = CDTPrefUtil.getBool(LanguageSettingsProvidersPage.KEY_NEWSD);
|
||||
}
|
||||
checkBoxTryNewSD.setSelection(isTryNewSD);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -497,13 +481,5 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
public List filterItems(List items) {
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* AG FIXME - remove before CDT Juno release.
|
||||
* @since 5.4
|
||||
*/
|
||||
public boolean isTryingNewSD() {
|
||||
return checkBoxTryNewSD.getSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue