Browse Source

Merge trunk to 3.0wpf branch.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0wpf@3306 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
364087c791
  1. 11
      samples/XamlDesigner/TestFiles/3.xaml
  2. 4
      samples/XamlDesigner/XamlDesigner.csproj
  3. 9
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs
  4. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj
  5. 91
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/MarkupExtensionTests.cs
  6. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs
  7. 15
      src/AddIns/Misc/CodeCoverage/Project/Src/ShowDisplayOptionsDropDown.cs
  8. 50
      src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs
  9. 2
      src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/SpecificResourceReferenceFinder.cs
  10. 33
      src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/BclNRefactoryResourceResolver.cs
  11. 39
      src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/ResourceResolveResult.cs
  12. 28
      src/AddIns/Misc/ResourceToolkit/Test/CSharp/BclNRefactoryResourceResolverTests.cs
  13. 9
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowserToolbarCommands.cs
  14. 4
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs
  15. 14
      src/Main/Base/Test/NRefactoryResolverTests.cs
  16. 6
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs
  17. 14
      src/Setup/Files.wxs
  18. 5
      src/Setup/Setup.wxs

11
samples/XamlDesigner/TestFiles/3.xaml

@ -0,0 +1,11 @@
<Window xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Name="root"
Title="Hydralisk">
<Window.Resources>
<sys:String x:Key="r1">Title</sys:String>
<sys:String x:Key="r2">Width</sys:String>
</Window.Resources>
<TextBlock Text="{Binding Path={StaticResource r1}, ElementName=root}" />
</Window>

4
samples/XamlDesigner/XamlDesigner.csproj

@ -166,6 +166,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="TestFiles\3.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Generic.xaml"> <Page Include="Themes\Generic.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

9
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelProperty.cs

@ -96,9 +96,12 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
if (IsCollection) if (IsCollection)
throw new DesignerException("Cannot access Value for collection properties."); throw new DesignerException("Cannot access Value for collection properties.");
//TODO var xamlObject = _property.PropertyValue as XamlObject;
if (ValueOnInstance == null) return null; if (xamlObject != null) {
return _designItem.ComponentService.GetDesignItem(ValueOnInstance); return _designItem.ComponentService.GetDesignItem(xamlObject.Instance);
}
return null;
} }
} }

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj

@ -60,6 +60,7 @@
<Compile Include="XamlDom\ExampleClass.cs" /> <Compile Include="XamlDom\ExampleClass.cs" />
<Compile Include="XamlDom\ExampleClassContainer.cs" /> <Compile Include="XamlDom\ExampleClassContainer.cs" />
<Compile Include="XamlDom\ExampleService.cs" /> <Compile Include="XamlDom\ExampleService.cs" />
<Compile Include="XamlDom\MarkupExtensionTests.cs" />
<Compile Include="XamlDom\SamplesTests.cs" /> <Compile Include="XamlDom\SamplesTests.cs" />
<Compile Include="XamlDom\SimpleLoadTests.cs" /> <Compile Include="XamlDom\SimpleLoadTests.cs" />
<Compile Include="XamlDom\SystemTypesLoadTest.cs" /> <Compile Include="XamlDom\SystemTypesLoadTest.cs" />
@ -81,7 +82,5 @@
<Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project> <Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project>
<Name>WpfDesign.Designer</Name> <Name>WpfDesign.Designer</Name>
</ProjectReference> </ProjectReference>
<Folder Include="Designer" />
<Folder Include="XamlDom" />
</ItemGroup> </ItemGroup>
</Project> </Project>

91
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/MarkupExtensionTests.cs

