Browse Source

Fixed SD-371: Adding empty combine to a combine causes exception

and worked on SD2-425.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@497 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2818a84d16
  1. 11
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs
  2. 5
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.cs
  3. 26
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  4. 4
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/SolutionNodeCommands.cs
  5. 9
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  6. 80
      src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs
  7. 6
      src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPadToolbarCommands.cs

11
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AbstractBuildOptions.cs

@ -87,7 +87,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
if (bool.Parse(Get("false"))) { if (bool.Parse(Get("false"))) {
all.Checked = true; all.Checked = true;
} else { } else {
if (this.Helper.GetProperty("WarningsAsErrors", "").Length > 0) { PropertyStorageLocation tmp;
if (this.Helper.GetProperty("WarningsAsErrors", "", out tmp).Length > 0) {
specific.Checked = true; specific.Checked = true;
} else { } else {
none.Checked = true; none.Checked = true;
@ -109,9 +110,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
} }
} }
ConfigurationGuiBinding debugInfoBinding;
protected void InitAdvanced() protected void InitAdvanced()
{ {
helper.BindEnum<DebugSymbolType>("debugInfoComboBox", "DebugType"); debugInfoBinding = helper.BindEnum<DebugSymbolType>("debugInfoComboBox", "DebugType");
helper.BindBoolean("registerCOMInteropCheckBox", "RegisterForComInterop", false); helper.BindBoolean("registerCOMInteropCheckBox", "RegisterForComInterop", false);
helper.BindStringEnum("generateSerializationAssemblyComboBox", "GenerateSerializationAssemblies", helper.BindStringEnum("generateSerializationAssemblyComboBox", "GenerateSerializationAssemblies",
"Auto", "Auto",
@ -131,9 +134,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
if (base.StorePanelContents()) { if (base.StorePanelContents()) {
if ((DebugSymbolType)Get<ComboBox>("debugInfo").SelectedIndex == DebugSymbolType.Full) { if ((DebugSymbolType)Get<ComboBox>("debugInfo").SelectedIndex == DebugSymbolType.Full) {
helper.SetProperty("DebugSymbols", "true"); helper.SetProperty("DebugSymbols", "true", debugInfoBinding.Location);
} else { } else {
helper.SetProperty("DebugSymbols", "false"); helper.SetProperty("DebugSymbols", "false", debugInfoBinding.Location);
} }
return true; return true;
} else { } else {

5
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.cs

@ -18,6 +18,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public class Signing : AbstractProjectOptionPanel public class Signing : AbstractProjectOptionPanel
{ {
ComboBox keyFile; ComboBox keyFile;
ConfigurationGuiBinding signAssemblyBinding;
const string KeyFileExtensions = "*.snk;*.pfx;*.key"; const string KeyFileExtensions = "*.snk;*.pfx;*.key";
@ -26,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
SetupFromXmlResource("ProjectOptions.Signing.xfrm"); SetupFromXmlResource("ProjectOptions.Signing.xfrm");
InitializeHelper(); InitializeHelper();
helper.BindBoolean("signAssemblyCheckBox", "SignAssembly", false); signAssemblyBinding = helper.BindBoolean("signAssemblyCheckBox", "SignAssembly", false);
Get<CheckBox>("signAssembly").CheckedChanged += new EventHandler(UpdateEnabledStates); Get<CheckBox>("signAssembly").CheckedChanged += new EventHandler(UpdateEnabledStates);
@ -103,7 +104,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public override bool StorePanelContents() public override bool StorePanelContents()
{ {
if (IsDirty && Get<CheckBox>("signAssembly").Checked) { if (IsDirty && Get<CheckBox>("signAssembly").Checked) {
helper.SetProperty("AssemblyOriginatorKeyMode", "File"); helper.SetProperty("AssemblyOriginatorKeyMode", "File", signAssemblyBinding.Location);
} }
return base.StorePanelContents(); return base.StorePanelContents();
} }

26
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -126,7 +126,7 @@ namespace ICSharpCode.SharpDevelop.Gui
SetWordWrap(); SetWordWrap();
myPanel.ResumeLayout(false); myPanel.ResumeLayout(false);
SetText(messageCategories[selectedCategory]); SetText(messageCategories[selectedCategory], messageCategories[selectedCategory].Text);
} }
void SetWordWrap() void SetWordWrap()
@ -165,14 +165,15 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
void ClearText(MessageViewCategory category) void ClearText(MessageViewCategory category)
{ {
textEditorControl.Text = ""; if (messageCategories[SelectedCategoryIndex] == category) {
textEditorControl.Refresh(); textEditorControl.Text = "";
SelectCategory(category.Category); textEditorControl.Refresh();
}
} }
void CategoryTextSet(object sender, TextEventArgs e) void CategoryTextSet(object sender, TextEventArgs e)
{ {
WorkbenchSingleton.SafeThreadAsyncCall(this, "SetText", (MessageViewCategory)sender); WorkbenchSingleton.SafeThreadAsyncCall(this, "SetText", (MessageViewCategory)sender, e.Text);
} }
void CategoryTextAppended(object sender, TextEventArgs e) void CategoryTextAppended(object sender, TextEventArgs e)
@ -183,7 +184,7 @@ namespace ICSharpCode.SharpDevelop.Gui
void AppendText(MessageViewCategory category, string text) void AppendText(MessageViewCategory category, string text)
{ {
if (messageCategories[SelectedCategoryIndex] != category) { if (messageCategories[SelectedCategoryIndex] != category) {
SetText(category); SelectCategory(category.Category);
return; return;
} }
if (text != null) { if (text != null) {
@ -196,20 +197,21 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
} }
void SetText(MessageViewCategory category) void SetText(MessageViewCategory category, string text)
{ {
string text = StringParser.Parse(category.Text); if (messageCategories[SelectedCategoryIndex] != category) {
SelectCategory(category.Category);
return;
}
if (text == null) { if (text == null) {
text = String.Empty; text = String.Empty;
} else {
text = StringParser.Parse(text);
} }
textEditorControl.Text = text; textEditorControl.Text = text;
textEditorControl.Refresh(); textEditorControl.Refresh();
// textEditorControl.Select(text.Length , 0);
// textEditorControl.Select();
// textEditorControl.ScrollToCaret();
} }
public void SelectCategory(string categoryName) public void SelectCategory(string categoryName)
{ {
for (int i = 0; i < messageCategories.Count; ++i) { for (int i = 0; i < messageCategories.Count; ++i) {

4
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/SolutionNodeCommands.cs

@ -31,6 +31,10 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
if (node != null) { if (node != null) {
using (NewProjectDialog npdlg = new NewProjectDialog(false)) { using (NewProjectDialog npdlg = new NewProjectDialog(false)) {
if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
if (npdlg.NewProjectLocation.Length == 0) {
MessageService.ShowError("No project has been created, there is nothing to add.");
return;
}
AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation); AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation);
ProjectService.SaveSolution(); ProjectService.SaveSolution();
} }

9
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -305,26 +305,31 @@ namespace ICSharpCode.SharpDevelop.Project
public T GetProperty<T>(string property, T defaultValue) public T GetProperty<T>(string property, T defaultValue)
{ {
return GetProperty(this.Configuration, this.Platform, property, defaultValue); PropertyStorageLocation tmp;
return GetProperty(this.Configuration, this.Platform, property, defaultValue, out tmp);
} }
public T GetProperty<T>(string configurationName, string platform, string property, T defaultValue) public T GetProperty<T>(string configurationName, string platform, string property, T defaultValue, out PropertyStorageLocation location)
{ {
string configurationKey = platform != null ? configurationName + "|" + platform : configurationName; string configurationKey = platform != null ? configurationName + "|" + platform : configurationName;
PropertyGroup pg; PropertyGroup pg;
if (userConfigurations.TryGetValue(configurationKey, out pg)) { if (userConfigurations.TryGetValue(configurationKey, out pg)) {
if (pg.IsSet(property)) { if (pg.IsSet(property)) {
location = PropertyStorageLocation.UserSpecificConfiguration;
return pg.Get(property, defaultValue); return pg.Get(property, defaultValue);
} }
} }
if (configurations.TryGetValue(configurationKey, out pg)) { if (configurations.TryGetValue(configurationKey, out pg)) {
if (pg.IsSet(property)) { if (pg.IsSet(property)) {
location = PropertyStorageLocation.SpecificConfiguration;
return pg.Get(property, defaultValue); return pg.Get(property, defaultValue);
} }
} }
if (BaseConfiguration.IsSet(property)) { if (BaseConfiguration.IsSet(property)) {
location = PropertyStorageLocation.BaseConfiguration;
return BaseConfiguration.Get(property, defaultValue); return BaseConfiguration.Get(property, defaultValue);
} }
location = PropertyStorageLocation.Unchanged;
return defaultValue; return defaultValue;
} }

80
src/Main/Base/Project/Src/Project/ConfigurationGuiHelper.cs

@ -44,14 +44,40 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
PropertyStorageLocation defaultLocation = PropertyStorageLocation.BaseConfiguration;
public PropertyStorageLocation DefaultLocation {
get {
return defaultLocation;
}
set {
defaultLocation = value;
}
}
PropertyStorageLocation location;
public PropertyStorageLocation Location {
get {
return location;
}
set {
location = value;
}
}
public T Get<T>(T defaultValue) public T Get<T>(T defaultValue)
{ {
return helper.GetProperty(property, defaultValue); T result = helper.GetProperty(property, defaultValue, out location);
if (location == PropertyStorageLocation.Unchanged) {
location = defaultLocation;
}
return result;
} }
public void Set<T>(T value) public void Set<T>(T value)
{ {
helper.SetProperty(property, value); helper.SetProperty(property, value, location);
} }
public abstract void Load(); public abstract void Load();
@ -81,14 +107,14 @@ namespace ICSharpCode.SharpDevelop.Project
} }
} }
public T GetProperty<T>(string property, T defaultValue) public T GetProperty<T>(string property, T defaultValue, out PropertyStorageLocation location)
{ {
return project.GetProperty(configuration, platform, property, defaultValue); return project.GetProperty(configuration, platform, property, defaultValue, out location);
} }
public void SetProperty<T>(string property, T value) public void SetProperty<T>(string property, T value, PropertyStorageLocation location)
{ {
project.SetProperty(configuration, platform, property, value, PropertyStorageLocation.Unchanged); project.SetProperty(configuration, platform, property, value, location);
} }
/// <summary> /// <summary>
@ -160,17 +186,19 @@ namespace ICSharpCode.SharpDevelop.Project
} }
#region Bind bool to CheckBox #region Bind bool to CheckBox
public void BindBoolean(string control, string property, bool defaultValue) public ConfigurationGuiBinding BindBoolean(string control, string property, bool defaultValue)
{ {
BindBoolean(controlDictionary[control], property, defaultValue); return BindBoolean(controlDictionary[control], property, defaultValue);
} }
public void BindBoolean(Control control, string property, bool defaultValue) public ConfigurationGuiBinding BindBoolean(Control control, string property, bool defaultValue)
{ {
CheckBox checkBox = control as CheckBox; CheckBox checkBox = control as CheckBox;
if (checkBox != null) { if (checkBox != null) {
AddBinding(property, new CheckBoxBinding(checkBox, defaultValue)); CheckBoxBinding binding = new CheckBoxBinding(checkBox, defaultValue);
AddBinding(property, binding);
checkBox.CheckedChanged += ControlValueChanged; checkBox.CheckedChanged += ControlValueChanged;
return binding;
} else { } else {
throw new ApplicationException("Cannot bind " + control.GetType().Name + " to bool property."); throw new ApplicationException("Cannot bind " + control.GetType().Name + " to bool property.");
} }
@ -207,19 +235,21 @@ namespace ICSharpCode.SharpDevelop.Project
#endregion #endregion
#region Bind string to TextBox or ComboBox #region Bind string to TextBox or ComboBox
public void BindString(string control, string property) public ConfigurationGuiBinding BindString(string control, string property)
{ {
BindString(controlDictionary[control], property); return BindString(controlDictionary[control], property);
} }
public void BindString(Control control, string property) public ConfigurationGuiBinding BindString(Control control, string property)
{ {
if (control is TextBoxBase || control is ComboBox) { if (control is TextBoxBase || control is ComboBox) {
AddBinding(property, new SimpleTextBinding(control)); SimpleTextBinding binding = new SimpleTextBinding(control);
AddBinding(property, binding);
control.TextChanged += ControlValueChanged; control.TextChanged += ControlValueChanged;
if (control is ComboBox) { if (control is ComboBox) {
control.KeyDown += ComboBoxKeyDown; control.KeyDown += ComboBoxKeyDown;
} }
return binding;
} else { } else {
throw new ApplicationException("Cannot bind " + control.GetType().Name + " to string property."); throw new ApplicationException("Cannot bind " + control.GetType().Name + " to string property.");
} }
@ -256,10 +286,12 @@ namespace ICSharpCode.SharpDevelop.Project
#endregion #endregion
#region Bind hex number to TextBox #region Bind hex number to TextBox
public void BindHexadecimal(TextBoxBase textBox, string property, int defaultValue) public ConfigurationGuiBinding BindHexadecimal(TextBoxBase textBox, string property, int defaultValue)
{ {
AddBinding(property, new HexadecimalBinding(textBox, defaultValue)); HexadecimalBinding binding = new HexadecimalBinding(textBox, defaultValue);
AddBinding(property, binding);
textBox.TextChanged += ControlValueChanged; textBox.TextChanged += ControlValueChanged;
return binding;
} }
class HexadecimalBinding : ConfigurationGuiBinding class HexadecimalBinding : ConfigurationGuiBinding
@ -307,15 +339,15 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary> /// <summary>
/// Bind enum to ComboBox /// Bind enum to ComboBox
/// </summary> /// </summary>
public void BindEnum<T>(string control, string property, params T[] values) where T : struct public ConfigurationGuiBinding BindEnum<T>(string control, string property, params T[] values) where T : struct
{ {
BindEnum(controlDictionary[control], property, values); return BindEnum(controlDictionary[control], property, values);
} }
/// <summary> /// <summary>
/// Bind enum to ComboBox /// Bind enum to ComboBox
/// </summary> /// </summary>
public void BindEnum<T>(Control control, string property, params T[] values) where T : struct public ConfigurationGuiBinding BindEnum<T>(Control control, string property, params T[] values) where T : struct
{ {
Type type = typeof(T); Type type = typeof(T);
if (values == null || values.Length == 0) { if (values == null || values.Length == 0) {
@ -336,9 +368,11 @@ namespace ICSharpCode.SharpDevelop.Project
string[] valueNames = new string[values.Length]; string[] valueNames = new string[values.Length];
for (int i = 0; i < values.Length; i++) for (int i = 0; i < values.Length; i++)
valueNames[i] = values[i].ToString(); valueNames[i] = values[i].ToString();
AddBinding(property, new ComboBoxBinding(comboBox, valueNames, valueNames[0])); ComboBoxBinding binding = new ComboBoxBinding(comboBox, valueNames, valueNames[0]);
AddBinding(property, binding);
comboBox.SelectedIndexChanged += ControlValueChanged; comboBox.SelectedIndexChanged += ControlValueChanged;
comboBox.KeyDown += ComboBoxKeyDown; comboBox.KeyDown += ComboBoxKeyDown;
return binding;
} else { } else {
throw new ApplicationException("Cannot bind " + control.GetType().Name + " to enum property."); throw new ApplicationException("Cannot bind " + control.GetType().Name + " to enum property.");
} }
@ -411,12 +445,14 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary> /// <summary>
/// Bind enum to RadioButtons /// Bind enum to RadioButtons
/// </summary> /// </summary>
public void BindRadioEnum<T>(string property, params KeyValuePair<T, RadioButton>[] values) where T : struct public ConfigurationGuiBinding BindRadioEnum<T>(string property, params KeyValuePair<T, RadioButton>[] values) where T : struct
{ {
AddBinding(property, new RadioEnumBinding<T>(values)); RadioEnumBinding<T> binding = new RadioEnumBinding<T>(values);
AddBinding(property, binding);
foreach (KeyValuePair<T, RadioButton> pair in values) { foreach (KeyValuePair<T, RadioButton> pair in values) {
pair.Value.CheckedChanged += ControlValueChanged; pair.Value.CheckedChanged += ControlValueChanged;
} }
return binding;
} }
class RadioEnumBinding<T> : ConfigurationGuiBinding where T : struct class RadioEnumBinding<T> : ConfigurationGuiBinding where T : struct

6
src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPadToolbarCommands.cs

@ -50,7 +50,11 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
{ {
BookmarkNode node = BookmarkPad.Instance.CurrentNode; BookmarkNode node = BookmarkPad.Instance.CurrentNode;
if (node != null) { if (node != null) {
node.Bookmark.Document.BookmarkManager.RemoveMark(node.Bookmark); if (node.Bookmark.Document != null) {
node.Bookmark.Document.BookmarkManager.RemoveMark(node.Bookmark);
} else {
ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.RemoveMark(node.Bookmark);
}
WorkbenchSingleton.MainForm.Refresh(); WorkbenchSingleton.MainForm.Refresh();
} }
} }

Loading…
Cancel
Save