Skip to content

Commit 0dba549

Browse files
author
jantje
committed
#1163 do not act on config changes during project creation
1 parent 67f895e commit 0dba549

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

io.sloeber.core/src/io/sloeber/core/listeners/ConfigurationChangeListener.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.eclipse.core.runtime.IStatus;
2121
import org.eclipse.core.runtime.Status;
2222

23+
import io.sloeber.core.Activator;
2324
import io.sloeber.core.InternalBoardDescriptor;
2425
import io.sloeber.core.api.BoardDescriptor;
2526
import io.sloeber.core.common.Common;
@@ -34,29 +35,33 @@ public void handleEvent(CProjectDescriptionEvent event) {
3435
if (event.getEventType() != CProjectDescriptionEvent.ABOUT_TO_APPLY) {
3536
return;
3637
}
37-
ICProjectDescription projDesc = event.getNewCProjectDescription();
38-
38+
39+
IProject activeProject = event.getProject();
3940
// only handle arduino nature projects
4041
try {
41-
if (!event.getProject().hasNature(Const.ARDUINO_NATURE_ID)) {
42+
if (!activeProject.hasNature(Const.ARDUINO_NATURE_ID)) {
4243
return;
4344
}
4445
} catch (Exception e) {
4546
// don't care don't update
4647
return;
4748
}
48-
49+
if(IndexerController.isPosponed(activeProject)) {
50+
Common.log(new Status(Const.SLOEBER_STATUS_DEBUG, Activator.getId(),"Ignoring configuration change during project creation "+activeProject.getName()));
51+
return;
52+
}
53+
ICProjectDescription projDesc = event.getNewCProjectDescription();
4954
ICProjectDescription oldprojDesc = event.getOldCProjectDescription();
5055
ICConfigurationDescription activeConf = projDesc.getActiveConfiguration();
51-
IProject activeProject = projDesc.getProject();
56+
5257

5358
InternalBoardDescriptor oldBoardDescriptor = (InternalBoardDescriptor) BoardDescriptor
5459
.makeBoardDescriptor(oldprojDesc.getActiveConfiguration());
5560
InternalBoardDescriptor newBoardDescriptor = (InternalBoardDescriptor) BoardDescriptor
5661
.makeBoardDescriptor(activeConf);
5762

5863
if (oldBoardDescriptor.equals(newBoardDescriptor)) {
59-
if (event.getProject().getName().equals(oldBoardDescriptor.getProjectName())) {
64+
if (activeProject.getName().equals(oldBoardDescriptor.getProjectName())) {
6065
if(oldprojDesc.getActiveConfiguration().getName().equals(projDesc.getActiveConfiguration().getName())) {
6166
// only act when there is change
6267
return;

io.sloeber.core/src/io/sloeber/core/listeners/IndexerController.java

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public boolean postponeIndexerSetup(ICProject cProject) {
2929
}
3030
return ret;
3131
}
32+
public static boolean isPosponed(IProject project) {
33+
return fProjects.contains(project);
34+
}
3235
public static void doNotIndex(IProject project) {
3336
Common.log(new Status(IStatus.WARNING, Activator.getId(),"Do not index "+project.getName()));
3437
fProjects.add(project);

0 commit comments

Comments
 (0)