@ -0,0 +1,91 @@
using System;
using NUnit.Framework;
using System.Windows.Markup;
namespace ICSharpCode.WpfDesign.Tests.XamlDom
{
[TestFixture]
public class MarkupExtensionTests : TestHelper
{
[Test]
public void Test1()
{
TestMarkupExtension("Title=\"{Binding}\"");
}
[Test]
public void Test2()
{
TestMarkupExtension("Title=\"{Binding Some}\"");
}
[Test]
public void Test3()
{
TestMarkupExtension("Title=\"{ Binding Some , ElementName = Some , Mode = TwoWay }\"");
}
[Test]
public void Test4()
{
TestMarkupExtension("Content=\"{x:Type Button}\"");
}
[Test]
public void Test5()
{
TestMarkupExtension("Content=\"{t:MyExtension 1, 2}\"");
}
[Test]
public void Test6()
{
TestMarkupExtension("Background=\"{x:Static SystemColors.ControlBrush}\"");
}
[Test]
public void Test7()
{
TestMarkupExtension("Background=\"{DynamicResource {x:Static SystemColors.ControlBrushKey}}\"");
}
[Test]
public void Test8()
{
TestMarkupExtension("Content=\"{Binding Some, RelativeSource={RelativeSource Self}}\"");
}
[Test]
[ExpectedException] // Must differ from official XamlReader result
public void Test9()
{
TestMarkupExtension("Content=\"{x:Static t:MyStaticClass.StaticString}\"");
}
static void TestMarkupExtension(string s)
{
TestLoading(@"<Window
xmlns=""http://schemas.microsoft.com/netfx/2007/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:t=""" + XamlTypeFinderTests.XamlDomTestsNamespace + @"""
" + s + @"/>");
}
}
public static class MyStaticClass
{
public static string StaticString = "a";
}
public class MyExtension : MarkupExtension
{
public MyExtension(object p1, object p2)
{
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return null;
}
}
}

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/MarkupExtensionParser.cs

@ -58,7 +58,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
while (pos < text.Length) { while (pos < text.Length) {
switch (text[pos]) { switch (text[pos]) {
case '}': case '}':
AddToken(MarkupExtensionTokenKind.CloseBrace, "{"); AddToken(MarkupExtensionTokenKind.CloseBrace, "}");
pos++; pos++;
break; break;
case '=': case '=':
@ -70,7 +70,9 @@ namespace ICSharpCode.WpfDesign.XamlDom
pos++; pos++;
break; break;
case '{': case '{':
throw new XamlMarkupExtensionParseException("'{' is invalid at this location"); AddToken(MarkupExtensionTokenKind.OpenBrace, "{");
pos++;
break;
default: default:
MembernameOrString(); MembernameOrString();
break; break;

15
src/AddIns/Misc/CodeCoverage/Project/Src/ShowDisplayOptionsDropDown.cs

@ -24,18 +24,7 @@ namespace ICSharpCode.CodeCoverage
{ {
base.OnOwnerChanged(e); base.OnOwnerChanged(e);
dropDownButton = (ToolBarDropDownButton)Owner; dropDownButton = (ToolBarDropDownButton)Owner;
GenerateDropDownItems(); MenuService.AddItemsToMenu(dropDownButton.DropDownItems, this, "/SharpDevelop/Pads/CodeCoveragePad/Toolbar/CodeCoveragePadDisplayOptions");
} }
void GenerateDropDownItems()
{
ToolStripItem[] items = (ToolStripItem[])(AddInTree.GetTreeNode("/SharpDevelop/Pads/CodeCoveragePad/Toolbar/CodeCoveragePadDisplayOptions").BuildChildItems(this)).ToArray(typeof(ToolStripItem));
foreach (ToolStripItem item in items) {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
}
}
dropDownButton.DropDownItems.AddRange(items);
}
} }
} }

50
src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/ResourceRefactoringService.cs

