From 987d11ef428699dc68bc5b89d5c54960a2ec41a2 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Sun, 20 Jun 2021 00:03:44 -0400 Subject: [PATCH] Bug 574333 - Per-project Doxygen options are not flushed until saved a second time When the options are applied in performApply, the call DocCommentOwnerManager.setCommentOwner causes to set the CProjectDescription, which causes UserDefinedEnvironmentSupplier to flush cdt.core preferences. Then DocCommentOwnerArea.apply populates the preference storage, but the preferences are not flushed after that therefore the new options values only exist in memory. Swapping the calls of DocCommentOwnerManager.setCommentOwner and DocCommentOwnerArea.apply works but it makes no sense for the flushing of Documentation options to depend on UserDefinedEnvironmentSupplier flushing the preferences - it would work by a lucky accident. A clean option would be to go through the preference's page IWorkingCopyManager but this would involve a lot of more risky changes in the DocOwner/Doxygen code and a vast majority of CDT code does not do that. Instead, this change explicitly calls CCoreInternals.savePreferences which flushes the preferences, just like Indexer options does. Change-Id: Id9a57cde47794f57f26ae295ec01eeb1df9aa120 Signed-off-by: Marc-Andre Laperle --- .../src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerBlock.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerBlock.java index 06f0a29f756..154bb79face 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/DocCommentOwnerBlock.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.ui.dialogs; import org.eclipse.cdt.doxygen.core.DoxygenPreferences; +import org.eclipse.cdt.internal.core.CCoreInternals; import org.eclipse.cdt.internal.ui.dialogs.DocCommentOwnerArea; import org.eclipse.cdt.internal.ui.text.doctools.DocCommentOwnerManager; import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner; @@ -120,6 +121,7 @@ public class DocCommentOwnerBlock extends AbstractCOptionPage { fManager.setCommentOwner(project, newOwner, true); } docCommentOwnerArea.apply(doxygenPreferences.projectStorage(project)); + CCoreInternals.savePreferences(project, true); } public IProject getProject() {