1
1
package io .sloeber .core .tools ;
2
2
3
3
import static io .sloeber .core .Messages .*;
4
+ import static io .sloeber .core .common .Const .*;
4
5
5
6
import java .io .File ;
6
7
import java .io .FilenameFilter ;
23
24
import org .eclipse .cdt .core .settings .model .ICConfigurationDescription ;
24
25
import org .eclipse .cdt .core .settings .model .ICProjectDescription ;
25
26
import org .eclipse .cdt .core .settings .model .ICProjectDescriptionManager ;
26
- import org .eclipse .cdt .core .settings .model .ICResourceDescription ;
27
27
import org .eclipse .cdt .core .settings .model .ICSourceEntry ;
28
28
import org .eclipse .cdt .core .settings .model .util .CDataUtil ;
29
29
import org .eclipse .core .resources .IFolder ;
43
43
import io .sloeber .core .api .SloeberProject ;
44
44
import io .sloeber .core .common .Common ;
45
45
import io .sloeber .core .common .ConfigurationPreferences ;
46
- import io .sloeber .core .common .Const ;
47
46
import io .sloeber .core .common .InstancePreferences ;
48
47
import io .sloeber .core .managers .Library ;
49
48
@@ -157,8 +156,8 @@ public static Map<String, IPath> findAllArduinoManagerLibraries() {
157
156
if (versions != null ) {
158
157
switch (versions .length ) {
159
158
case 0 :// A empty lib folder is hanging around
160
- Common .log (new Status ( IStatus . WARNING , Const . CORE_PLUGIN_ID ,
161
- EmptyLibFolder .replace (LIB , curLib )));
159
+ Common .log (
160
+ new Status ( IStatus . WARNING , CORE_PLUGIN_ID , EmptyLibFolder .replace (LIB , curLib )));
162
161
Lib_root .toFile ().delete ();
163
162
break ;
164
163
case 1 :// There should only be 1
@@ -170,7 +169,7 @@ public static Map<String, IPath> findAllArduinoManagerLibraries() {
170
169
// latest
171
170
int highestVersion = Version .getHighestVersion (versions );
172
171
ret .put (curLib , Lib_root .append (versions [highestVersion ]));
173
- Common .log (new Status (IStatus .WARNING , Const . CORE_PLUGIN_ID ,
172
+ Common .log (new Status (IStatus .WARNING , CORE_PLUGIN_ID ,
174
173
MultipleVersionsOfLib .replace (LIB , curLib )));
175
174
176
175
}
@@ -199,8 +198,7 @@ public static boolean removeLibrariesFromProject(IProject project, ICConfigurati
199
198
final IFolder folderHandle = project .getFolder (WORKSPACE_LIB_FOLDER + CurItem );
200
199
folderHandle .delete (true , null );
201
200
} catch (CoreException e ) {
202
- Common .log (
203
- new Status (IStatus .ERROR , Const .CORE_PLUGIN_ID , failed_to_remove_lib .replace (LIB , CurItem ), e ));
201
+ Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID , failed_to_remove_lib .replace (LIB , CurItem ), e ));
204
202
}
205
203
}
206
204
return Helpers .removeInvalidIncludeFolders (confdesc );
@@ -421,7 +419,7 @@ public static void checkLibraries(IProject affectedProject) {
421
419
installedLibs .keySet ().retainAll (UnresolvedIncludedHeaders );
422
420
if (!installedLibs .isEmpty ()) {
423
421
// there are possible libraries to add
424
- Common .log (new Status (IStatus .INFO , Const . CORE_PLUGIN_ID , "list of libraries to add to project " //$NON-NLS-1$
422
+ Common .log (new Status (IStatus .INFO , CORE_PLUGIN_ID , "list of libraries to add to project " //$NON-NLS-1$
425
423
+ affectedProject .getName () + ": " //$NON-NLS-1$
426
424
+ installedLibs .keySet ().toString ()));
427
425
Map <String , List <IPath >> foldersToChange = addLibrariesToProject (affectedProject ,
@@ -450,8 +448,7 @@ public static boolean adjustProjectDescription(ICConfigurationDescription confde
450
448
boolean descriptionMustBeSet = Helpers .addIncludeFolder (confdesc , foldersToAddToInclude , true );
451
449
List <IPath > foldersToRemoveFromBuildPath = foldersToInclude .get (REMOVE );
452
450
if ((foldersToRemoveFromBuildPath != null ) && (!foldersToRemoveFromBuildPath .isEmpty ())) {
453
- ICResourceDescription cfgd = confdesc .getResourceDescription (new Path (new String ()), true );
454
- ICSourceEntry [] sourceEntries = cfgd .getConfiguration ().getSourceEntries ();
451
+ ICSourceEntry [] sourceEntries = confdesc .getSourceEntries ();
455
452
for (IPath curFile : foldersToRemoveFromBuildPath ) {
456
453
try {
457
454
if (!CDataUtil .isExcluded (curFile , sourceEntries )) {
@@ -464,7 +461,7 @@ public static boolean adjustProjectDescription(ICConfigurationDescription confde
464
461
}
465
462
}
466
463
try {
467
- cfgd . getConfiguration () .setSourceEntries (sourceEntries );
464
+ confdesc .setSourceEntries (sourceEntries );
468
465
} catch (Exception e ) {
469
466
// ignore
470
467
}
0 commit comments