@ -109,26 +109,32 @@ namespace Hornung.ResourceToolkit.Refactoring
TextLocation docPos = doc.OffsetToPosition(pos); TextLocation docPos = doc.OffsetToPosition(pos);
ResourceResolveResult rrr = ResourceResolverService.Resolve(fileName, doc, docPos.Y, docPos.X, null); ResourceResolveResult rrr = ResourceResolverService.Resolve(fileName, doc, docPos.Y, docPos.X, null);
if (rrr != null && rrr.ResourceFileContent != null && rrr.Key != null) { if (rrr != null && rrr.ResourceFileContent != null) {
if (finder.IsReferenceToResource(rrr)) { if (finder.IsReferenceToResource(rrr)) {
// The actual location of the key string may be after 'pos' because if (rrr.Key != null) {
// the resolvers may find an expression just before it.
string keyString = rrr.Key; // The actual location of the key string may be after 'pos' because
int keyPos = fileContent.IndexOf(keyString, pos, StringComparison.InvariantCultureIgnoreCase); // the resolvers may find an expression just before it.
string keyString = rrr.Key;
if (keyPos < pos) { int keyPos = fileContent.IndexOf(keyString, pos, StringComparison.InvariantCultureIgnoreCase);
// The key may be escaped in some way in the document.
// Try using the code generator to find this out. if (keyPos < pos) {
keyPos = FindStringLiteral(fileName, fileContent, rrr.Key, pos, out keyString); // The key may be escaped in some way in the document.
} // Try using the code generator to find this out.
keyPos = FindStringLiteral(fileName, fileContent, rrr.Key, pos, out keyString);
if (keyPos < pos) { }
if (monitor != null) monitor.ShowingDialog = true;
MessageService.ShowWarning("ResourceToolkit: The key '"+rrr.Key+"' could not be located at the resolved position in the file '"+fileName+"'."); if (keyPos < pos) {
if (monitor != null) monitor.ShowingDialog = false; if (monitor != null) monitor.ShowingDialog = true;
MessageService.ShowWarning("ResourceToolkit: The key '"+rrr.Key+"' could not be located at the resolved position in the file '"+fileName+"'.");
if (monitor != null) monitor.ShowingDialog = false;
} else {
references.Add(new Reference(fileName, keyPos, keyString.Length, keyString, rrr));
}
} else { } else {
references.Add(new Reference(fileName, keyPos, keyString.Length, keyString, rrr)); references.Add(new Reference(fileName, pos, 0, null, rrr));
} }
} }
@ -216,15 +222,22 @@ namespace Hornung.ResourceToolkit.Refactoring
// Generate a dictonary of resource file names and the // Generate a dictonary of resource file names and the
// corresponding referenced keys. // corresponding referenced keys.
Dictionary<string, List<string>> referencedKeys = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> referencedKeys = new Dictionary<string, List<string>>();
Dictionary<string, List<string>> referencedPrefixes = new Dictionary<string, List<string>>();
foreach (Reference reference in references) { foreach (Reference reference in references) {
ResourceResolveResult rrr = (ResourceResolveResult)reference.ResolveResult; ResourceResolveResult rrr = (ResourceResolveResult)reference.ResolveResult;
if (rrr.ResourceFileContent != null) { if (rrr.ResourceFileContent != null) {
string fileName = rrr.FileName; string fileName = rrr.FileName;
if (!referencedKeys.ContainsKey(fileName)) { if (!referencedKeys.ContainsKey(fileName)) {
referencedKeys.Add(fileName, new List<string>()); referencedKeys.Add(fileName, new List<string>());
referencedPrefixes.Add(fileName, new List<string>());
} }
if (rrr.Key != null && !referencedKeys[fileName].Contains(rrr.Key)) { if (rrr.Key != null && !referencedKeys[fileName].Contains(rrr.Key)) {
referencedKeys[fileName].Add(rrr.Key); referencedKeys[fileName].Add(rrr.Key);
} else {
ResourcePrefixResolveResult rprr = rrr as ResourcePrefixResolveResult;
if (rprr != null && rprr.Prefix != null && !referencedPrefixes[fileName].Contains(rprr.Prefix)) {
referencedPrefixes[fileName].Add(rprr.Prefix);
}
} }
} else { } else {
if (monitor != null) monitor.ShowingDialog = true; if (monitor != null) monitor.ShowingDialog = true;
@ -239,7 +252,8 @@ namespace Hornung.ResourceToolkit.Refactoring
LoggingService.Debug("ResourceToolkit: FindUnusedKeys: Referenced resource file '"+fileName+"'"); LoggingService.Debug("ResourceToolkit: FindUnusedKeys: Referenced resource file '"+fileName+"'");
#endif #endif
foreach (KeyValuePair<string, object> entry in ResourceFileContentRegistry.GetResourceFileContent(fileName).Data) { foreach (KeyValuePair<string, object> entry in ResourceFileContentRegistry.GetResourceFileContent(fileName).Data) {
if (!referencedKeys[fileName].Contains(entry.Key)) { if (!referencedKeys[fileName].Contains(entry.Key) &&
!referencedPrefixes[fileName].Any(prefix => entry.Key.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase))) {
unused.Add(new ResourceItem(fileName, entry.Key)); unused.Add(new ResourceItem(fileName, entry.Key));
} }
} }

2
src/AddIns/Misc/ResourceToolkit/Project/Src/Refactoring/SpecificResourceReferenceFinder.cs

@ -65,7 +65,7 @@ namespace Hornung.ResourceToolkit.Refactoring
public bool IsReferenceToResource(ResourceResolveResult result) public bool IsReferenceToResource(ResourceResolveResult result)
{ {
return FileUtility.IsEqualFileName(this.ResourceFileName, result.FileName) && return FileUtility.IsEqualFileName(this.ResourceFileName, result.FileName) &&
result.Key.Equals(this.Key, StringComparison.InvariantCultureIgnoreCase); this.Key.Equals(result.Key, StringComparison.InvariantCultureIgnoreCase);
} }
// ******************************************************************************************************************************** // ********************************************************************************************************************************

33
src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/BclNRefactoryResourceResolver.cs

@ -45,6 +45,7 @@ namespace Hornung.ResourceToolkit.Resolver
* *
* Something.GetString( * Something.GetString(
* Something.GetString("...") * Something.GetString("...")
* Something.ApplyResources(obj, "...")
* Something[ * Something[
* Something["..."] * Something["..."]
* *
@ -65,7 +66,7 @@ namespace Hornung.ResourceToolkit.Resolver
MethodGroupResolveResult methrr = resolveResult as MethodGroupResolveResult; MethodGroupResolveResult methrr = resolveResult as MethodGroupResolveResult;
if (methrr != null) { if (methrr != null) {
if ((methrr.Name == "GetString" || methrr.Name == "GetObject" || methrr.Name == "GetStream") && if ((methrr.Name == "GetString" || methrr.Name == "GetObject" || methrr.Name == "GetStream" || methrr.Name == "ApplyResources") &&
(resolveResult = NRefactoryAstCacheService.ResolveNextOuterExpression(ref expressionResult, caretLine, caretColumn, fileName, fileContent, expressionFinder)) != null) { (resolveResult = NRefactoryAstCacheService.ResolveNextOuterExpression(ref expressionResult, caretLine, caretColumn, fileName, fileContent, expressionFinder)) != null) {
return ResolveResource(resolveResult, expr); return ResolveResource(resolveResult, expr);
@ -98,7 +99,7 @@ namespace Hornung.ResourceToolkit.Resolver
if (mrr != null) { if (mrr != null) {
if (mrr.ResolvedMember is IMethod && if (mrr.ResolvedMember is IMethod &&
(mrr.ResolvedMember.Name == "GetString" || mrr.ResolvedMember.Name == "GetObject" || mrr.ResolvedMember.Name == "GetStream")) { (mrr.ResolvedMember.Name == "GetString" || mrr.ResolvedMember.Name == "GetObject" || mrr.ResolvedMember.Name == "GetStream" || mrr.ResolvedMember.Name == "ApplyResources")) {
// Something.GetString("...") // Something.GetString("...")
// This is a MemberResolveResult and we need the reference to "Something". // This is a MemberResolveResult and we need the reference to "Something".
@ -216,10 +217,14 @@ namespace Hornung.ResourceToolkit.Resolver
} }
if (rsr != null) { if (rsr != null) {
string key = GetKeyFromExpression(expr); bool isPrefixOnly;
string key = GetKeyFromExpression(expr, out isPrefixOnly);
// TODO: Add information about return type (of the resource, if present). if (isPrefixOnly) {
return new ResourceResolveResult(resolveResult.CallingClass, resolveResult.CallingMember, null, rsr, key); return new ResourcePrefixResolveResult(resolveResult.CallingClass, resolveResult.CallingMember, null, rsr, key);
} else {
return new ResourceResolveResult(resolveResult.CallingClass, resolveResult.CallingMember, null, rsr, key);
}
} }
return null; return null;
@ -683,8 +688,9 @@ namespace Hornung.ResourceToolkit.Resolver
/// <summary> /// <summary>
/// Tries to infer the resource key being referenced from the given expression. /// Tries to infer the resource key being referenced from the given expression.
/// </summary> /// </summary>
static string GetKeyFromExpression(Expression expr) static string GetKeyFromExpression(Expression expr, out bool isPrefixOnly)
{ {
isPrefixOnly = false;
#if DEBUG #if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver trying to get key from expression: "+expr.ToString()); LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver trying to get key from expression: "+expr.ToString());
#endif #endif
@ -722,6 +728,20 @@ namespace Hornung.ResourceToolkit.Resolver
} }
} }
} }
} else if (fre.MemberName == "ApplyResources") {
if (invocation.Arguments.Count >= 2) {
PrimitiveExpression p = invocation.Arguments[1] as PrimitiveExpression;
if (p != null) {
string key = p.Value as string;
if (key != null) {
#if DEBUG
LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found key prefix: "+key);
#endif
isPrefixOnly = true;
return key;
}
}
}
} }
} }
} }
@ -743,6 +763,7 @@ namespace Hornung.ResourceToolkit.Resolver
"GetString", "GetString",
"GetObject", "GetObject",
"GetStream", "GetStream",
"ApplyResources",
(NRefactoryResourceResolver.GetLanguagePropertiesForFile(fileName) ?? LanguageProperties.None).IndexerExpressionStartToken (NRefactoryResourceResolver.GetLanguagePropertiesForFile(fileName) ?? LanguageProperties.None).IndexerExpressionStartToken
}; };
} }

