Skip to content

Commit 64aef37

Browse files
author
jantje
committed
For iterator to java style
Unfortunately the formatter has formatted the file as well :-(
1 parent 319cf36 commit 64aef37

File tree

1 file changed

+90
-90
lines changed

1 file changed

+90
-90
lines changed

io.sloeber.core/src/io/sloeber/core/tools/ShouldHaveBeenInCDT.java

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -29,106 +29,106 @@
2929
@SuppressWarnings("restriction")
3030
// TOFIX Get this code in CDT so I should not have to do this
3131
public class ShouldHaveBeenInCDT {
32-
/*
33-
* Copied from wizard STDWizardHandler package package
34-
* org.eclipse.cdt.managedbuilder.ui.wizards;; This method creates the
35-
* .cProject file in your project.
36-
*
37-
* BK: modified this and made it work for multiple configs.
38-
*/
39-
/**
40-
* This method creates the .cProject file in your project. it is intended to
41-
* be used with newly created projects. Using this method with project that
42-
* have existed for some time is unknown
43-
*
44-
*
45-
* @param project
46-
* The newly created project that needs a .cproject file.
47-
* @param alCfgs
48-
* An array-list of configuration descriptors (names, toolchain
49-
* IDs) to be used with this project
50-
* @param isManagedBuild
51-
* When true the project is managed build. Else the project is
52-
* not (read you have to maintain the makefiles yourself)
53-
* @param monitor
54-
* The monitor to follow the process
55-
* @throws CoreException
56-
*/
57-
public static ICProjectDescription setCProjectDescription(IProject project,
58-
ArrayList<ConfigurationDescriptor> alCfgs, boolean isManagedBuild, IProgressMonitor monitor)
59-
throws CoreException {
60-
61-
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
62-
ICProjectDescription des = mngr.createProjectDescription(project, false, true);
63-
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
64-
ManagedProject mProj = new ManagedProject(des);
65-
info.setManagedProject(mProj);
66-
monitor.worked(20);
67-
68-
// Iterate across the configurations
69-
for (int i = 0; i < alCfgs.size(); i++) {
70-
IToolChain tcs = ManagedBuildManager.getExtensionToolChain(alCfgs.get(i).ToolchainID);
71-
72-
Configuration cfg = new Configuration(mProj, (ToolChain) tcs,
73-
ManagedBuildManager.calculateChildId(alCfgs.get(i).ToolchainID, null), alCfgs.get(i).configName);
74-
IBuilder bld = cfg.getEditableBuilder();
75-
if (bld != null) {
76-
bld.setManagedBuildOn(isManagedBuild);
77-
cfg.setArtifactName("${ProjName}"); //$NON-NLS-1$
78-
} else {
79-
System.out.println("Messages.StdProjectTypeHandler_3"); //$NON-NLS-1$
80-
}
81-
CConfigurationData data = cfg.getConfigurationData();
82-
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
83-
84-
setDefaultLanguageSettingsProviders(project, alCfgs.get(i), cfg, cfgDes);
85-
}
86-
monitor.worked(50);
87-
return des;
32+
/*
33+
* Copied from wizard STDWizardHandler package package
34+
* org.eclipse.cdt.managedbuilder.ui.wizards;; This method creates the
35+
* .cProject file in your project.
36+
*
37+
* BK: modified this and made it work for multiple configs.
38+
*/
39+
/**
40+
* This method creates the .cProject file in your project. it is intended to
41+
* be used with newly created projects. Using this method with project that
42+
* have existed for some time is unknown
43+
*
44+
*
45+
* @param project
46+
* The newly created project that needs a .cproject file.
47+
* @param alCfgs
48+
* An array-list of configuration descriptors (names, toolchain
49+
* IDs) to be used with this project
50+
* @param isManagedBuild
51+
* When true the project is managed build. Else the project is
52+
* not (read you have to maintain the makefiles yourself)
53+
* @param monitor
54+
* The monitor to follow the process
55+
* @throws CoreException
56+
*/
57+
public static ICProjectDescription setCProjectDescription(IProject project,
58+
ArrayList<ConfigurationDescriptor> alCfgs, boolean isManagedBuild, IProgressMonitor monitor)
59+
throws CoreException {
60+
61+
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
62+
ICProjectDescription des = mngr.createProjectDescription(project, false, true);
63+
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
64+
ManagedProject mProj = new ManagedProject(des);
65+
info.setManagedProject(mProj);
66+
monitor.worked(20);
67+
68+
// Iterate across the configurations
69+
for (ConfigurationDescriptor curConfDesc : alCfgs) {
70+
IToolChain tcs = ManagedBuildManager.getExtensionToolChain(curConfDesc.ToolchainID);
71+
72+
Configuration cfg = new Configuration(mProj, (ToolChain) tcs,
73+
ManagedBuildManager.calculateChildId(curConfDesc.ToolchainID, null), curConfDesc.configName);
74+
IBuilder bld = cfg.getEditableBuilder();
75+
if (bld != null) {
76+
bld.setManagedBuildOn(isManagedBuild);
77+
cfg.setArtifactName("${ProjName}"); //$NON-NLS-1$
78+
} else {
79+
System.out.println("Messages.StdProjectTypeHandler_3"); //$NON-NLS-1$
80+
}
81+
CConfigurationData data = cfg.getConfigurationData();
82+
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
83+
84+
setDefaultLanguageSettingsProviders(project, curConfDesc, cfg, cfgDes);
85+
}
86+
monitor.worked(50);
87+
return des;
8888

89-
}
89+
}
9090

91-
private static void setDefaultLanguageSettingsProviders(IProject project, ConfigurationDescriptor cfgDes,
92-
IConfiguration cfg, ICConfigurationDescription cfgDescription) {
93-
// propagate the preference to project properties
94-
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport
95-
.isLanguageSettingsProvidersFunctionalityEnabled(null);
96-
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
91+
private static void setDefaultLanguageSettingsProviders(IProject project, ConfigurationDescriptor cfgDes,
92+
IConfiguration cfg, ICConfigurationDescription cfgDescription) {
93+
// propagate the preference to project properties
94+
boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport
95+
.isLanguageSettingsProvidersFunctionalityEnabled(null);
96+
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled);
9797

98-
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
99-
ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper) cfgDescription;
98+
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
99+
ILanguageSettingsProvidersKeeper lspk = (ILanguageSettingsProvidersKeeper) cfgDescription;
100100

101-
lspk.setDefaultLanguageSettingsProvidersIds(new String[] { cfgDes.ToolchainID });
101+
lspk.setDefaultLanguageSettingsProvidersIds(new String[] { cfgDes.ToolchainID });
102102

103-
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription);
104-
lspk.setLanguageSettingProviders(providers);
103+
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg, cfgDescription);
104+
lspk.setLanguageSettingProviders(providers);
105+
}
105106
}
106-
}
107107

