diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
index e91d73d7f1..7e1716c76d 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
@@ -119,6 +119,10 @@
label = "${res:Dialog.ProjectOptions.Publish}"
class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.Publish"/>-->
+
+
@@ -497,4 +501,10 @@
class = "CSharpBinding.FormsDesigner.FormsDesignerSecondaryDisplayBinding"
fileNamePattern = "\.cs$"/>
+
+
+
+
+
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs
index 8b8ec9b93a..50a9e0c66a 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsPersistence.cs
@@ -25,6 +25,15 @@ using ICSharpCode.SharpDevelop.Project;
namespace CSharpBinding.FormattingStrategy
{
+ public class CSharpFormattingOptionsPersistenceInitCommand : SimpleCommand
+ {
+ public override void Execute(object parameter)
+ {
+ // Initialize CSharpFormattingOptionsPersistence as early as possible (before solution is opened)
+ CSharpFormattingOptionsPersistence.Initialize();
+ }
+ }
+
///
/// Persistence helper for C# formatting options.
///
@@ -32,7 +41,7 @@ namespace CSharpBinding.FormattingStrategy
{
static Dictionary projectOptions;
- static CSharpFormattingOptionsPersistence()
+ public static void Initialize()
{
projectOptions = new Dictionary();
@@ -64,10 +73,10 @@ namespace CSharpBinding.FormattingStrategy
if (csproject != null) {
string key = project.FileName;
if (!projectOptions.ContainsKey(key)) {
- // Lazily create options container
+ // Lazily create options container for project
projectOptions[key] = new CSharpFormattingOptionsPersistence(
csproject.ExtensionProperties,
- new CSharpFormattingOptionsContainer((SolutionOptions ?? GlobalOptions).OptionsContainer)); // HACK!
+ new CSharpFormattingOptionsContainer((SolutionOptions ?? GlobalOptions).OptionsContainer));
}
return projectOptions[key];
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpProjectFormattingOptions.xaml.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpProjectFormattingOptions.xaml.cs
index 8219951d59..7c15463398 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpProjectFormattingOptions.xaml.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpProjectFormattingOptions.xaml.cs
@@ -45,10 +45,14 @@ namespace CSharpBinding.OptionPanels
protected override void Load(ICSharpCode.SharpDevelop.Project.MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
+ if (persistenceHelper != null) {
+ persistenceHelper.OptionsContainer.PropertyChanged -= ContainerPropertyChanged;
+ }
persistenceHelper = CSharpFormattingOptionsPersistence.GetProjectOptions(project);
formattingEditor.OptionsContainer = persistenceHelper.OptionsContainer;
formattingEditor.AllowPresets = true;
persistenceHelper.Load();
+ persistenceHelper.OptionsContainer.PropertyChanged += ContainerPropertyChanged;
}
protected override bool Save(ICSharpCode.SharpDevelop.Project.MSBuildBasedProject project, string configuration, string platform)
@@ -56,5 +60,11 @@ namespace CSharpBinding.OptionPanels
bool success = (persistenceHelper != null) && persistenceHelper.Save();
return base.Save(project, configuration, platform) && success;
}
+
+ void ContainerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ // A formatting option has been changed, mark project settings as dirty
+ this.IsDirty = true;
+ }
}
}
\ No newline at end of file
diff --git a/src/Main/Base/Project/Src/Project/AbstractProject.cs b/src/Main/Base/Project/Src/Project/AbstractProject.cs
index 9e590052b2..781860436a 100644
--- a/src/Main/Base/Project/Src/Project/AbstractProject.cs
+++ b/src/Main/Base/Project/Src/Project/AbstractProject.cs
@@ -59,7 +59,6 @@ namespace ICSharpCode.SharpDevelop.Project
this.configurationMapping = information.ConfigurationMapping ?? new ConfigurationMapping();
this.Name = information.ProjectName;
this.FileName = information.FileName;
- this.globalPreferencesFileName = new FileName(fileName + ".sdsettings");
this.idGuid = (information.IdGuid != Guid.Empty ? information.IdGuid : Guid.NewGuid());
this.TypeGuid = information.TypeGuid;
if (information.ProjectSections != null)
@@ -115,28 +114,6 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
- Properties globalPreferences = new Properties();
-
- public Properties GlobalPreferences {
- get {
- lock (syncRoot) {
- if (globalPreferences == null) {
- globalPreferences = new Properties(); // in case of errors, use empty properties container
- if (FileUtility.IsValidPath(globalPreferencesFileName) && File.Exists(globalPreferencesFileName)) {
- try {
- globalPreferences = Properties.Load(globalPreferencesFileName);
- } catch (IOException) {
- } catch (UnauthorizedAccessException) {
- } catch (XmlException) {
- // ignore errors about inaccessible or malformed files
- }
- }
- }
- return globalPreferences;
- }
- }
- }
-
static FileName GetPreferenceFileName(string projectFileName)
{
string directory = Path.Combine(PropertyService.ConfigDirectory, "preferences");
@@ -154,7 +131,6 @@ namespace ICSharpCode.SharpDevelop.Project
FileName preferencesFile = GetPreferenceFileName(fileName);
System.IO.Directory.CreateDirectory(preferencesFile.GetParentDirectory());
p.Save(preferencesFile);
- this.GlobalPreferences.Save(globalPreferencesFileName);
} catch (IOException) {
} catch (UnauthorizedAccessException) {
}
@@ -163,7 +139,6 @@ namespace ICSharpCode.SharpDevelop.Project
#region Filename / Directory
volatile FileName fileName;
- volatile FileName globalPreferencesFileName;
volatile DirectoryName directoryName;
protected IProjectChangeWatcher watcher;