39
src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/ResourceResolveResult.cs

@ -17,8 +17,8 @@ namespace Hornung.ResourceToolkit.Resolver
public class ResourceResolveResult : ResolveResult public class ResourceResolveResult : ResolveResult
{ {
ResourceSetReference resourceSetReference; readonly ResourceSetReference resourceSetReference;
string key; readonly string key;
/// <summary> /// <summary>
/// Gets the <see cref="ResourceSetReference"/> that describes the resource set being referenced. /// Gets the <see cref="ResourceSetReference"/> that describes the resource set being referenced.
@ -44,7 +44,7 @@ namespace Hornung.ResourceToolkit.Resolver
/// <summary> /// <summary>
/// Gets the resource key being referenced. May be null if the key is unknown/not yet typed. /// Gets the resource key being referenced. May be null if the key is unknown/not yet typed.
/// </summary> /// </summary>
public string Key { public virtual string Key {
get { return this.key; } get { return this.key; }
} }
@ -90,4 +90,37 @@ namespace Hornung.ResourceToolkit.Resolver
this.ResourceSetReference, this.Key); this.ResourceSetReference, this.Key);
} }
} }
/// <summary>
/// Describes a reference to a group of resource keys with a common prefix.
/// </summary>
public sealed class ResourcePrefixResolveResult : ResourceResolveResult
{
/// <summary>
/// Initializes a new instance of the <see cref="ResourceResolveResult"/> class.
/// </summary>
/// <param name="callingClass">The class that contains the reference to the resource.</param>
/// <param name="callingMember">The member that contains the reference to the resource.</param>
/// <param name="returnType">The type of the resource being referenced.</param>
/// <param name="resourceSetReference">The <see cref="ResourceSetReference"/> that describes the resource set being referenced.</param>
/// <param name="prefix">The prefix of the resource keys being referenced.</param>
public ResourcePrefixResolveResult(IClass callingClass, IMember callingMember, IReturnType returnType, ResourceSetReference resourceSetReference, string prefix)
: base(callingClass, callingMember, returnType, resourceSetReference, prefix)
{
}
public override string Key {
get { return null; }
}
public string Prefix {
get { return base.Key; }
}
public override ResolveResult Clone()
{
return new ResourcePrefixResolveResult(this.CallingClass, this.CallingMember, this.ResolvedType,
this.ResourceSetReference, this.Prefix);
}
}
} }

