Skip to content

Commit 52ec840

Browse files
committed
merged the chages for issue #97
1 parent 8c57add commit 52ec840

File tree

1 file changed

+35
-54
lines changed

1 file changed

+35
-54
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ShouldHaveBeenInCDT.java

Lines changed: 35 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package it.baeyens.arduino.tools;
22

3-
<<<<<<< HEAD
43
import it.baeyens.arduino.ui.BuildConfigurationsPage.ConfigurationDescriptor;
54

65
import java.util.ArrayList;
6+
import java.util.List;
77

8-
=======
98
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
10-
>>>>>>> 900a472803717354280efa2760da613018fee890
119
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
1210
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
1311
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
@@ -24,33 +22,24 @@
2422
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
2523
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
2624
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
27-
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
2825
import org.eclipse.core.resources.IProject;
2926
import org.eclipse.core.runtime.CoreException;
3027
import org.eclipse.core.runtime.IProgressMonitor;
3128

32-
<<<<<<< HEAD
33-
=======
34-
import it.baeyens.arduino.ui.BuildConfigurationsPage.ConfigurationDescriptor;
35-
36-
import java.util.ArrayList;
37-
import java.util.List;
38-
39-
>>>>>>> 900a472803717354280efa2760da613018fee890
4029
@SuppressWarnings("restriction")
4130
// TOFIX Get this code in CDT so I should not have to do this
4231
public class ShouldHaveBeenInCDT {
4332
/*
4433
* Copied from wizard STDWizardHandler package package org.eclipse.cdt.managedbuilder.ui.wizards;; This method creates the .cProject file in your
4534
* project.
46-
*
35+
*
4736
* BK: modified this and made it work for multiple configs.
4837
*/
4938
/**
5039
* This method creates the .cProject file in your project. it is intended to be used with newly created projects. Using this method with project
5140
* that have existed for some time is unknown
52-
*
53-
*
41+
*
42+
*
5443
* @param project
5544
* The newly created project that needs a .cproject file.
5645
* @param alCfgs
@@ -118,60 +107,52 @@ public static void setCProjectDescription(IProject project, ArrayList<Configurat
118107
CConfigurationData data = cfg.getConfigurationData();
119108
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
120109

121-
<<<<<<< HEAD
122-
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
123-
ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper) cfgDes;
124-
lspk.setDefaultLanguageSettingsProvidersIds(new String[] { alCfgs.get(i).ToolchainID });
125-
}
126-
// without this line the indexer doesn't work properly in juno
127-
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDes);
128-
=======
129110
setDefaultLanguageSettingsProviders(project, alCfgs.get(i), cfg, cfgDes);
130-
>>>>>>> 900a472803717354280efa2760da613018fee890
131111
}
132112
monitor.worked(50);
133113
mngr.setProjectDescription(project, des);
134114

135115
}
136116

137-
private static void setDefaultLanguageSettingsProviders(IProject project, ConfigurationDescriptor cfgDes, IConfiguration cfg, ICConfigurationDescription cfgDescription) {
138-
// propagate the preference to project properties
139-
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null);
140-
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
117+
private static void setDefaultLanguageSettingsProviders(IProject project, ConfigurationDescriptor cfgDes, IConfiguration cfg,
118+
ICConfigurationDescription cfgDescription) {
119+
// propagate the preference to project properties
120+
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null);
121+
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
141122

142-
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
143-
ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper)cfgDescription;
123+
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
124+
ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper) cfgDescription;
144125

145-
lspk.setDefaultLanguageSettingsProvidersIds(new String[] {cfgDes.ToolchainID});
126+
lspk.setDefaultLanguageSettingsProvidersIds(new String[] { cfgDes.ToolchainID });
146127

147-
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription);
148-
lspk.setLanguageSettingProviders(providers);
149-
}
128+
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription);
129+
lspk.setLanguageSettingProviders(providers);
150130
}
131+
}
151132

152-
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg, ICConfigurationDescription cfgDescription) {
153-
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
154-
String[] ids = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
133+
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg, ICConfigurationDescription cfgDescription) {
134+
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
135+
String[] ids = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
155136

156-
if (ids == null) {
157-
// Try with legacy providers
158-
ids = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(cfgDescription);
159-
}
137+
if (ids == null) {
138+
// Try with legacy providers
139+
ids = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(cfgDescription);
140+
}
160141

161-
if (ids != null) {
162-
for (String id : ids) {
163-
ILanguageSettingsProvider provider = null;
164-
if (!LanguageSettingsManager.isPreferShared(id)) {
165-
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
166-
}
167-
if (provider == null) {
168-
provider = LanguageSettingsManager.getWorkspaceProvider(id);
169-
}
170-
providers.add(provider);
171-
}
142+
if (ids != null) {
143+
for (String id : ids) {
144+
ILanguageSettingsProvider provider = null;
145+
if (!LanguageSettingsManager.isPreferShared(id)) {
146+
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
172147
}
173-
174-
return providers;
148+
if (provider == null) {
149+
provider = LanguageSettingsManager.getWorkspaceProvider(id);
150+
}
151+
providers.add(provider);
152+
}
175153
}
176154

155+
return providers;
156+
}
157+
177158
}

0 commit comments

Comments
 (0)