Browse Source

Fixed property grid bug (caused by lazy loading)."

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@28 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Mike Krüger 21 years ago
parent
commit
792856b8df
  1. 23
      src/Main/Base/Project/Src/Commands/BuildCommands.cs
  2. 11
      src/Main/Base/Project/Src/Commands/FileCommands.cs
  3. 27
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyPad.cs
  4. 7
      src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

23
src/Main/Base/Project/Src/Commands/BuildCommands.cs

@ -17,10 +17,11 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
{ {
public class Build : AbstractMenuCommand public class Build : AbstractMenuCommand
{ {
public static void ClearTasks() public static void BeforeBuild()
{ {
TaskService.BuildMessageViewCategory.ClearText(); TaskService.BuildMessageViewCategory.ClearText();
TaskService.Clear(); TaskService.Clear();
ICSharpCode.SharpDevelop.Commands.SaveAllFiles.SaveAll();
} }
public static void ShowResults(CompilerResults results) public static void ShowResults(CompilerResults results)
@ -38,8 +39,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
Build.ClearTasks(); Build.BeforeBuild();
new ICSharpCode.SharpDevelop.Commands.SaveAllFiles().Run();
Build.ShowResults(ProjectService.OpenSolution.Build()); Build.ShowResults(ProjectService.OpenSolution.Build());
} }
} }
@ -50,8 +50,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
Build.ClearTasks(); Build.BeforeBuild();
new ICSharpCode.SharpDevelop.Commands.SaveAllFiles().Run();
Build.ShowResults(ProjectService.OpenSolution.Rebuild()); Build.ShowResults(ProjectService.OpenSolution.Rebuild());
} }
} }
@ -62,7 +61,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
Build.ClearTasks(); Build.BeforeBuild();
Build.ShowResults(ProjectService.OpenSolution.Clean()); Build.ShowResults(ProjectService.OpenSolution.Clean());
} }
} }
@ -73,7 +72,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
Build.ClearTasks(); Build.BeforeBuild();
Build.ShowResults(ProjectService.OpenSolution.Publish()); Build.ShowResults(ProjectService.OpenSolution.Publish());
} }
} }
@ -97,8 +96,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.CurrentProject != null) { if (ProjectService.CurrentProject != null) {
Build.ClearTasks(); Build.BeforeBuild();
new ICSharpCode.SharpDevelop.Commands.SaveAllFiles().Run();
BuildProject.ShowResults(ProjectService.CurrentProject.Build()); BuildProject.ShowResults(ProjectService.CurrentProject.Build());
} }
} }
@ -109,8 +107,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.CurrentProject != null) { if (ProjectService.CurrentProject != null) {
Build.ClearTasks(); Build.BeforeBuild();
new ICSharpCode.SharpDevelop.Commands.SaveAllFiles().Run();
BuildProject.ShowResults(ProjectService.CurrentProject.Rebuild()); BuildProject.ShowResults(ProjectService.CurrentProject.Rebuild());
} }
} }
@ -121,7 +118,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.CurrentProject != null) { if (ProjectService.CurrentProject != null) {
Build.ClearTasks(); Build.BeforeBuild();
BuildProject.ShowResults(ProjectService.CurrentProject.Clean()); BuildProject.ShowResults(ProjectService.CurrentProject.Clean());
} }
} }
@ -132,7 +129,7 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run() public override void Run()
{ {
if (ProjectService.CurrentProject != null) { if (ProjectService.CurrentProject != null) {
Build.ClearTasks(); Build.BeforeBuild();
BuildProject.ShowResults(ProjectService.CurrentProject.Publish()); BuildProject.ShowResults(ProjectService.CurrentProject.Publish());
} }
} }

11
src/Main/Base/Project/Src/Commands/FileCommands.cs

@ -150,10 +150,8 @@ namespace ICSharpCode.SharpDevelop.Commands
public class SaveAllFiles : AbstractMenuCommand public class SaveAllFiles : AbstractMenuCommand
{ {
public override void Run() public static void SaveAll()
{ {
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) { foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (content.IsViewOnly) { if (content.IsViewOnly) {
continue; continue;
@ -169,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Commands
fdiag.OverwritePrompt = true; fdiag.OverwritePrompt = true;
fdiag.AddExtension = true; fdiag.AddExtension = true;
fdiag.Filter = String.Join("|", (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(this)).ToArray(typeof(string))); fdiag.Filter = String.Join("|", (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(null)).ToArray(typeof(string)));
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) { if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
string fileName = fdiag.FileName; string fileName = fdiag.FileName;
@ -190,6 +188,11 @@ namespace ICSharpCode.SharpDevelop.Commands
} }
} }
} }
public override void Run()
{
SaveAll();
}
} }
public class OpenFile : AbstractMenuCommand public class OpenFile : AbstractMenuCommand