28
src/AddIns/Misc/ResourceToolkit/Test/CSharp/BclNRefactoryResourceResolverTests.cs

@ -11,6 +11,7 @@ using System.Collections.Generic;
using Hornung.ResourceToolkit; using Hornung.ResourceToolkit;
using Hornung.ResourceToolkit.Resolver; using Hornung.ResourceToolkit.Resolver;
using NUnit.Framework; using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
namespace ResourceToolkit.Tests.CSharp namespace ResourceToolkit.Tests.CSharp
{ {
@ -262,6 +263,30 @@ class A
TestHelper.CheckReference(rrr, "Test.TestResources", "TestKey", "A", "A.B"); TestHelper.CheckReference(rrr, "Test.TestResources", "TestKey", "A", "A.B");
} }
// ********************************************************************************************************************************
const string CodeLocalCRMDeferredInitUsingApplyResources = @"using System.ComponentModel;
class A
{
void B()
{
ComponentResourceManager mgr;
mgr = new ComponentResourceManager(typeof(A));
mgr.ApplyResources(this, ""$this"");
}
}
";
[Test]
public void LocalCRMDeferredInitUsingApplyResources()
{
ResourceResolveResult rrr = Resolve(CodeLocalCRMDeferredInitUsingApplyResources, 8, 20, null);
TestHelper.CheckReference(rrr, "A", null, "A", "A.B");
Assert.That(rrr, Is.InstanceOfType(typeof(ResourcePrefixResolveResult)));
ResourcePrefixResolveResult rprr = (ResourcePrefixResolveResult)rrr;
Assert.That(rprr.Prefix, Is.EqualTo("$this"), "Resource key prefix not detected correctly.");
}
#endregion #endregion
// ******************************************************************************************************************************** // ********************************************************************************************************************************
@ -755,8 +780,9 @@ namespace Test {
Assert.Contains("GetString", patterns); Assert.Contains("GetString", patterns);
Assert.Contains("GetStream", patterns); Assert.Contains("GetStream", patterns);
Assert.Contains("GetObject", patterns); Assert.Contains("GetObject", patterns);
Assert.Contains("ApplyResources", patterns);
Assert.Contains("[", patterns); Assert.Contains("[", patterns);
Assert.AreEqual(4, patterns.Count, "Incorrect number of resource access patterns for C# files."); Assert.AreEqual(5, patterns.Count, "Incorrect number of resource access patterns for C# files.");
} }
[Test] [Test]