108-
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg,
109-
ICConfigurationDescription cfgDescription) {
110-
List<ILanguageSettingsProvider> providers = new ArrayList<>();
111-
String[] ids = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
108+
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg,
109+
ICConfigurationDescription cfgDescription) {
110+
List<ILanguageSettingsProvider> providers = new ArrayList<>();
111+
String[] ids = cfg != null ? cfg.getDefaultLanguageSettingsProviderIds() : null;
112112

113-
if (ids == null) {
114-
// Try with legacy providers
115-
ids = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(cfgDescription);
116-
}
117-
118-
if (ids != null) {
119-
for (String id : ids) {
120-
ILanguageSettingsProvider provider = null;
121-
if (!LanguageSettingsManager.isPreferShared(id)) {
122-
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
113+
if (ids == null) {
114+
// Try with legacy providers
115+
ids = ScannerDiscoveryLegacySupport.getDefaultProviderIdsLegacy(cfgDescription);
123116
}
124-
if (provider == null) {
125-
provider = LanguageSettingsManager.getWorkspaceProvider(id);
117+
118+
if (ids != null) {
119+
for (String id : ids) {
120+
ILanguageSettingsProvider provider = null;
121+
if (!LanguageSettingsManager.isPreferShared(id)) {
122+
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
123+
}
124+
if (provider == null) {
125+
provider = LanguageSettingsManager.getWorkspaceProvider(id);
126+
}
127+
providers.add(provider);
128+
}
126129
}
127-
providers.add(provider);
128-
}
129-
}
130130

131-
return providers;
132-
}
131+
return providers;
132+
}
133133

134134
}

0 commit comments

Comments
 (0)