Browse Source

Merge remote-tracking branch 'origin/4.x' into master.

pull/403/head
Daniel Grunwald 12 years ago
parent
commit
ef9d5a66f5
  1. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj
  2. 43
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs
  3. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml
  4. 15
      src/Main/Base/Project/Editor/CodeCompletion/CodeCompletionDataUsageCache.cs
  5. 10
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationPicker.cs

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj

@ -88,6 +88,7 @@ @@ -88,6 +88,7 @@
<Compile Include="Editing\TextSegmentReadOnlySectionTests.cs" />
<Compile Include="Highlighting\HighlightedLineMergeTests.cs" />
<Compile Include="Highlighting\HtmlClipboardTests.cs" />
<Compile Include="MultipleUIThreads.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Document\CollapsingTests.cs" />
<Compile Include="Document\HeightTests.cs" />

43
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/MultipleUIThreads.cs

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Threading;
using System.Windows;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit
{
[TestFixture]
public class MultipleUIThreads
{
Exception error;
[Test]
public void CreateEditorInstancesOnMultipleUIThreads()
{
Thread t1 = new Thread(new ThreadStart(Run));
Thread t2 = new Thread(new ThreadStart(Run));
t1.SetApartmentState(ApartmentState.STA);
t2.SetApartmentState(ApartmentState.STA);
t1.Start();
t2.Start();
t1.Join();
t2.Join();
if (error != null)
throw new InvalidOperationException(error.Message, error);
}
[STAThread]
void Run()
{
try {
var window = new Window();
window.Content = new TextEditor();
window.Show();
} catch (Exception ex) {
error = ex;
}
}
}
}

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
</Setter>
</Style>
<Style TargetType="{x:Type editing:TextArea}">
<Style TargetType="{x:Type editing:TextArea}" x:Shared="False">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="SelectionBrush">
<Setter.Value>

15
src/Main/Base/Project/Editor/CodeCompletion/CodeCompletionDataUsageCache.cs

@ -110,13 +110,18 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion @@ -110,13 +110,18 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion
if (dict == null || string.IsNullOrEmpty(cacheFileName)) {
return;
}
int count;
using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
using (BinaryWriter writer = new BinaryWriter(fs)) {
count = SaveCache(writer);
try {
int count;
using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
using (BinaryWriter writer = new BinaryWriter(fs)) {
count = SaveCache(writer);
}
}
LoggingService.Info("Saved CodeCompletionDataUsageCache (" + count + " of " + dict.Count + " items)");
} catch (IOException ex) {
// e.g. cannot open file for write because two SD instances are shutting down simultanously
LoggingService.Warn("Error saving CC cache", ex);
}
LoggingService.Info("Saved CodeCompletionDataUsageCache (" + count + " of " + dict.Count + " items)");
}
static int SaveCache(BinaryWriter writer)

10
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationPicker.cs

@ -94,7 +94,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -94,7 +94,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
static object CoerceLocation(DependencyObject d, object baseValue)
{
PropertyStorageLocations location = (PropertyStorageLocations)baseValue;
return CoerceLocation((PropertyStorageLocations)baseValue);
}
static PropertyStorageLocations CoerceLocation(PropertyStorageLocations location)
{
if ((location & PropertyStorageLocations.ConfigurationAndPlatformSpecific) != 0) {
// remove 'Base' flag if any of the specific flags is set
location &= ~PropertyStorageLocations.Base;
@ -147,9 +151,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -147,9 +151,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
item.SetValueToExtension(MenuItem.HeaderProperty, new StringParseExtension(text));
item.Click += delegate(object sender, RoutedEventArgs e) {
if ((this.Location & location) == 0) {
this.Location |= location;
SetCurrentValue(LocationProperty, CoerceLocation(this.Location | location));
} else {
this.Location &= ~location;
SetCurrentValue(LocationProperty, CoerceLocation(this.Location & ~location));
}
e.Handled = true;
};

Loading…
Cancel
Save