9
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowserToolbarCommands.cs

@ -51,14 +51,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
{ {
base.OnOwnerChanged(e); base.OnOwnerChanged(e);
dropDownButton = (ToolBarDropDownButton)Owner; dropDownButton = (ToolBarDropDownButton)Owner;
ToolStripItem[] items = (ToolStripItem[])(AddInTree.GetTreeNode("/SharpDevelop/Pads/ClassBrowser/Toolbar/SelectFilter").BuildChildItems(this)).ToArray(typeof(ToolStripItem)); MenuService.AddItemsToMenu(dropDownButton.DropDownItems, this, "/SharpDevelop/Pads/ClassBrowser/Toolbar/SelectFilter");
foreach (ToolStripItem item in items) {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
}
}
dropDownButton.DropDownItems.AddRange(items);
} }
} }

4
src/Main/Base/Project/Src/TextEditor/Gui/Editor/QuickClassBrowserPanel.cs

@ -454,7 +454,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (autoselect) { if (autoselect) {
ComboBoxItem item = (ComboBoxItem)comboBox.Items[comboBox.SelectedIndex]; ComboBoxItem item = (ComboBoxItem)comboBox.Items[comboBox.SelectedIndex];
if (item.IsInCurrentPart) { if (item.IsInCurrentPart) {
textAreaControl.ActiveTextAreaControl.Caret.Position = new TextLocation(item.Column, item.Line); textAreaControl.ActiveTextAreaControl.CenterViewOn(
item.Line, (int)(0.3 * textAreaControl.ActiveTextAreaControl.TextArea.TextView.VisibleLineCount));
textAreaControl.ActiveTextAreaControl.JumpTo(item.Line, item.Column);
textAreaControl.ActiveTextAreaControl.TextArea.Focus(); textAreaControl.ActiveTextAreaControl.TextArea.Focus();
} else { } else {
IMember m = item.Item as IMember; IMember m = item.Item as IMember;

14
src/Main/Base/Test/NRefactoryResolverTests.cs

@ -267,6 +267,20 @@ interface IInterface2 {
Assert.AreEqual("StringBuilder", result.Identifier); Assert.AreEqual("StringBuilder", result.Identifier);
} }
[Test]
public void UnknownTypeTest()
{
string program = @"class A {
void Method() {
}
}
";
UnknownIdentifierResolveResult result = Resolve<UnknownIdentifierResolveResult>(program, "StringBuilder", 3, 1, ExpressionContext.Type);
Assert.IsFalse(result.IsValid);
Assert.AreEqual("StringBuilder", result.Identifier);
}
[Test] [Test]
public void InvalidMethodCallTest() public void InvalidMethodCallTest()
{ {

6
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs

@ -612,7 +612,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
return new NamespaceResolveResult(resolver.CallingClass, resolver.CallingMember, name); return new NamespaceResolveResult(resolver.CallingClass, resolver.CallingMember, name);
} }
} }
return rr; if (rr != null) {
return rr;
} else {
return new UnknownIdentifierResolveResult(resolver.CallingClass, resolver.CallingMember, reference.Type);
}
} }
public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)