27
src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyPad.cs

@ -90,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public class PropertyPad : AbstractPadContent, IHelpProvider public class PropertyPad : AbstractPadContent, IHelpProvider
{ {
static PropertyPad instance; static PropertyPad instance;
public static PropertyPad Instance { public static PropertyPad Instance {
get { get {
@ -119,6 +119,15 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
} }
static PropertyPad()
{
grid = new PropertyGrid();
grid.PropertyValueChanged += new PropertyValueChangedEventHandler(PropertyChanged);
grid.PropertySort = PropertyService.Get("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", false) ? PropertySort.Alphabetical : PropertySort.CategorizedAlphabetical;
grid.Dock = DockStyle.Fill;
}
public PropertyPad() public PropertyPad()
{ {
instance = this; instance = this;
@ -134,10 +143,6 @@ namespace ICSharpCode.SharpDevelop.Gui
comboBox.SelectedIndexChanged += new EventHandler(ComboBoxSelectedIndexChanged); comboBox.SelectedIndexChanged += new EventHandler(ComboBoxSelectedIndexChanged);
comboBox.Sorted = true; comboBox.Sorted = true;
grid = new PropertyGrid();
grid.PropertyValueChanged += new PropertyValueChangedEventHandler(PropertyChanged);
grid.PropertySort = PropertyService.Get("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", false) ? PropertySort.Alphabetical : PropertySort.CategorizedAlphabetical;
grid.Dock = DockStyle.Fill;
panel.Controls.Add(grid); panel.Controls.Add(grid);
panel.Controls.Add(comboBox); panel.Controls.Add(comboBox);
@ -260,14 +265,18 @@ namespace ICSharpCode.SharpDevelop.Gui
public static void SetDesignableObject(object obj) public static void SetDesignableObject(object obj)
{ {
grid.SelectedObject = obj; if (grid != null) {
SelectedObjectsChanged(); grid.SelectedObject = obj;
SelectedObjectsChanged();
}
} }
public static void SetDesignableObjects(object[] obj) public static void SetDesignableObjects(object[] obj)
{ {
grid.SelectedObjects = obj; if (grid != null) {
SelectedObjectsChanged(); grid.SelectedObjects = obj;
SelectedObjectsChanged();
}
} }
public static void RemoveHost(IDesignerHost host) public static void RemoveHost(IDesignerHost host)

7
src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

@ -97,7 +97,7 @@ namespace ICSharpCode.Core
} }
static bool doneParserThread = false; static bool doneParserThread = false;
static Hashtable lastUpdateSize = new Hashtable(); static Dictionary<string, int> lastUpdateSize = new Dictionary<string, int>();
static void ParserUpdateThread() static void ParserUpdateThread()
{ {
@ -126,7 +126,7 @@ namespace ICSharpCode.Core
if (text == null) { if (text == null) {
text = editable.Text; text = editable.Text;
} }
int hash = text.GetHashCode(); int hash = text.Length;
if (lastUpdateSize[fileName] == null || (int)lastUpdateSize[fileName] != hash) { if (lastUpdateSize[fileName] == null || (int)lastUpdateSize[fileName] != hash) {
parseInformation = ParseFile(fileName, text, !viewContent.IsUntitled, true); parseInformation = ParseFile(fileName, text, !viewContent.IsUntitled, true);
lastUpdateSize[fileName] = hash; lastUpdateSize[fileName] = hash;
@ -137,9 +137,6 @@ namespace ICSharpCode.Core
((IParseInformationListener)editable).ParseInformationUpdated(parseInformation); ((IParseInformationListener)editable).ParseInformationUpdated(parseInformation);
} }
} }
// if (fn != null) {
// ParseFile(fn); // TODO: this one should update file parsings requested through queue
// }
} }
} }
} }

Loading…
Cancel
Save