|
1 | 1 | package it.baeyens.arduino.tools;
|
2 | 2 |
|
3 |
| -<<<<<<< HEAD |
4 | 3 | import it.baeyens.arduino.ui.BuildConfigurationsPage.ConfigurationDescriptor;
|
5 | 4 |
|
6 | 5 | import java.util.ArrayList;
|
| 6 | +import java.util.List; |
7 | 7 |
|
8 |
| -======= |
9 | 8 | import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
10 |
| ->>>>>>> 900a472803717354280efa2760da613018fee890 |
11 | 9 | import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
12 | 10 | import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
13 | 11 | import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
|
24 | 22 | import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
25 | 23 | import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
26 | 24 | import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
27 |
| -import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; |
28 | 25 | import org.eclipse.core.resources.IProject;
|
29 | 26 | import org.eclipse.core.runtime.CoreException;
|
30 | 27 | import org.eclipse.core.runtime.IProgressMonitor;
|
31 | 28 |
|
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 |
40 | 29 | @SuppressWarnings("restriction")
|
41 | 30 | // TOFIX Get this code in CDT so I should not have to do this
|
42 | 31 | public class ShouldHaveBeenInCDT {
|
43 | 32 | /*
|
44 | 33 | * Copied from wizard STDWizardHandler package package org.eclipse.cdt.managedbuilder.ui.wizards;; This method creates the .cProject file in your
|
45 | 34 | * project.
|
46 |
| - * |
| 35 | + * |
47 | 36 | * BK: modified this and made it work for multiple configs.
|
48 | 37 | */
|
49 | 38 | /**
|
50 | 39 | * This method creates the .cProject file in your project. it is intended to be used with newly created projects. Using this method with project
|
51 | 40 | * that have existed for some time is unknown
|
52 |
| - * |
53 |
| - * |
| 41 | + * |
| 42 | + * |
54 | 43 | * @param project
|
55 | 44 | * The newly created project that needs a .cproject file.
|
56 | 45 | * @param alCfgs
|
@@ -118,60 +107,52 @@ public static void setCProjectDescription(IProject project, ArrayList<Configurat
|
118 | 107 | CConfigurationData data = cfg.getConfigurationData();
|
119 | 108 | ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
120 | 109 |
|
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 |
| -======= |
129 | 110 | setDefaultLanguageSettingsProviders(project, alCfgs.get(i), cfg, cfgDes);
|
130 |
| ->>>>>>> 900a472803717354280efa2760da613018fee890 |
131 | 111 | }
|
132 | 112 | monitor.worked(50);
|
133 | 113 | mngr.setProjectDescription(project, des);
|
134 | 114 |
|
135 | 115 | }
|
136 | 116 |
|
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); |
141 | 122 |
|
142 |
| - if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { |
143 |
| - ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper)cfgDescription; |
| 123 | + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { |
| 124 | + ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper) cfgDescription; |
144 | 125 |
|
145 |
| - lspk.setDefaultLanguageSettingsProvidersIds(new String[] {cfgDes.ToolchainID}); |
| 126 | + lspk.setDefaultLanguageSettingsProvidersIds(new String[] { cfgDes.ToolchainID }); |
146 | 127 |
|
147 |
| - List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription); |
148 |
| - lspk.setLanguageSettingProviders(providers); |
149 |
| - } |
| 128 | + List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription); |
| 129 | + lspk.setLanguageSettingProviders(providers); |
150 | 130 | }
|
| 131 | + } |
151 | 132 |
|
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; |
155 | 136 |
|
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 | + } |
160 | 141 |
|
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); |
172 | 147 | }
|
173 |
| - |
174 |
| - return providers; |
| 148 | + if (provider == null) { |
| 149 | + provider = LanguageSettingsManager.getWorkspaceProvider(id); |
| 150 | + } |
| 151 | + providers.add(provider); |
| 152 | + } |
175 | 153 | }
|
176 | 154 |
|
| 155 | + return providers; |
| 156 | + } |
| 157 | + |
177 | 158 | }
|
0 commit comments