14
src/Setup/Files.wxs

@ -1523,6 +1523,20 @@
<File Source="..\..\AddIns\AddIns\Misc\ReflectorAddIn\ReflectorAddIn.addin" Name="ReflectorAddIn.addin" Id="ReflectorAddIn.addin" /> <File Source="..\..\AddIns\AddIns\Misc\ReflectorAddIn\ReflectorAddIn.addin" Name="ReflectorAddIn.addin" Id="ReflectorAddIn.addin" />
</Component> </Component>
</Directory> </Directory>
<Directory Id="SourceAnalysis" Name="SourceAnalysis">
<Component Guid="63031C9E-F23C-4539-A7DF-97AFAC0A21C0" Id="SettingsSourceAnalysis" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SourceAnalysis\Settings.SourceAnalysis" Name="Settings.SourceAnalysis" Id="Settings.SourceAnalysis" KeyPath="yes" />
</Component>
<Component Guid="C9D099BC-CF4D-404A-BB2F-B13D4541DA0F" Id="SharpDevelopSourceAnalysisTargets" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SourceAnalysis\SharpDevelop.SourceAnalysis.targets" Name="SharpDevelop.SourceAnalysis.targets" Id="SharpDevelop.SourceAnalysis.targets" KeyPath="yes" />
</Component>
<Component Guid="4E61BF16-0C2E-424A-8D1B-80F89B3F456B" Id="SourceAnalysisAddin" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SourceAnalysis\SourceAnalysis.addin" Name="SourceAnalysis.addin" Id="SourceAnalysis.addin" KeyPath="yes" />
</Component>
<Component Guid="C4A33C3E-91B6-4984-86B1-07C5C49C180D" Id="SourceAnalysisDll" DiskId="1">
<File Source="..\..\AddIns\AddIns\Misc\SourceAnalysis\SourceAnalysis.dll" Name="SourceAnalysis.dll" Id="SourceAnalysis.dll" KeyPath="yes" Assembly=".net" AssemblyApplication="SourceAnalysis.dll" AssemblyManifest="SourceAnalysis.dll" />
</Component>
</Directory>
</Directory> </Directory>
</Directory> </Directory>
</Directory> </Directory>

5
src/Setup/Setup.wxs

@ -437,6 +437,11 @@
<ComponentRef Id="ReflectorAddInDll"/> <ComponentRef Id="ReflectorAddInDll"/>
<ComponentRef Id="ReflectorAddInIpcServerDll"/> <ComponentRef Id="ReflectorAddInIpcServerDll"/>
<ComponentRef Id="ReflectorAddInIpcServerAddInDll"/> <ComponentRef Id="ReflectorAddInIpcServerAddInDll"/>
<ComponentRef Id="SettingsSourceAnalysis"/>
<ComponentRef Id="SharpDevelopSourceAnalysisTargets"/>
<ComponentRef Id="SourceAnalysisAddin"/>
<ComponentRef Id="SourceAnalysisDll"/>
</Feature> </Feature>
<Feature Id="SharpDevelopFileAssociations" <Feature Id="SharpDevelopFileAssociations"
Level="2" Level="2"

Loading…
Cancel
Save