Browse Source

FileChangeWatcher: use HashSet instead of Set, we don't want to sort

TaskView: split up long words in tooltip (e.g. long generic type names in compiler errors), they cause bad Windows Forms performance

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2999 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
bff7f206c0
  1. 21
      src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs
  2. 2
      src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs
  3. 6
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IFreezable.cs
  4. 2
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

21
src/Main/Base/Project/Src/Gui/Pads/TaskList/TaskView.cs

@ -191,6 +191,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -191,6 +191,7 @@ namespace ICSharpCode.SharpDevelop.Gui
string description = task.Description;
if (description != null) {
description = description.Replace("\t", " ");
description = FixDescriptionForTooltip(description, 200);
}
taskToolTip.SetToolTip(this, description);
taskToolTip.Active = true;
@ -202,6 +203,26 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -202,6 +203,26 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
// when there is a very long word (e.g. huge generic type), Windows.Forms hangs when showing the tooltip,
// so we need to separate the words
static string FixDescriptionForTooltip(string description, int spaceEvery)
{
StringBuilder b = new StringBuilder(description.Length);
int i = 0;
foreach (char c in description) {
b.Append(c);
if (char.IsWhiteSpace(c)) {
i = 0;
} else {
if (++i == spaceEvery) {
b.Append(' ');
i = 0;
}
}
}
return b.ToString();
}
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x007B) { // handle WM_CONTEXTMENU

2
src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs

@ -39,7 +39,7 @@ namespace ICSharpCode.SharpDevelop @@ -39,7 +39,7 @@ namespace ICSharpCode.SharpDevelop
}
}
static Set<FileChangeWatcher> activeWatchers = new Set<FileChangeWatcher>();
static HashSet<FileChangeWatcher> activeWatchers = new HashSet<FileChangeWatcher>();
FileSystemWatcher watcher;
bool wasChangedExternally = false;

6
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IFreezable.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Dom
throw new InvalidOperationException("Cannot mutate frozen " + GetType().Name);
}
protected IList<T> FreezeList<T>(IList<T> list) where T : IFreezable
protected static IList<T> FreezeList<T>(IList<T> list) where T : IFreezable
{
if (list == null || list.Count == 0)
return EmptyList<T>.Instance;
@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return list;
}
protected IList<IReturnType> FreezeList(IList<IReturnType> list)
protected static IList<IReturnType> FreezeList(IList<IReturnType> list)
{
if (list == null || list.Count == 0)
return EmptyList<IReturnType>.Instance;
@ -90,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -90,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return new System.Collections.ObjectModel.ReadOnlyCollection<IReturnType>(list.ToArray());
}
protected IList<string> FreezeList(IList<string> list)
protected static IList<string> FreezeList(IList<string> list)
{
if (list == null || list.Count == 0)
return EmptyList<string>.Instance;

2
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

@ -223,6 +223,8 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -223,6 +223,8 @@ namespace ICSharpCode.SharpDevelop.Dom
resultIsAcceptable = false;
if (methods.Count == 0)
return null;
// RankOverloads may change methods (substitution of generic types), but those changes should not
// be visible to the FindOverload caller, so we clone the method array.
methods = methods.ToArray();
int[] ranking = RankOverloads(methods, arguments, false, out resultIsAcceptable);
int bestRanking = -1;

Loading…
Cancel
Save