|
1 | 1 | package it.baeyens.arduino.tools;
|
2 | 2 |
|
3 | 3 | import org.eclipse.cdt.core.model.CoreModel;
|
| 4 | +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; |
4 | 5 | import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
5 | 6 | import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
| 7 | +import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; |
6 | 8 | import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
7 |
| -import org.eclipse.cdt.managedbuilder.core.IConfiguration; |
8 | 9 | import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
9 | 10 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
10 | 11 | import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
11 | 12 | import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
12 | 13 | import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
13 | 14 | import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
| 15 | +import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider; |
14 | 16 | import org.eclipse.core.resources.IProject;
|
15 | 17 | import org.eclipse.core.runtime.CoreException;
|
16 | 18 | import org.eclipse.core.runtime.IProgressMonitor;
|
@@ -41,87 +43,67 @@ public class ShouldHaveBeenInCDT {
|
41 | 43 | * The monitor to follow the process
|
42 | 44 | * @throws CoreException
|
43 | 45 | */
|
44 |
| - public static void setCProjectDescription(IProject project, |
45 |
| - String sTCIds[], //sTCIds and sCfgs -- Need to be ordered the same and the same length |
46 |
| - String sCfgs[], |
47 |
| - boolean isManagedBuild, |
48 |
| - IProgressMonitor monitor) throws CoreException { |
| 46 | + public static void setCProjectDescription(IProject project, String sTCIds[], // sTCIds and sCfgs -- Need to be ordered the same and the same |
| 47 | + // length |
| 48 | + String sCfgs[], boolean isManagedBuild, IProgressMonitor monitor) throws CoreException { |
49 | 49 |
|
50 |
| -<<<<<<< HEAD |
51 | 50 | ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
52 | 51 | ICProjectDescription des = mngr.createProjectDescription(project, false, false);
|
53 | 52 | ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
54 | 53 | ManagedProject mProj = new ManagedProject(des);
|
55 | 54 | info.setManagedProject(mProj);
|
56 | 55 | monitor.worked(20);
|
57 | 56 |
|
58 |
| - String s = "it.baeyens.arduino.core.toolChain.release"; |
59 |
| - IToolChain tcs = ManagedBuildManager.getExtensionToolChain(s); |
60 |
| - |
61 |
| - Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(s, null), configuration); |
62 |
| - IBuilder bld = cfg.getEditableBuilder(); |
63 |
| - if (bld != null) { |
64 |
| - if (bld.isInternalBuilder()) { |
65 |
| - IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false); |
66 |
| - IBuilder prefBuilder = prefCfg.getBuilder(); |
67 |
| - cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName()); |
68 |
| - bld = cfg.getEditableBuilder(); |
69 |
| - bld.setBuildPath(null); |
70 |
| - } |
71 |
| - bld.setManagedBuildOn(isManagedBuild); |
72 |
| - } else { |
73 |
| - System.out.println("Messages.StdProjectTypeHandler_3"); |
74 |
| - } |
75 |
| - cfg.setArtifactName(mProj.getDefaultArtifactName()); |
| 57 | + // String s = "it.baeyens.arduino.core.toolChain.release"; |
| 58 | + // IToolChain tcs = ManagedBuildManager.getExtensionToolChain(s); |
| 59 | + // |
| 60 | + // Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(s, null), "Release"); |
| 61 | + // IBuilder bld = cfg.getEditableBuilder(); |
| 62 | + // if (bld != null) { |
| 63 | + // if (bld.isInternalBuilder()) { |
| 64 | + // IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false); |
| 65 | + // IBuilder prefBuilder = prefCfg.getBuilder(); |
| 66 | + // cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName()); |
| 67 | + // bld = cfg.getEditableBuilder(); |
| 68 | + // bld.setBuildPath(null); |
| 69 | + // } |
| 70 | + // bld.setManagedBuildOn(isManagedBuild); |
| 71 | + // } else { |
| 72 | + // System.out.println("Messages.StdProjectTypeHandler_3"); |
| 73 | + // } |
| 74 | + // cfg.setArtifactName(mProj.getDefaultArtifactName()); |
76 | 75 | // CConfigurationData data = cfg.getConfigurationData();
|
77 | 76 | // ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
78 |
| - |
| 77 | + // |
79 | 78 | // ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDes);
|
80 | 79 |
|
81 |
| - // BK - 2013.10.18 |
82 |
| - // creates/add the configuration to the project description |
83 |
| - // des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, cfg.getConfigurationData()); |
| 80 | + // Iterate across the configurations |
| 81 | + for (int i = 0; i < Math.min(sTCIds.length, sCfgs.length); i++) { |
| 82 | + IToolChain tcs = ManagedBuildManager.getExtensionToolChain(sTCIds[i]); |
84 | 83 |
|
| 84 | + Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(sTCIds[i], null), sCfgs[i]); |
| 85 | + IBuilder bld = cfg.getEditableBuilder(); |
| 86 | + if (bld != null) { |
| 87 | + // if (bld.isInternalBuilder()) { |
| 88 | + // IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false); |
| 89 | + // IBuilder prefBuilder = prefCfg.getBuilder(); |
| 90 | + // String name = prefBuilder.getName(); |
| 91 | + // cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), name); |
| 92 | + // bld = cfg.getEditableBuilder(); |
| 93 | + // bld.setBuildPath(null); |
| 94 | + // } |
| 95 | + bld.setManagedBuildOn(isManagedBuild); |
| 96 | + cfg.setArtifactName("${ProjName}"); |
| 97 | + } else { |
| 98 | + System.out.println("Messages.StdProjectTypeHandler_3"); |
| 99 | + } |
| 100 | + CConfigurationData data = cfg.getConfigurationData(); |
| 101 | + ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); |
| 102 | + ConfigurationDataProvider.setDefaultLanguageSettingsProviders(project, cfg, cfgDes); |
| 103 | + } |
85 | 104 | monitor.worked(50);
|
86 | 105 | mngr.setProjectDescription(project, des);
|
87 | 106 |
|
88 |
| -======= |
89 |
| - ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); |
90 |
| - ICProjectDescription des = mngr.createProjectDescription(project, false, false); |
91 |
| - ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); |
92 |
| - ManagedProject mProj = new ManagedProject(des); |
93 |
| - info.setManagedProject(mProj); |
94 |
| - monitor.worked(20); |
95 |
| - |
96 |
| - //Iterate across the configurations |
97 |
| - for(int i = 0; i < Math.min(sTCIds.length, sCfgs.length); i++) |
98 |
| - { |
99 |
| - IToolChain tcs = ManagedBuildManager.getExtensionToolChain( sTCIds[i] ); |
100 |
| - |
101 |
| - Configuration cfg = new Configuration(mProj, (ToolChain) tcs, ManagedBuildManager.calculateChildId(sTCIds[i], null), sCfgs[i]); |
102 |
| - IBuilder bld = cfg.getEditableBuilder(); |
103 |
| - if (bld != null) { |
104 |
| - if (bld.isInternalBuilder()) { |
105 |
| - IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false); |
106 |
| - IBuilder prefBuilder = prefCfg.getBuilder(); |
107 |
| - cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName()); |
108 |
| - bld = cfg.getEditableBuilder(); |
109 |
| - bld.setBuildPath(null); |
110 |
| - } |
111 |
| - bld.setManagedBuildOn(isManagedBuild); |
112 |
| - } else { |
113 |
| - System.out.println("Messages.StdProjectTypeHandler_3"); |
114 |
| - } |
115 |
| - |
116 |
| - cfg.setArtifactName(mProj.getDefaultArtifactName()); |
117 |
| - |
118 |
| - //BK - 2013.10.18 |
119 |
| - // creates/add the configuration to the project description |
120 |
| - des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, cfg.getConfigurationData()); |
121 |
| - } |
122 |
| - monitor.worked(50); |
123 |
| - mngr.setProjectDescription(project, des); |
124 |
| ->>>>>>> 4cbef47052e0da99c097e164594f614f1b8bc5f7 |
125 | 107 | }
|
126 | 108 |
|
127 | 109 | }
|
0 commit comments