Browse Source

Merged Corsavy r1387:1425 to trunk.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1428 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
ae949853b4
  1. 2
      AddIns/ICSharpCode.SharpDevelop.addin
  2. BIN
      data/resources/StringResources.cz.resources
  3. BIN
      data/resources/StringResources.fr.resources
  4. BIN
      data/resources/StringResources.hu.resources
  5. BIN
      data/resources/StringResources.it.resources
  6. BIN
      data/resources/StringResources.kr.resources
  7. BIN
      data/resources/StringResources.nl.resources
  8. BIN
      data/resources/StringResources.no.resources
  9. BIN
      data/resources/StringResources.pl.resources
  10. BIN
      data/resources/StringResources.pt-br.resources
  11. BIN
      data/resources/StringResources.ro.resources
  12. BIN
      data/resources/StringResources.se.resources
  13. BIN
      data/resources/StringResources.tr.resources
  14. 10
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs
  15. 31
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs
  16. 9
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs
  17. 37
      src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs
  18. 6
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs
  19. 9
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs
  20. 14
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin
  21. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj
  22. 37
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/DebuggerTreeListView.cs
  23. 61
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  24. 47
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/TreeListViewDebuggerItem.cs
  25. 31
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs
  26. 9
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  27. 43
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  28. 77
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs
  29. 21
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  30. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  31. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PropertyVariable.cs
  32. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs
  33. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs
  34. 10
      src/AddIns/Misc/FiletypeRegisterer/Project/Src/RegisterFiletypesCommand.cs
  35. 2
      src/Libraries/ICSharpCode.Build.Tasks/Project/MonoToolLocationHelper.cs
  36. 5
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs
  37. 10
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/Span.cs
  38. 22
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineSegment.cs
  39. 174
      src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs
  40. 25
      src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs
  41. 12
      src/Libraries/NRefactory/Project/Src/Parser/AST/Enums.cs
  42. 2074
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  43. 10
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  44. 1583
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  45. 7
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  46. 21
      src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs
  47. 21
      src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
  48. 8
      src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs
  49. 2
      src/Main/Base/Project/Src/Commands/FileCommands.cs
  50. 2
      src/Main/Base/Project/Src/Commands/MenuItemBuilders.cs
  51. 6
      src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs
  52. 46
      src/Main/Base/Project/Src/Dom/ModifierEnum.cs
  53. 2
      src/Main/Base/Project/Src/Gui/Pads/DefinitionViewPad.cs
  54. 16
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
  55. 4
      src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs
  56. 6
      src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs
  57. 2
      src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs
  58. 2
      src/Main/Base/Project/Src/Project/Items/ProjectItem.cs
  59. 7
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  60. 4
      src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs
  61. 3
      src/Main/Base/Project/Src/Services/ParserService/ParserService.cs
  62. 9
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  63. 3
      src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs
  64. 50
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
  65. 4
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/SearchResult.cs
  66. 19
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/WildcardSearchStrategy.cs
  67. 2
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs
  68. 3
      src/Main/Base/Test/MemberLookupHelperTests.cs
  69. 5
      src/Main/Base/Test/NRefactoryResolverTests.cs
  70. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

2
AddIns/ICSharpCode.SharpDevelop.addin

@ -1437,7 +1437,7 @@ @@ -1437,7 +1437,7 @@
<MenuItem id = "ToggleBreakpointSeparator" type = "Separator" />
<MenuItem id = "Toggle Breakpoint"
label = "Toggle Breakpoint"
label = "${res:XML.MainMenu.DebugMenu.ToggleBreakpoint}"
shortcut = "F7"
class = "ICSharpCode.SharpDevelop.Project.Commands.ToggleBreakpointCommand"/>
</ComplexCondition>

BIN
data/resources/StringResources.cz.resources

Binary file not shown.

BIN
data/resources/StringResources.fr.resources

Binary file not shown.

BIN
data/resources/StringResources.hu.resources

Binary file not shown.

BIN
data/resources/StringResources.it.resources

Binary file not shown.

BIN
data/resources/StringResources.kr.resources

Binary file not shown.

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

BIN
data/resources/StringResources.no.resources

Binary file not shown.

BIN
data/resources/StringResources.pl.resources

Binary file not shown.

BIN
data/resources/StringResources.pt-br.resources

Binary file not shown.

BIN
data/resources/StringResources.ro.resources

Binary file not shown.

BIN
data/resources/StringResources.se.resources

Binary file not shown.

BIN
data/resources/StringResources.tr.resources

Binary file not shown.

10
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs

@ -100,6 +100,14 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -100,6 +100,14 @@ namespace Grunwald.BooBinding.CodeCompletion
callingMember = ResolveCurrentMember(olderClass);
}
}
if (callingMember != null) {
if (caretLine > callingMember.BodyRegion.EndLine) {
this.caretLine = callingMember.BodyRegion.EndLine;
this.caretColumn = callingMember.BodyRegion.EndColumn - 1;
} else if (caretLine == callingMember.BodyRegion.EndLine && caretColumn >= callingMember.BodyRegion.EndColumn) {
this.caretColumn = callingMember.BodyRegion.EndColumn - 1;
}
}
return true;
}
@ -194,7 +202,7 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -194,7 +202,7 @@ namespace Grunwald.BooBinding.CodeCompletion
return new NamespaceResolveResult(callingClass, callingMember, "");
}
ResolveResult rr = NRResolver.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, caretLine, caretColumn, expressionResult.Expression);
ResolveResult rr = NRResolver.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, this.caretLine, this.caretColumn, expressionResult.Expression);
if (rr != null) return rr;
AST.Expression expr;

31
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/InferredReturnType.cs

@ -43,7 +43,7 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -43,7 +43,7 @@ namespace Grunwald.BooBinding.CodeCompletion
get {
// clear up references to method/expression after the type has been resolved
if (block != null) {
GetReturnTypeVisitor v = new GetReturnTypeVisitor(context);
GetReturnTypeVisitor v = new GetReturnTypeVisitor(this);
Block b = block;
block = null; // reset block before calling Visit to prevent StackOverflow
v.Visit(b);
@ -70,9 +70,11 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -70,9 +70,11 @@ namespace Grunwald.BooBinding.CodeCompletion
class GetReturnTypeVisitor : DepthFirstVisitor
{
IClass context;
public GetReturnTypeVisitor(IClass context)
InferredReturnType parentReturnType;
public GetReturnTypeVisitor(InferredReturnType parentReturnType)
{
this.context = context;
this.context = parentReturnType.context;
this.parentReturnType = parentReturnType;
}
public IReturnType result;
@ -98,8 +100,27 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -98,8 +100,27 @@ namespace Grunwald.BooBinding.CodeCompletion
public override void OnYieldStatement(YieldStatement node)
{
noReturnStatement = false;
IClass enumerable = ProjectContentRegistry.Mscorlib.GetClass("System.Collections.Generic.IEnumerable", 1);
result = new ConstructedReturnType(enumerable.DefaultReturnType, new IReturnType[] { new InferredReturnType(node.Expression, context) });
IProjectContent pc = context != null ? context.ProjectContent : ParserService.CurrentProjectContent;
IReturnType enumerable = new GetClassReturnType(pc, "System.Collections.Generic.IEnumerable", 1);
// Prevent creating an infinite number of InferredReturnTypes in inferring cycles
parentReturnType.expression = new NullLiteralExpression();
IReturnType returnType;
if (node.Expression == null)
returnType = ConvertVisitor.GetDefaultReturnType(pc);
else
returnType = new BooResolver().GetTypeOfExpression(node.Expression, context);
if (returnType != null) {
returnType.GetUnderlyingClass(); // force to infer type
}
if (parentReturnType.expression == null) {
// inferrence cycle with parentReturnType
returnType = new GetClassReturnType(pc, "?", 0);
}
parentReturnType.expression = null;
result = new ConstructedReturnType(enumerable, new IReturnType[] { returnType });
}
public override void OnCallableBlockExpression(CallableBlockExpression node)

9
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs

@ -83,6 +83,13 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -83,6 +83,13 @@ namespace Grunwald.BooBinding.CodeCompletion
void MakeMethodResult(IReturnType type, string methodName)
{
resolveResult = new MethodResolveResult(callingClass, resolver.CallingMember, type, methodName);
IMethod m = (resolveResult as MethodResolveResult).GetMethodIfSingleOverload();
if (m != null) {
AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(cu);
amrt.MethodReturnType = m.ReturnType;
amrt.MethodParameters = m.Parameters;
resolveResult.ResolvedType = amrt;
}
}
void MakeNamespaceResult(string namespaceName)
@ -503,11 +510,13 @@ namespace Grunwald.BooBinding.CodeCompletion @@ -503,11 +510,13 @@ namespace Grunwald.BooBinding.CodeCompletion
{
ClearResult();
Visit(node.Target);
if (node.Indices.Count > 0) {
Slice slice = node.Indices[0];
if (slice.End != null) {
// Boo slice, returns a part of the source -> same type as source
return;
}
}
IReturnType rt = (resolveResult != null) ? resolveResult.ResolvedType : null;
if (rt == null) {
ClearResult();

37
src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
*/
using System;
using System.Collections;
using System.Reflection;
using NUnit.Framework;
using ICSharpCode.Core;
@ -53,7 +54,7 @@ namespace Grunwald.BooBinding.Tests @@ -53,7 +54,7 @@ namespace Grunwald.BooBinding.Tests
lastPC = pc;
ParserService.ForceProjectContent(pc);
pc.ReferencedContents.Add(ProjectContentRegistry.Mscorlib);
pc.ReferencedContents.Add(ProjectContentRegistry.WinForms);
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(new ReferenceProjectItem(null, "System.Windows.Forms")));
pc.ReferencedContents.Add(booLangPC);
ICompilationUnit cu = new BooParser().Parse(pc, fileName, prog);
ParserService.UpdateParseInformation(cu, fileName, false, false);
@ -217,8 +218,25 @@ namespace Grunwald.BooBinding.Tests @@ -217,8 +218,25 @@ namespace Grunwald.BooBinding.Tests
"\t\tif boo640b = boo640a as FieldInfo: /*640*/\n" +
"\t\t\tprint boo640b\n" +
"\t\n" +
"\tprint 'end of method'\n" +
"\t/*1*/\n";
[Test]
public void MyMethodCompletion()
{
MethodResolveResult rr = Resolve<MethodResolveResult>(regressionProg, "MyMethod", "/*1*/");
ArrayList arr = rr.GetCompletionData(lastPC);
Assert.IsNotNull(arr);
bool beginInvoke = false;
bool invoke = false;
foreach (IMember m in arr) {
if (m.Name == "BeginInvoke") beginInvoke = true;
if (m.Name == "Invoke") invoke = true;
}
Assert.IsTrue(beginInvoke, "beginInvoke");
Assert.IsTrue(invoke, "invoke");
}
[Test]
public void Boo629VariableScope()
{
@ -254,6 +272,23 @@ namespace Grunwald.BooBinding.Tests @@ -254,6 +272,23 @@ namespace Grunwald.BooBinding.Tests
LocalResolveResult rr2 = Resolve<LocalResolveResult>(prog, "mybool", "/*mark*/");
Assert.AreEqual("System.Boolean", rr2.ResolvedType.FullyQualifiedName);
}
[Test]
public void InfiniteRecursionGenerator()
{
string prog =
"class Test:\n" +
"\t_testList = []\n" +
"\tTestProperty:\n" +
"\t\tget:\n" +
"\t\t\tfor testobj as Test in _testList:\n" +
"\t\t\t\tyield testobj.TestProperty /*mark*/\n";
MemberResolveResult rr = Resolve<MemberResolveResult>(prog, "testobj.TestProperty", "/*mark*/");
Assert.AreEqual("Test.TestProperty", rr.ResolvedMember.FullyQualifiedName);
Assert.AreEqual("System.Collections.Generic.IEnumerable", rr.ResolvedType.FullyQualifiedName);
// prevent creating self-referring ConstructedReturnType
Assert.AreEqual("?", rr.ResolvedType.CastToConstructedReturnType().TypeArguments[0].FullyQualifiedName);
}
#endregion
#region Nested Classes

6
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Project/ConvertVisitor.cs

@ -155,12 +155,6 @@ namespace NRefactoryToBooConverter @@ -155,12 +155,6 @@ namespace NRefactoryToBooConverter
currentType.Attributes.Add(MakeAttribute("System.Reflection.DefaultMember", new B.StringLiteralExpression(name)));
}
}
if ((m & Modifier.Narrowing) != 0) {
AddError(node, "Narrowing modifier is not supported");
}
if ((m & Modifier.Widening) != 0) {
AddError(node, "Widening modifier is not supported");
}
return r;
}

9
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

@ -219,6 +219,15 @@ namespace ICSharpCode.FormsDesigner.Services @@ -219,6 +219,15 @@ namespace ICSharpCode.FormsDesigner.Services
}
}
AddAssemblyResolver();
try {
asm.GetTypes(); // force loading references etc.
} catch {
// some assemblies cause strange exceptions in Reflection...
} finally {
RemoveAssemblyResolver();
}
lock (designerAssemblies) {
if (!designerAssemblies.Contains(asm))
designerAssemblies.Insert(0, asm);

14
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin

@ -34,46 +34,46 @@ @@ -34,46 +34,46 @@
</Path>-->
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "BreakPointsPad3"
<Pad id = "BreakPointsPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.Breakpoints}"
icon = "PadIcons.BreakPoints"
shortcut = "Control|Alt|B"
class = "ICSharpCode.SharpDevelop.Gui.Pads.BreakPointsPad"/>
<Pad id = "CallStackPad3"
<Pad id = "CallStackPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.CallStack}"
icon = "PadIcons.CallStack"
shortcut = "Control|Alt|C"
class = "ICSharpCode.SharpDevelop.Gui.Pads.CallStackPad"/>
<Pad id = "LoadedModulesPad3"
<Pad id = "LoadedModulesPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.Modules}"
icon = "PadIcons.LoadedModules"
shortcut = "Control|Alt|U"
class = "ICSharpCode.SharpDevelop.Gui.Pads.LoadedModulesPad"/>
<Pad id = "RunningThreadsPad3"
<Pad id = "RunningThreadsPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.Threads}"
icon = "PadIcons.Threads"
shortcut = "Control|Alt|H"
class = "ICSharpCode.SharpDevelop.Gui.Pads.RunningThreadsPad"/>
<Pad id = "LocalVarPad3"
<Pad id = "LocalVarPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.LocalVariables}"
icon = "PadIcons.LocalVariables"
shortcut = "Control|Alt|V"
class = "ICSharpCode.SharpDevelop.Gui.Pads.LocalVarPad"/>
<Pad id = "ExceptionHistoryPad"
<!--<Pad id = "ExceptionHistoryPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.ExceptionHistory}"
icon = "PadIcons.Exceptions"
shortcut = "Control|Alt|E"
class = "ICSharpCode.SharpDevelop.Gui.Pads.ExceptionHistoryPad"/>
class = "ICSharpCode.SharpDevelop.Gui.Pads.ExceptionHistoryPad"/>-->
</Path>
</AddIn>

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj

@ -74,6 +74,7 @@ @@ -74,6 +74,7 @@
<Compile Include="Src\Pads\DebuggerPad.cs" />
<Compile Include="Src\Pads\CallStackPad.Menu.cs" />
<Compile Include="Src\Pads\RunningThreadsPad.Menu.cs" />
<Compile Include="Src\Pads\DebuggerTreeListView.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">

37
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/DebuggerTreeListView.cs

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision: 1254 $</version>
// </file>
using System;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Gui.Pads
{
public class DebuggerTreeListView: TreeListView
{
static int updateInterval = 100; // ms
Timer refreshingTimer;
public DebuggerTreeListView()
{
refreshingTimer = new Timer();
refreshingTimer.Interval = updateInterval;
refreshingTimer.Tick += delegate {
refreshingTimer.Enabled = false;
this.EndUpdate();
};
}
public void DelayRefresh()
{
if (!refreshingTimer.Enabled) {
this.BeginUpdate();
refreshingTimer.Enabled = true;
}
}
}
}

61
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -22,7 +22,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -22,7 +22,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
public class LocalVarPad : DebuggerPad
{
TreeListView localVarList;
DebuggerTreeListView localVarList;
ColumnHeader name = new ColumnHeader();
ColumnHeader val = new ColumnHeader();
@ -37,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -37,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
protected override void InitializeComponents()
{
//iconsService = (ClassBrowserIconsService)ServiceManager.Services.GetService(typeof(ClassBrowserIconsService));
localVarList = new TreeListView();
localVarList = new DebuggerTreeListView();
localVarList.SmallImageList = DebuggerIcons.ImageList;
localVarList.ShowPlusMinus = true;
localVarList.FullRowSelect = true;
@ -84,28 +84,67 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -84,28 +84,67 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
localVarList.EndUpdate();
}
delegate void AddVariableMethod(Variable variable);
public static void AddVariableCollectionToTree(VariableCollection varCollection, TreeListViewItemCollection tree)
{
TreeListViewItem privateInstanceMenu = new TreeListViewItem("<Private Members>", 0);
TreeListViewItem staticMenu = new TreeListViewItem("<Static Members>", 0);
TreeListViewItem privateStaticMenu = new TreeListViewItem("<Private Static Members>", 0);
AddVariableMethod addVariable = delegate(Variable variable) {
ClassVariable classVariable = variable as ClassVariable;
if (classVariable == null || classVariable.IsPublic) {
if (classVariable != null && classVariable.IsStatic) {
// Public static
if (staticMenu.TreeListView == null) {
tree.Add(staticMenu);
tree.Sort(false);
}
staticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else {
// Public instance
tree.Add(new TreeListViewDebuggerItem(variable));
}
} else {
if (classVariable.IsStatic) {
// Private static
if (staticMenu.TreeListView == null) {
tree.Add(staticMenu);
tree.Sort(false);
}
if (privateStaticMenu.TreeListView == null) {
staticMenu.Items.Add(privateStaticMenu);
staticMenu.Items.Sort(false);
}
privateStaticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else {
// Private instance
if (privateInstanceMenu.TreeListView == null) {
tree.Add(privateInstanceMenu);
tree.Sort(false);
}
privateInstanceMenu.Items.Add(new TreeListViewDebuggerItem(variable));
}
}
};
varCollection.VariableAdded += delegate(object sender, VariableEventArgs e) {
AddVariableToTree(e.Variable, tree);
addVariable(e.Variable);
};
foreach(Variable variable in varCollection) {
AddVariableToTree(variable, tree);
addVariable(variable);
}
}
public static void AddVariableToTree(Variable variableToAdd, TreeListViewItemCollection tree)
{
TreeListViewDebuggerItem newItem = new TreeListViewDebuggerItem(variableToAdd);
tree.Add(newItem);
}
private void localVarList_BeforeExpand(object sender, TreeListViewCancelEventArgs e)
{
if (debuggerCore.IsPaused) {
if (e.Item is TreeListViewDebuggerItem) {
((TreeListViewDebuggerItem)e.Item).BeforeExpand();
}
} else {
MessageBox.Show("You can not explore variables while the debuggee is running.");
e.Cancel = true;

47
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/TreeListViewDebuggerItem.cs

@ -40,6 +40,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -40,6 +40,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
}
bool IsVisible {
get {
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
if (!parent.IsExpanded) {
return false;
}
}
return true;
}
}
public TreeListViewDebuggerItem(Variable variable)
{
this.variable = variable;
@ -54,28 +65,42 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -54,28 +65,42 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
SubItems.Add("");
SubItems.Add("");
Update();
Update(this, null);
}
bool waitingForParentToExpand = false;
void Update(object sender, DebuggerEventArgs e)
{
if (waitingForParentToExpand) return;
if (this.Parent != null && !IsVisible) {
// Delay the update until the parent is expanded
TreeListViewItemHanlder update = null;
update = delegate {
waitingForParentToExpand = false;
Update(this, null);
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
parent.AfterExpand -= update;
}
};
foreach(TreeListViewItem parent in this.ParentsInHierarch) {
parent.AfterExpand += update;
}
waitingForParentToExpand = true;
return;
}
if (this.TreeListView != null) {
((DebuggerTreeListView)this.TreeListView).DelayRefresh();
Highlight = (Variable.Value.AsString != SubItems[1].Text);
Update();
}
public void Update()
{
if (this.SubItems[0].Text != Variable.Name)
this.SubItems[0].Text = Variable.Name;
if (this.SubItems[1].Text != Variable.Value.AsString)
this.SubItems[1].Text = Variable.Value.AsString;
if (this.SubItems[2].Text != Variable.Value.Type)
this.SubItems[2].Text = Variable.Value.Type;
int imageIndex = DebuggerIcons.GetImageListIndex(variable);
if (this.ImageIndex != imageIndex) {
this.ImageIndex = imageIndex;
}
this.ImageIndex = DebuggerIcons.GetImageListIndex(variable);
if (IsExpanded) {
variable.SubVariables.Update();

31
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/DynamicTreeDebuggerRow.cs

@ -50,13 +50,23 @@ namespace ICSharpCode.SharpDevelop.Services @@ -50,13 +50,23 @@ namespace ICSharpCode.SharpDevelop.Services
{
}
bool skipUpdate = true;
public DynamicTreeDebuggerRow(Variable variable)
{
if (variable == null) throw new ArgumentNullException("variable");
this.variable = variable;
this.Shown += delegate {
this.variable.ValueChanged += Update;
this.Hidden += delegate { this.variable.ValueChanged -= Update; };
if (!skipUpdate) {
DoInPausedState( delegate { Update(); } );
}
skipUpdate = false;
};
this.Hidden += delegate {
this.variable.ValueChanged -= Update;
};
DebuggerGridControl.AddColumns(this.ChildColumns);
@ -146,16 +156,21 @@ namespace ICSharpCode.SharpDevelop.Services @@ -146,16 +156,21 @@ namespace ICSharpCode.SharpDevelop.Services
protected override void OnExpanding(DynamicListEventArgs e)
{
if (!populated) {
DoInPausedState(delegate { Populate(); });
}
}
void DoInPausedState(MethodInvoker action)
{
if (Variable.Debugger.IsPaused) {
Populate();
action();
} else {
EventHandler<DebuggingPausedEventArgs> populate = null;
populate = delegate {
Populate();
Variable.Debugger.DebuggingPaused -= populate;
EventHandler<DebuggingPausedEventArgs> onDebuggingPaused = null;
onDebuggingPaused = delegate {
action();
Variable.Debugger.DebuggingPaused -= onDebuggingPaused;
};
Variable.Debugger.DebuggingPaused += populate;
}
Variable.Debugger.DebuggingPaused += onDebuggingPaused;
}
}

9
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs

@ -95,11 +95,14 @@ namespace Debugger @@ -95,11 +95,14 @@ namespace Debugger
Thread thread = debugger.GetThread(pThread);
Stepper stepper = thread.GetStepper(pStepper);
// There is a race condition: The tracking step out can be triggered after stepping step over
thread.CheckExpirationOfFunctions();
debugger.TraceMessage(" - stepper info: " + stepper.ToString());
thread.Steppers.Remove(stepper);
stepper.OnStepComplete();
// There is a race condition: The tracking step out can be triggered after stepping step over
thread.CheckExpirationOfFunctions();
if (stepper.PauseWhenComplete) {
if (debugger.SelectedThread.LastFunction.HasSymbols) {
ExitCallback_Paused();
@ -413,7 +416,7 @@ namespace Debugger @@ -413,7 +416,7 @@ namespace Debugger
public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags)
{
EnterCallback(PausedReason.Exception, "Exception2", pThread);
EnterCallback(PausedReason.Exception, "Exception2 (type=" + exceptionType.ToString() + ")", pThread);
// This callback is also called from Exception(...)!!!! (the .NET 1.1 version)
// Whatch out for the zeros and null!

43
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -46,12 +46,24 @@ namespace Debugger @@ -46,12 +46,24 @@ namespace Debugger
}
}
public uint Token {
get {
return methodProps.Token;
}
}
public Module Module {
get {
return module;
}
}
public Thread Thread {
get {
return thread;
}
}
public bool IsStatic {
get {
return methodProps.IsStatic;
@ -120,9 +132,14 @@ namespace Debugger @@ -120,9 +132,14 @@ namespace Debugger
methodProps = module.MetaData.GetMethodProps(corFunction.Token);
AddTrackingStepper();
}
internal void AddTrackingStepper()
{
// Expiry the function when it is finished
stepOutStepper = CreateStepper();
stepOutStepper.CorStepper.StepOut();
stepOutStepper = new Stepper(this, "Function Tracker");
stepOutStepper.StepOut();
stepOutStepper.PauseWhenComplete = false;
stepOutStepper.StepComplete += delegate {
OnExpired(EventArgs.Empty);
@ -174,17 +191,6 @@ namespace Debugger @@ -174,17 +191,6 @@ namespace Debugger
}
}
internal Stepper CreateStepper()
{
Stepper stepper = new Stepper(debugger, corILFrame.CreateStepper());
if (stepper.CorStepper.Is<ICorDebugStepper2>()) { // Is the debuggee .NET 2.0?
stepper.CorStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
(stepper.CorStepper.CastTo<ICorDebugStepper2>()).SetJMC(1 /* true */);
}
thread.Steppers.Add(stepper);
return stepper;
}
public void StepInto()
{
Step(true);
@ -197,7 +203,8 @@ namespace Debugger @@ -197,7 +203,8 @@ namespace Debugger
public void StepOut()
{
stepOutStepper.PauseWhenComplete = true;
Stepper stepper = new Stepper(this);
stepper.StepOut();
debugger.Continue();
}
@ -217,15 +224,15 @@ namespace Debugger @@ -217,15 +224,15 @@ namespace Debugger
Stepper stepper;
if (stepIn) {
stepper = CreateStepper();
stepper.CorStepper.StepRange(true /* step in */, nextSt.StepRanges);
stepper = new Stepper(this);
stepper.StepIn(nextSt.StepRanges);
}
// Without JMC step in which ends in code without symblols is cotinued.
// The next step over ensures that we at least do step over.
stepper = CreateStepper();
stepper.CorStepper.StepRange(false /* step over */ , nextSt.StepRanges);
stepper = new Stepper(this);
stepper.StepOver(nextSt.StepRanges);
debugger.Continue();
}

77
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs

@ -13,21 +13,37 @@ namespace Debugger @@ -13,21 +13,37 @@ namespace Debugger
{
class Stepper
{
NDebugger debugger;
public enum StepperOperation {Idle, StepIn, StepOver, StepOut};
Function function;
string name;
ICorDebugStepper corStepper;
StepperOperation operation = StepperOperation.Idle;
bool pauseWhenComplete = true;
public event EventHandler<StepperEventArgs> StepComplete;
public NDebugger Debugger {
get {
return debugger;
return function.Debugger;
}
}
public Function Function {
get {
return function;
}
}
public string Name {
get {
return name;
}
}
public ICorDebugStepper CorStepper {
public StepperOperation Operation {
get {
return corStepper;
return operation;
}
}
@ -40,10 +56,24 @@ namespace Debugger @@ -40,10 +56,24 @@ namespace Debugger
}
}
public Stepper(NDebugger debugger, ICorDebugStepper corStepper)
public Stepper(Function function, string name): this(function)
{
this.name = name;
}
public Stepper(Function function)
{
this.debugger = debugger;
this.corStepper = corStepper;
this.function = function;
corStepper = function.CorILFrame.CreateStepper();
// Turn on Just-My-Code
if (corStepper.Is<ICorDebugStepper2>()) { // Is the debuggee .NET 2.0?
corStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
corStepper.CastTo<ICorDebugStepper2>().SetJMC(1 /* true */);
}
function.Thread.Steppers.Add(this);
}
protected internal virtual void OnStepComplete() {
@ -51,5 +81,38 @@ namespace Debugger @@ -51,5 +81,38 @@ namespace Debugger
StepComplete(this, new StepperEventArgs(this));
}
}
public bool IsCorStepper(ICorDebugStepper corStepper)
{
return this.corStepper == corStepper;
}
// NOTE: corStepper.StepOut(); finishes when pevious frame is activated, not when function is exited
// this is important for events with multiple handlers
// NOTE: StepRange callbacks go first (probably in order),
// StepOut callback are called after that
public void StepOut()
{
operation = StepperOperation.StepOut;
// corStepper.StepOut(); // Don't! see note
corStepper.StepRange(false, new int[] {0, int.MaxValue});
}
public void StepIn(int[] ranges)
{
operation = StepperOperation.StepIn;
corStepper.StepRange(true /* step in */, ranges);
}
public void StepOver(int[] ranges)
{
operation = StepperOperation.StepOver;
corStepper.StepRange(false /* step over */, ranges);
}
public override string ToString()
{
return string.Format("{0} in {1} pause={2} {3}", Operation, Function.Name, PauseWhenComplete, name);
}
}
}

21
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -141,7 +141,7 @@ namespace Debugger @@ -141,7 +141,7 @@ namespace Debugger
internal Stepper GetStepper(ICorDebugStepper corStepper)
{
foreach(Stepper stepper in steppers) {
if (stepper.CorStepper == corStepper) {
if (stepper.IsCorStepper(corStepper)) {
return stepper;
}
}
@ -250,6 +250,10 @@ namespace Debugger @@ -250,6 +250,10 @@ namespace Debugger
}
// NOTE: During evlulation some chains may be temporaly removed
// NOTE: When two events are invoked, step outs ocurr at once when all is done
// NOTE: Step out works properly for exceptions
// NOTE: Step over works properly for exceptions
// NOTE: Evaluation kills stepper overs on active frame
internal void CheckExpirationOfFunctions()
{
if (debugger.Evaluating) return;
@ -260,6 +264,8 @@ namespace Debugger @@ -260,6 +264,8 @@ namespace Debugger
ICorDebugFrameEnum corFrameEnum = corChainEnum.Next().EnumerateFrames();
uint maxFrameIndex = corFrameEnum.Count - 1;
ICorDebugFrame lastFrame = corFrameEnum.Next();
List<Function> expiredFunctions = new List<Function>();
foreach(KeyValuePair<uint, Chain> chain in chainCache) {
@ -270,7 +276,20 @@ namespace Debugger @@ -270,7 +276,20 @@ namespace Debugger
}
}
// Check the token of the last function
// TODO: Investigate: this should not happen (test case: event with two handlers)
if (lastFrame != null &&
chainCache.ContainsKey(maxChainIndex) &&
chainCache[maxChainIndex].Frames.ContainsKey(maxFrameIndex)) {
Function cachedFunction = chainCache[maxChainIndex].Frames[maxFrameIndex];
if (cachedFunction.Token != lastFrame.FunctionToken) {
expiredFunctions.Add(cachedFunction);
}
}
foreach(Function f in expiredFunctions) {
debugger.TraceMessage("Function " + f.Name + " expired. (check)");
f.OnExpired(EventArgs.Empty);
}
}

5
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs

@ -145,6 +145,11 @@ namespace Debugger @@ -145,6 +145,11 @@ namespace Debugger
OnEvalStarted(new EvalEventArgs(this));
// Stepper needs to be reset after evaluation
if (targetThread.LastFunction != null) { // TODO: Investigate
targetThread.LastFunction.AddTrackingStepper();
}
evalState = EvalState.Evaluating;
return true;
}

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/PropertyVariable.cs

@ -36,7 +36,7 @@ namespace Debugger @@ -36,7 +36,7 @@ namespace Debugger
}
}
public bool IsEvaluated {
bool IsEvaluated {
get {
if (Eval != null) {
return Eval.Evaluated;
@ -46,7 +46,7 @@ namespace Debugger @@ -46,7 +46,7 @@ namespace Debugger
}
}
public Eval Eval {
Eval Eval {
get {
if (cachedEval == null || cachedEval.HasExpired) {
cachedEval = evalCreator();

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Value.cs

@ -240,13 +240,13 @@ namespace Debugger @@ -240,13 +240,13 @@ namespace Debugger
internal static Value CreateValue(NDebugger debugger, ICorDebugValue corValue)
{
CorElementType type = Value.GetCorType(corValue);
if (Value.DereferenceUnbox(corValue) == null)
{
ICorDebugValue derefed = Value.DereferenceUnbox(corValue);
if (derefed == null) {
return new NullValue(debugger, corValue);
}
CorElementType type = Value.GetCorType(derefed);
switch(type)
{
case CorElementType.BOOLEAN:

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -154,6 +154,9 @@ namespace Debugger @@ -154,6 +154,9 @@ namespace Debugger
((ClassVariable)oldVariable).isPublic = ((ClassVariable)oldVariable).isPublic;
((ClassVariable)oldVariable).isStatic = ((ClassVariable)oldVariable).isStatic;
}
if (newVariable is PropertyVariable) {
newVariable.ValueChanged += delegate { oldVariable.OnValueChanged(); };
}
}
// Keep the variable in the list
toBeRemoved.Remove(this[newVariable.Name]);

10
src/AddIns/Misc/FiletypeRegisterer/Project/Src/RegisterFiletypesCommand.cs

@ -84,13 +84,21 @@ namespace ICSharpCode.FiletypeRegisterer { @@ -84,13 +84,21 @@ namespace ICSharpCode.FiletypeRegisterer {
public static bool IsRegisteredFileType(string extension)
{
try {
using (RegistryKey key = Registry.ClassesRoot.OpenSubKey("." + extension)) {
if (key != null)
return true;
}
} catch (System.Security.SecurityException) {
// registry access might be denied
}
try {
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Classes\\." + extension)) {
return key != null;
}
} catch (System.Security.SecurityException) {
return false;
}
}
public static void RegisterFiletype(string extension, string description, string command, string icon)
@ -135,7 +143,7 @@ namespace ICSharpCode.FiletypeRegisterer { @@ -135,7 +143,7 @@ namespace ICSharpCode.FiletypeRegisterer {
UnRegisterFiletype(extension, Registry.ClassesRoot);
try {
UnRegisterFiletype(extension, Registry.CurrentUser.CreateSubKey("Software\\Classes"));
} catch {}
} catch {} // catch CreateSubKey(Software\Classes)-exceptions
try {
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
} catch {}

2
src/Libraries/ICSharpCode.Build.Tasks/Project/MonoToolLocationHelper.cs

@ -172,8 +172,10 @@ namespace ICSharpCode.Build.Tasks @@ -172,8 +172,10 @@ namespace ICSharpCode.Build.Tasks
if (key != null) {
string readValue = (string)key.GetValue(name);
key.Close();
if (readValue != null) {
return readValue;
}
}
} catch (SecurityException) { }
return String.Empty;

5
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/DefaultHighlightingStrategy.cs

@ -600,7 +600,7 @@ namespace ICSharpCode.TextEditor.Document @@ -600,7 +600,7 @@ namespace ICSharpCode.TextEditor.Document
// Check for SPAN ENDs
if (inSpan) {
if (activeSpan.End != null && !activeSpan.End.Equals("")) {
if (currentLine.MatchExpr(activeSpan.End, i, document)) {
if (currentLine.MatchExpr(activeSpan.End, i, document, activeSpan.IgnoreCase)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(activeSpan.End, i, document);
currentLength += regex.Length;
@ -618,7 +618,7 @@ namespace ICSharpCode.TextEditor.Document @@ -618,7 +618,7 @@ namespace ICSharpCode.TextEditor.Document
// check for SPAN BEGIN
if (activeRuleSet != null) {
foreach (Span span in activeRuleSet.Spans) {
if (currentLine.MatchExpr(span.Begin, i, document)) {
if (currentLine.MatchExpr(span.Begin, i, document, activeRuleSet.IgnoreCase)) {
PushCurWord(document, ref markNext, words);
string regex = currentLine.GetRegString(span.Begin, i, document);
@ -633,6 +633,7 @@ namespace ICSharpCode.TextEditor.Document @@ -633,6 +633,7 @@ namespace ICSharpCode.TextEditor.Document
currentSpanStack = new Stack<Span>();
}
currentSpanStack.Push(span);
span.IgnoreCase = activeRuleSet.IgnoreCase;
UpdateSpanStateVariables();
}

10
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/Span.cs

@ -30,6 +30,7 @@ namespace ICSharpCode.TextEditor.Document @@ -30,6 +30,7 @@ namespace ICSharpCode.TextEditor.Document
string rule = null;
HighlightRuleSet ruleSet = null;
bool noEscapeSequences = false;
bool ignoreCase = false;
internal HighlightRuleSet RuleSet {
get {
@ -40,6 +41,15 @@ namespace ICSharpCode.TextEditor.Document @@ -40,6 +41,15 @@ namespace ICSharpCode.TextEditor.Document
}
}
public bool IgnoreCase {
get {
return ignoreCase;
}
set {
ignoreCase = value;
}
}
public bool StopEOL {
get {
return stopEOL;

22
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineSegment.cs

@ -160,7 +160,7 @@ namespace ICSharpCode.TextEditor.Document @@ -160,7 +160,7 @@ namespace ICSharpCode.TextEditor.Document
/// <summary>
/// returns true, if the get the string s2 at index matches the expression expr
/// </summary>
internal bool MatchExpr(char[] expr, int index, IDocument document)
internal bool MatchExpr(char[] expr, int index, IDocument document, bool ignoreCase)
{
for (int i = 0, j = 0; i < expr.Length; ++i, ++j) {
switch (expr[i]) {
@ -178,7 +178,9 @@ namespace ICSharpCode.TextEditor.Document @@ -178,7 +178,9 @@ namespace ICSharpCode.TextEditor.Document
if (this.Offset + index + j + whatmatch.Length < document.TextLength) {
int k = 0;
for (; k < whatmatch.Length; ++k) {
if (document.GetCharAt(this.Offset + index + j + k) != whatmatch[k]) {
char docChar = ignoreCase ? Char.ToUpperInvariant(document.GetCharAt(this.Offset + index + j + k)) : document.GetCharAt(this.Offset + index + j + k);
char spanChar = ignoreCase ? Char.ToUpperInvariant(whatmatch[k]) : whatmatch[k];
if (docChar != spanChar) {
break;
}
}
@ -198,9 +200,12 @@ namespace ICSharpCode.TextEditor.Document @@ -198,9 +200,12 @@ namespace ICSharpCode.TextEditor.Document
}
if (index - whatmatch.Length >= 0) {
int k = 0;
for (; k < whatmatch.Length; ++k)
if (document.GetCharAt(this.Offset + index - whatmatch.Length + k) != whatmatch[k])
for (; k < whatmatch.Length; ++k) {
char docChar = ignoreCase ? Char.ToUpperInvariant(document.GetCharAt(this.Offset + index - whatmatch.Length + k)) : document.GetCharAt(this.Offset + index - whatmatch.Length + k);
char spanChar = ignoreCase ? Char.ToUpperInvariant(whatmatch[k]) : whatmatch[k];
if (docChar != spanChar)
break;
}
if (k >= whatmatch.Length) {
return false;
}
@ -217,12 +222,19 @@ namespace ICSharpCode.TextEditor.Document @@ -217,12 +222,19 @@ namespace ICSharpCode.TextEditor.Document
}
break;
default:
if (index + j >= this.Length || expr[i] != document.GetCharAt(this.Offset + index + j)) {
{
if (index + j >= this.Length) {
return false;
}
char docChar = ignoreCase ? Char.ToUpperInvariant(document.GetCharAt(this.Offset + index + j)) : document.GetCharAt(this.Offset + index + j);
char spanChar = ignoreCase ? Char.ToUpperInvariant(expr[i]) : expr[i];
if (docChar != spanChar) {
return false;
}
break;
}
}
}
return true;
}
}

174
src/Libraries/NRefactory/Project/Src/Output/CSharp/CSharpOutputVisitor.cs

@ -622,6 +622,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -622,6 +622,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Dot);
}
outputFormatter.PrintIdentifier(methodDeclaration.Name);
PrintMethodDeclaration(methodDeclaration);
return null;
}
void PrintMethodDeclaration(MethodDeclaration methodDeclaration)
{
PrintTemplates(methodDeclaration.Templates);
if (prettyPrintOptions.BeforeMethodDeclarationParentheses) {
outputFormatter.Space();
@ -630,9 +637,118 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -630,9 +637,118 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
AppendCommaSeparatedList(methodDeclaration.Parameters);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) {
nodeTracker.TrackedVisit(templateDefinition, data);
nodeTracker.TrackedVisit(templateDefinition, null);
}
OutputBlock(methodDeclaration.Body, this.prettyPrintOptions.MethodBraceStyle);
}
public object Visit(OperatorDeclaration operatorDeclaration, object data)
{
VisitAttributes(operatorDeclaration.Attributes, data);
outputFormatter.Indent();
OutputModifier(operatorDeclaration.Modifier);
if (operatorDeclaration.IsConversionOperator) {
if (operatorDeclaration.ConversionType == ConversionType.Implicit) {
outputFormatter.PrintToken(Tokens.Implicit);
} else {
outputFormatter.PrintToken(Tokens.Explicit);
}
} else {
nodeTracker.TrackedVisit(operatorDeclaration.TypeReference, data);
}
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.Operator);
outputFormatter.Space();
if (operatorDeclaration.IsConversionOperator) {
nodeTracker.TrackedVisit(operatorDeclaration.TypeReference, data);
} else {
switch (operatorDeclaration.OverloadableOperator) {
case OverloadableOperatorType.Add:
outputFormatter.PrintToken(Tokens.Plus);
break;
case OverloadableOperatorType.BitNot:
outputFormatter.PrintToken(Tokens.BitwiseComplement);
break;
case OverloadableOperatorType.BitwiseAnd:
outputFormatter.PrintToken(Tokens.BitwiseAnd);
break;
case OverloadableOperatorType.BitwiseOr:
outputFormatter.PrintToken(Tokens.BitwiseOr);
break;
case OverloadableOperatorType.Concat:
outputFormatter.PrintToken(Tokens.Plus);
break;
case OverloadableOperatorType.Decrement:
outputFormatter.PrintToken(Tokens.Decrement);
break;
case OverloadableOperatorType.Divide:
case OverloadableOperatorType.DivideInteger:
outputFormatter.PrintToken(Tokens.Div);
break;
case OverloadableOperatorType.Equality:
outputFormatter.PrintToken(Tokens.Equal);
break;
case OverloadableOperatorType.ExclusiveOr:
outputFormatter.PrintToken(Tokens.Xor);
break;
case OverloadableOperatorType.GreaterThan:
outputFormatter.PrintToken(Tokens.GreaterThan);
break;
case OverloadableOperatorType.GreaterThanOrEqual:
outputFormatter.PrintToken(Tokens.GreaterEqual);
break;
case OverloadableOperatorType.Increment:
outputFormatter.PrintToken(Tokens.Increment);
break;
case OverloadableOperatorType.InEquality:
outputFormatter.PrintToken(Tokens.NotEqual);
break;
case OverloadableOperatorType.IsTrue:
outputFormatter.PrintToken(Tokens.True);
break;
case OverloadableOperatorType.IsFalse:
outputFormatter.PrintToken(Tokens.False);
break;
case OverloadableOperatorType.LessThan:
outputFormatter.PrintToken(Tokens.LessThan);
break;
case OverloadableOperatorType.LessThanOrEqual:
outputFormatter.PrintToken(Tokens.LessEqual);
break;
case OverloadableOperatorType.Like:
outputFormatter.PrintText("Like");
break;
case OverloadableOperatorType.Modulus:
outputFormatter.PrintToken(Tokens.Mod);
break;
case OverloadableOperatorType.Multiply:
outputFormatter.PrintToken(Tokens.Times);
break;
case OverloadableOperatorType.Not:
outputFormatter.PrintToken(Tokens.Not);
break;
case OverloadableOperatorType.Power:
outputFormatter.PrintText("Power");
break;
case OverloadableOperatorType.ShiftLeft:
outputFormatter.PrintToken(Tokens.ShiftLeft);
break;
case OverloadableOperatorType.ShiftRight:
outputFormatter.PrintToken(Tokens.GreaterThan);
outputFormatter.PrintToken(Tokens.GreaterThan);
break;
case OverloadableOperatorType.Subtract:
outputFormatter.PrintToken(Tokens.Minus);
break;
default:
errors.Error(-1, -1, operatorDeclaration.OverloadableOperator.ToString() + " is not supported as overloadable operator");
break;
}
}
PrintMethodDeclaration(operatorDeclaration);
return null;
}
@ -736,62 +852,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -736,62 +852,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
return null;
}
public object Visit(OperatorDeclaration operatorDeclaration, object data)
{
// TODO: implement me
// VisitAttributes(operatorDeclaration.Attributes, data);
// outputFormatter.Indent();
// OutputModifier(operatorDeclaration.Modifier);
// switch (operatorDeclaration.OperatorType) {
// case OperatorType.Explicit:
// outputFormatter.PrintToken(Tokens.Explicit);
// break;
// case OperatorType.Implicit:
// outputFormatter.PrintToken(Tokens.Implicit);
// break;
// default:
// Visit(operatorDeclaration.OpratorDeclarator.TypeReference, data);
// break;
// }
// outputFormatter.Space();
// outputFormatter.PrintToken(Tokens.Operator);
// outputFormatter.Space();
// if (!operatorDeclaration.OpratorDeclarator.IsConversion) {
// outputFormatter.PrintIdentifier(Tokens.GetTokenString(operatorDeclaration.OpratorDeclarator.OverloadOperatorToken));
// } else {
// Visit(operatorDeclaration.OpratorDeclarator.TypeReference, data);
// }
//
// outputFormatter.PrintToken(Tokens.OpenParenthesis);
// Visit(operatorDeclaration.OpratorDeclarator.FirstParameterType, data);
// outputFormatter.Space();
// outputFormatter.PrintIdentifier(operatorDeclaration.OpratorDeclarator.FirstParameterName);
// if (operatorDeclaration.OpratorDeclarator.OperatorType == OperatorType.Binary) {
// outputFormatter.PrintToken(Tokens.Comma);
// outputFormatter.Space();
// Visit(operatorDeclaration.OpratorDeclarator.SecondParameterType, data);
// outputFormatter.Space();
// outputFormatter.PrintIdentifier(operatorDeclaration.OpratorDeclarator.SecondParameterName);
// }
// outputFormatter.PrintToken(Tokens.CloseParenthesis);
//
// if (operatorDeclaration.Body.IsNull) {
// outputFormatter.PrintToken(Tokens.Semicolon);
// } else {
// outputFormatter.NewLine();
// outputFormatter.Indent();
// outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
// outputFormatter.NewLine();
// ++outputFormatter.IndentationLevel;
// operatorDeclaration.Body.AcceptChildren(this, data);
// --outputFormatter.IndentationLevel;
// outputFormatter.Indent();
// outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
// }
// outputFormatter.NewLine();
return null;
}
public object Visit(DeclareDeclaration declareDeclaration, object data)
{
errors.Error(-1, -1, "DeclareDeclaration is unsupported");

25
src/Libraries/NRefactory/Project/Src/Output/VBNet/VBNetOutputVisitor.cs

@ -983,10 +983,19 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -983,10 +983,19 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public object Visit(OperatorDeclaration operatorDeclaration, object data)
{
// TODO: widenting... operators
VisitAttributes(operatorDeclaration.Attributes, data);
outputFormatter.Indent();
OutputModifier(operatorDeclaration.Modifier);
if (operatorDeclaration.IsConversionOperator) {
if (operatorDeclaration.ConversionType == ConversionType.Implicit) {
outputFormatter.PrintToken(Tokens.Widening);
} else {
outputFormatter.PrintToken(Tokens.Narrowing);
}
outputFormatter.Space();
}
outputFormatter.PrintToken(Tokens.Operator);
outputFormatter.Space();
@ -1077,13 +1086,24 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1077,13 +1086,24 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
break;
}
if (operatorDeclaration.IsConversionOperator) {
outputFormatter.PrintToken(Tokens.CType);
} else {
if(op != -1) outputFormatter.PrintToken(op);
}
PrintTemplates(operatorDeclaration.Templates);
outputFormatter.PrintToken(Tokens.OpenParenthesis);
AppendCommaSeparatedList(operatorDeclaration.Parameters);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
if (!operatorDeclaration.TypeReference.IsNull) {
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.As);
outputFormatter.Space();
nodeTracker.TrackedVisit(operatorDeclaration.TypeReference, data);
}
outputFormatter.NewLine();
@ -1091,7 +1111,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1091,7 +1111,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
nodeTracker.TrackedVisit(operatorDeclaration.Body, data);
--outputFormatter.IndentationLevel;
outputFormatter.NewLine();
outputFormatter.Indent();
outputFormatter.PrintToken(Tokens.End);
outputFormatter.Space();

12
src/Libraries/NRefactory/Project/Src/Parser/AST/Enums.cs

@ -43,8 +43,8 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -43,8 +43,8 @@ namespace ICSharpCode.NRefactory.Parser.AST
Overloads = 0x10000, // VB specific
WithEvents = 0x20000, // VB specific
Default = 0x40000, // VB specific
Narrowing = 0x80000, // VB specific
Widening = 0x100000, // VB specific
Synthetic = 0x200000,
/// <summary>Only for VB properties.</summary>
WriteOnly = 0x400000, // VB specific
@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -61,7 +61,7 @@ namespace ICSharpCode.NRefactory.Parser.AST
VBEvents = Visibility | New | Overloads,
VBProperties = VBMethods | Default | ReadOnly | WriteOnly,
VBCustomEvents = Visibility | New | Overloads,
VBOperators = Public | Static | Overloads | New | Widening | Narrowing,
VBOperators = Public | Static | Overloads | New,
// this is not documented in the spec
@ -321,12 +321,10 @@ namespace ICSharpCode.NRefactory.Parser.AST @@ -321,12 +321,10 @@ namespace ICSharpCode.NRefactory.Parser.AST
Increment,
Decrement,
True,
False,
// VB specific
IsTrue,
IsFalse,
// VB specific
Like,
Power,
CType,

2074
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

File diff suppressed because it is too large Load Diff

10
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -335,7 +335,11 @@ bool SkipGeneric(ref Token pt) @@ -335,7 +335,11 @@ bool SkipGeneric(ref Token pt)
--braces;
} else if (pt.kind == Tokens.LessThan) {
++braces;
} else if (pt.kind == Tokens.Semicolon || pt.kind == Tokens.OpenCurlyBrace || pt.kind == Tokens.CloseCurlyBrace || pt.kind == Tokens.EOF) {
} else if (pt.kind != Tokens.Identifier && pt.kind != Tokens.Comma
&& pt.kind != Tokens.OpenSquareBracket && pt.kind != Tokens.CloseSquareBracket
&& pt.kind != Tokens.Question
&& !Tokens.TypeKW[pt.kind])
{
return false;
}
}
@ -1746,8 +1750,8 @@ OverloadableOperator<out OverloadableOperatorType op> @@ -1746,8 +1750,8 @@ OverloadableOperator<out OverloadableOperatorType op>
| "++" (. op = OverloadableOperatorType.Increment; .)
| "--" (. op = OverloadableOperatorType.Decrement; .)
| "true" (. op = OverloadableOperatorType.True; .)
| "false" (. op = OverloadableOperatorType.False; .)
| "true" (. op = OverloadableOperatorType.IsTrue; .)
| "false" (. op = OverloadableOperatorType.IsFalse; .)
| "*" (. op = OverloadableOperatorType.Multiply; .)
| "/" (. op = OverloadableOperatorType.Divide; .)

1583
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

7
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1317,7 +1317,9 @@ StructureMemberDecl<Modifiers m, List<AttributeSection> attributes> @@ -1317,7 +1317,9 @@ StructureMemberDecl<Modifiers m, List<AttributeSection> attributes>
decl.RaiseRegion = raiseEventAccessorDeclaration;
compilationUnit.AddChild(decl);
.)
|
| (. ConversionType opConversionType = ConversionType.None; .)
[ "Widening" (. opConversionType = ConversionType.Implicit; .)
| "Narrowing" (. opConversionType = ConversionType.Explicit;.) ]
"Operator"
(.
m.Check(Modifier.VBOperators);
@ -1352,6 +1354,7 @@ StructureMemberDecl<Modifiers m, List<AttributeSection> attributes> @@ -1352,6 +1354,7 @@ StructureMemberDecl<Modifiers m, List<AttributeSection> attributes>
returnType,
operatorType
);
operatorDeclaration.ConversionType = opConversionType;
operatorDeclaration.ReturnTypeAttributes = returnTypeAttributes;
operatorDeclaration.Body = (BlockStatement)stmt;
operatorDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
@ -2994,8 +2997,6 @@ MemberModifier<Modifiers m> = @@ -2994,8 +2997,6 @@ MemberModifier<Modifiers m> =
| "WriteOnly" (.m.Add(Modifier.WriteOnly, t.Location);.)
| "WithEvents" (.m.Add(Modifier.WithEvents, t.Location);.)
| "Dim" (.m.Add(Modifier.Dim, t.Location);.)
| "Widening" (.m.Add(Modifier.Widening, t.Location);.)
| "Narrowing" (.m.Add(Modifier.Narrowing, t.Location);.)
.
END VBNET.

21
src/Libraries/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs

@ -338,5 +338,26 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -338,5 +338,26 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
TestTypeMember("public string this[int index] { get { return index.ToString(); } set { } }");
TestTypeMember("public string IList.this[int index] { get { return index.ToString(); } set { } }");
}
[Test]
public void OverloadedConversionOperators()
{
TestTypeMember("public static explicit operator TheBug(XmlNode xmlNode) { }");
TestTypeMember("public static implicit operator XmlNode(TheBug bugNode) { }");
}
[Test]
public void OverloadedTrueFalseOperators()
{
TestTypeMember("public static bool operator true(TheBug bugNode) { }");
TestTypeMember("public static bool operator false(TheBug bugNode) { }");
}
[Test]
public void OverloadedOperators()
{
TestTypeMember("public static TheBug operator +(TheBug bugNode, TheBug bugNode2) { }");
TestTypeMember("public static TheBug operator >>(TheBug bugNode, int b) { }");
}
}
}

21
src/Libraries/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs

@ -258,5 +258,26 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -258,5 +258,26 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
{
TestStatement("On Error Resume Next");
}
[Test]
public void OverloadedConversionOperators()
{
TestTypeMember("Public Shared Narrowing Operator CType(ByVal xmlNode As XmlNode) As TheBug\nEnd Operator");
TestTypeMember("Public Shared Widening Operator CType(ByVal bugNode As TheBug) As XmlNode\nEnd Operator");
}
[Test]
public void OverloadedTrueFalseOperators()
{
TestTypeMember("Public Shared Operator IsTrue(ByVal a As TheBug) As Boolean\nEnd Operator");
TestTypeMember("Public Shared Operator IsFalse(ByVal a As TheBug) As Boolean\nEnd Operator");
}
[Test]
public void OverloadedOperators()
{
TestTypeMember("Public Shared Operator +(ByVal bugNode As TheBug, ByVal bugNode2 As TheBug) As TheBug\nEnd Operator");
TestTypeMember("Public Shared Operator >>(ByVal bugNode As TheBug, ByVal b As Integer) As TheBug\nEnd Operator");
}
}
}

8
src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs

@ -235,6 +235,14 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -235,6 +235,14 @@ namespace ICSharpCode.NRefactory.Tests.AST
{
CSharpTestBinaryOperatorExpressionTest("a ?? b", BinaryOperatorType.NullCoalescing);
}
[Test]
public void CSharpLessThanOrGreaterTest()
{
const string expr = "i1 < 0 || i1 > (Count - 1)";
BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(expr);
Assert.AreEqual(BinaryOperatorType.LogicalOr, boe.Op);
}
#endregion
#region VB.NET

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

@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Commands
{
public static void SaveAll()
{
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection.ToArray()) {
if (content.IsViewOnly) {
continue;
}

2
src/Main/Base/Project/Src/Commands/MenuItemBuilders.cs

@ -353,7 +353,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -353,7 +353,7 @@ namespace ICSharpCode.SharpDevelop.Commands
this.padDescriptor = padDescriptor;
Text = StringParser.Parse(padDescriptor.Title);
if (padDescriptor.Icon != null) {
if (!string.IsNullOrEmpty(padDescriptor.Icon)) {
base.Image = IconService.GetBitmap(padDescriptor.Icon);
}

6
src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop.Dom
public sealed class AnonymousMethodReturnType : ProxyReturnType
{
IReturnType returnType;
List<IParameter> parameters = new List<IParameter>();
IList<IParameter> parameters = new List<IParameter>();
ICompilationUnit cu;
public AnonymousMethodReturnType(ICompilationUnit cu)
@ -45,6 +45,10 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -45,6 +45,10 @@ namespace ICSharpCode.SharpDevelop.Dom
get {
return parameters;
}
set {
if (value == null) throw new ArgumentNullException("value");
parameters = value;
}
}
public override bool IsDefaultReturnType {

46
src/Main/Base/Project/Src/Dom/ModifierEnum.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using M = ICSharpCode.NRefactory.Parser.AST.Modifier;
namespace ICSharpCode.SharpDevelop.Dom
{
@ -15,33 +16,32 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -15,33 +16,32 @@ namespace ICSharpCode.SharpDevelop.Dom
None = 0,
// Access
Private = 0x0001,
Internal = 0x0002, // == Friend
Protected = 0x0004,
Public = 0x0008,
Dim = 0x0010, // VB.NET SPECIFIC
Private = M.Private,
Internal = M.Internal, // == Friend
Protected = M.Protected,
Public = M.Public,
Dim = M.Dim, // VB.NET SPECIFIC
// Scope
Abstract = 0x0010, // == MustOverride/MustInherit
Virtual = 0x0020,
Sealed = 0x0040,
Static = 0x0080,
Override = 0x0100,
Readonly = 0x0200,
Const = 0x0400,
New = 0x0800, // == Shadows
Partial = 0x1000,
Abstract = M.Abstract, // == MustOverride/MustInherit
Virtual = M.Virtual,
Sealed = M.Sealed,
Static = M.Static,
Override = M.Override,
Readonly = M.ReadOnly,
Const = M.Const,
New = M.New, // == Shadows
Partial = M.Partial,
// Special
Extern = 0x2000,
Volatile = 0x4000,
Unsafe = 0x8000,
Overloads = 0x10000, // VB specific
WithEvents = 0x20000, // VB specific
Default = 0x40000, // VB specific
Narrowing = 0x80000, // VB specific
Widening = 0x100000, // VB specific
Synthetic = 0x200000,
Extern = M.Extern,
Volatile = M.Volatile,
Unsafe = M.Unsafe,
Overloads = M.Overloads, // VB specific
WithEvents = M.WithEvents, // VB specific
Default = M.Default, // VB specific
Synthetic = M.Synthetic,
ProtectedAndInternal = Internal | Protected,
VisibilityMask = Private | Internal | Protected | Public,

2
src/Main/Base/Project/Src/Gui/Pads/DefinitionViewPad.cs

@ -63,7 +63,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -63,7 +63,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (res == null) return;
FilePosition pos = res.GetDefinitionPosition();
if (pos == null) return;
ctl.Invoke(new OpenFileDelegate(OpenFile), pos);
WorkbenchSingleton.SafeThreadAsyncCall(new OpenFileDelegate(OpenFile), pos);
}
ResolveResult ResolveAtCaret(ParserUpdateStepEventArgs e)

16
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{
try {
if (File.Exists(LayoutConfiguration.CurrentLayoutFileName)) {
dockPanel.LoadFromXml(LayoutConfiguration.CurrentLayoutFileName, new DeserializeDockContent(GetContent));
LoadDockPanelLayout(LayoutConfiguration.CurrentLayoutFileName);
} else {
LoadDefaultLayoutConfiguration();
}
@ -179,7 +179,17 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -179,7 +179,17 @@ namespace ICSharpCode.SharpDevelop.Gui
void LoadDefaultLayoutConfiguration()
{
if (File.Exists(LayoutConfiguration.CurrentLayoutTemplateFileName)) {
dockPanel.LoadFromXml(LayoutConfiguration.CurrentLayoutTemplateFileName, new DeserializeDockContent(GetContent));
LoadDockPanelLayout(LayoutConfiguration.CurrentLayoutTemplateFileName);
}
}
void LoadDockPanelLayout(string fileName)
{
// LoadFromXml(fileName, ...) locks the file against simultanous read access
// -> we would loose the layout when starting two SharpDevelop instances
// at the same time => open stream with shared read access.
using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) {
dockPanel.LoadFromXml(fs, new DeserializeDockContent(GetContent));
}
}
@ -423,7 +433,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -423,7 +433,7 @@ namespace ICSharpCode.SharpDevelop.Gui
Properties properties = (Properties)PropertyService.Get("Workspace.ViewMementos", new Properties());
PadContentWrapper newContent = new PadContentWrapper(content);
if (content.Icon != null) {
if (!string.IsNullOrEmpty(content.Icon)) {
newContent.Icon = IconService.GetIcon(content.Icon);
}
newContent.Text = StringParser.Parse(content.Title);

4
src/Main/Base/Project/Src/Internal/Doozers/PadDescriptor.cs

@ -29,8 +29,8 @@ namespace ICSharpCode.Core @@ -29,8 +29,8 @@ namespace ICSharpCode.Core
}
/// <summary>
/// Returns the icon bitmap resource name of the pad. May be null, if the pad has no
/// icon defined.
/// Returns the icon bitmap resource name of the pad. May be an empty string
/// if the pad has no icon defined.
/// </summary>
public string Icon {
get {

6
src/Main/Base/Project/Src/Project/Converter/LanguageConverter.cs

@ -151,7 +151,11 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -151,7 +151,11 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
}
node = node.Parent;
}
FileService.NewFile("Conversion Results", "Text", conversionLog.ToString());
ICSharpCode.SharpDevelop.Gui.IWorkbenchWindow newFileWindow;
newFileWindow = FileService.NewFile("Conversion Results", "Text", conversionLog.ToString());
if (newFileWindow != null) {
newFileWindow.ViewContent.IsDirty = false;
}
}
}

2
src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs

@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
public string Negate(string booleanString)
{
return (!bool.Parse(booleanString)).ToString();
return "false".Equals(booleanString, StringComparison.OrdinalIgnoreCase).ToString();
}
public string GetFileName(string fileName)

2
src/Main/Base/Project/Src/Project/Items/ProjectItem.cs

@ -105,6 +105,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -105,6 +105,8 @@ namespace ICSharpCode.SharpDevelop.Project
[Browsable(false)]
public virtual string FileName {
get {
if (project == null)
return Include;
if (fileNameCache == null)
fileNameCache = Path.Combine(project.Directory, include);
return fileNameCache;

7
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -213,10 +213,15 @@ namespace ICSharpCode.SharpDevelop.Project @@ -213,10 +213,15 @@ namespace ICSharpCode.SharpDevelop.Project
return null;
}
public void Save()
{
try {
Save(fileName);
} catch (IOException ex) {
MessageService.ShowError("Could not save " + fileName + ":\n" + ex.Message);
} catch (UnauthorizedAccessException ex) {
MessageService.ShowError("Could not save " + fileName + ":\n" + ex.Message + "\n\nEnsure the file is writable.");
}
}
public SolutionFolder CreateFolder(string folderName)

4
src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs

@ -95,6 +95,10 @@ namespace ICSharpCode.Core @@ -95,6 +95,10 @@ namespace ICSharpCode.Core
MessageService.ShowError("Error loading " + location + ":\n" + ex.Message);
newProject = new UnknownProject(location, title);
newProject.TypeGuid = projectTypeGuid;
} catch (UnauthorizedAccessException ex) {
MessageService.ShowError("Error loading " + location + ":\n" + ex.Message);
newProject = new UnknownProject(location, title);
newProject.TypeGuid = projectTypeGuid;
}
} else {
newProject = new UnknownProject(location, title);

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

@ -353,7 +353,8 @@ namespace ICSharpCode.Core @@ -353,7 +353,8 @@ namespace ICSharpCode.Core
public static void ParseViewContent(IViewContent viewContent)
{
string text = ((IEditable)viewContent).Text;
ParseInformation parseInformation = ParseFile(viewContent.FileName, text, !viewContent.IsUntitled, true);
ParseInformation parseInformation = ParseFile(viewContent.IsUntitled ? viewContent.UntitledName : viewContent.FileName,
text, !viewContent.IsUntitled, true);
if (parseInformation != null && viewContent is IParseInformationListener) {
((IParseInformationListener)viewContent).ParseInformationUpdated(parseInformation);
}

9
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -303,12 +303,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -303,12 +303,7 @@ namespace ICSharpCode.SharpDevelop.Project
ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(fileName);
IProject project;
if (binding != null) {
try {
project = LanguageBindingService.LoadProject(fileName, solution.Name);
} catch (UnauthorizedAccessException ex) {
MessageService.ShowError(ex.Message);
return;
}
} else {
MessageService.ShowError(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.InvalidProjectOrCombine}", new string[,] {{"FileName", fileName}}));
return;
@ -327,10 +322,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -327,10 +322,12 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
solution.FixSolutionConfiguration(new IProject[] { project });
solution.Save(solutionFile);
if (FileUtility.ObservedSave((NamedFileOperationDelegate)solution.Save, solutionFile) == FileOperationResult.OK) {
// only load when saved succesfully
LoadSolution(solutionFile);
}
}
public static void SaveSolution()
{

3
src/Main/Base/Project/Src/Services/RefactoringService/FindReferencesAndRenameHelper.cs

@ -132,8 +132,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -132,8 +132,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (content is ITextEditorControlProvider &&
content.FileName != null &&
FileUtility.IsEqualFileName(content.FileName, fileName))
FileUtility.IsEqualFileName(content.IsUntitled ? content.UntitledName : content.FileName, fileName))
{
return new ProvidedDocumentInformation(((ITextEditorControlProvider)content).TextEditorControl.Document, fileName, 0);
}

50
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs

@ -171,24 +171,24 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -171,24 +171,24 @@ namespace ICSharpCode.SharpDevelop.Refactoring
bool isLocal,
string fileName, string fileContent)
{
string lowerFileContent = fileContent.ToLower();
string lowerFileContent = fileContent.ToLowerInvariant();
string searchedText; // the text that is searched for
bool searchingIndexer = false;
if (member == null) {
searchedText = parentClass.Name.ToLower();
searchedText = parentClass.Name.ToLowerInvariant();
} else {
// When looking for a member, the name of the parent class does not always exist
// in the file where the member is accessed.
// (examples: derived classes, partial classes)
if (member is IMethod && ((IMethod)member).IsConstructor)
searchedText = parentClass.Name.ToLower();
searchedText = parentClass.Name.ToLowerInvariant();
else {
if (member is IProperty && ((IProperty)member).IsIndexer) {
searchingIndexer = true;
searchedText = GetIndexerExpressionStartToken(fileName);
} else {
searchedText = member.Name.ToLower();
searchedText = member.Name.ToLowerInvariant();
}
}
}
@ -326,28 +326,32 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -326,28 +326,32 @@ namespace ICSharpCode.SharpDevelop.Refactoring
return list;
}
/// <summary>
/// Gets the list of files that could have a reference to the specified class.
/// </summary>
static List<ProjectItem> GetPossibleFiles(IClass c)
{
if (c.DeclaringType != null) {
return GetPossibleFiles(c.DeclaringType, c);
}
List<ProjectItem> resultList = new List<ProjectItem>();
GetPossibleFilesInternal(resultList, c.ProjectContent, c.IsInternal);
return resultList;
}
/// <summary>
/// Gets the files of files that could have a reference to the <paramref name="member"/>
/// int the <paramref name="ownerClass"/>.
/// </summary>
static List<ProjectItem> GetPossibleFiles(IClass ownerClass, IDecoration member)
{
if (member == null)
return GetPossibleFiles(ownerClass);
List<ProjectItem> resultList = new List<ProjectItem>();
if (ProjectService.OpenSolution == null) {
FileProjectItem tempItem = new FileProjectItem(null, ItemType.Compile);
tempItem.Include = ownerClass.CompilationUnit.FileName;
resultList.Add(tempItem);
return resultList;
}
if (member == null) {
// get files possibly referencing ownerClass
while (ownerClass.DeclaringType != null) {
// for nested classes, treat class as member
member = ownerClass;
ownerClass = ownerClass.DeclaringType;
}
if (member == null) {
GetPossibleFilesInternal(resultList, ownerClass.ProjectContent, ownerClass.IsInternal);
return resultList;
}
}
if (member.IsPrivate) {
List<string> fileNames = GetFileNames(ownerClass);
foreach (string fileName in fileNames) {
@ -367,8 +371,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -367,8 +371,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
static ProjectItem FindItem(string fileName)
{
if (ProjectService.OpenSolution == null)
return null;
if (ProjectService.OpenSolution != null) {
foreach (IProject p in ProjectService.OpenSolution.Projects) {
foreach (ProjectItem item in p.Items) {
if (FileUtility.IsEqualFileName(fileName, item.FileName)) {
@ -376,7 +379,10 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -376,7 +379,10 @@ namespace ICSharpCode.SharpDevelop.Refactoring
}
}
}
return null;
}
FileProjectItem tempItem = new FileProjectItem(null, ItemType.Compile);
tempItem.Include = fileName;
return tempItem;
}
static void GetPossibleFilesInternal(List<ProjectItem> resultList, IProjectContent ownerProjectContent, bool internalOnly)

4
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/SearchResult.cs

@ -57,6 +57,10 @@ namespace SearchAndReplace @@ -57,6 +57,10 @@ namespace SearchAndReplace
public SearchResult(int offset, int length)
{
if (length < 0)
throw new ArgumentOutOfRangeException("length");
if (offset < 0)
throw new ArgumentOutOfRangeException("offset");
this.offset = offset;
this.length = length;
}

19
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchStrategy/WildcardSearchStrategy.cs

@ -106,6 +106,9 @@ namespace SearchAndReplace @@ -106,6 +106,9 @@ namespace SearchAndReplace
}
break;
case CommandType.AnyZeroOrMore:
if (ch == '\n') {
return false;
}
return Match(document, curOffset, ignoreCase, pc + 1) ||
Match(document, curOffset + 1, ignoreCase, pc);
case CommandType.AnySingle:
@ -135,9 +138,11 @@ namespace SearchAndReplace @@ -135,9 +138,11 @@ namespace SearchAndReplace
int InternalFindNext(ITextIterator textIterator)
{
while (textIterator.MoveAhead(1)) {
if (Match(textIterator.TextBuffer, textIterator.Position, !SearchOptions.MatchCase, 0)) {
if (!SearchOptions.MatchWholeWord || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, textIterator.Position, curMatchEndOffset - textIterator.Position)) {
return textIterator.Position;
int position = textIterator.Position;
if (Match(textIterator.TextBuffer, position, !SearchOptions.MatchCase, 0)) {
if (!SearchOptions.MatchWholeWord || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, position, curMatchEndOffset - position)) {
textIterator.MoveAhead(curMatchEndOffset - position - 1);
return position;
}
}
}
@ -147,10 +152,12 @@ namespace SearchAndReplace @@ -147,10 +152,12 @@ namespace SearchAndReplace
int InternalFindNext(ITextIterator textIterator, int offset, int length)
{
while (textIterator.MoveAhead(1) && TextSelection.IsInsideRange(textIterator.Position, offset, length)) {
if (Match(textIterator.TextBuffer, textIterator.Position, !SearchOptions.MatchCase, 0)) {
if (!SearchOptions.MatchWholeWord || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, textIterator.Position, curMatchEndOffset - textIterator.Position)) {
int position = textIterator.Position;
if (Match(textIterator.TextBuffer, position, !SearchOptions.MatchCase, 0)) {
if (!SearchOptions.MatchWholeWord || SearchReplaceUtilities.IsWholeWordAt(textIterator.TextBuffer, position, curMatchEndOffset - position)) {
if (TextSelection.IsInsideRange(curMatchEndOffset - 1, offset, length)) {
return textIterator.Position;
textIterator.MoveAhead(curMatchEndOffset - position - 1);
return position;
} else {
return -1;
}

2
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Pad/Nodes/SearchResultNode.cs

@ -63,7 +63,9 @@ namespace SearchAndReplace @@ -63,7 +63,9 @@ namespace SearchAndReplace
LineSegment line = document.GetLineSegment(startPosition.Y);
drawableLine = new DrawableLine(document, line, MonospacedFont, BoldMonospacedFont);
drawableLine.SetBold(0, drawableLine.LineLength, false);
if (startPosition.Y == endPosition.Y) {
drawableLine.SetBold(startPosition.X, endPosition.X, true);
}
specialText = result.DisplayText;
if (specialText != null) {

3
src/Main/Base/Test/MemberLookupHelperTests.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
@ -16,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Tests @@ -16,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Tests
public class MemberLookupHelperTests
{
IProjectContent msc = ProjectContentRegistry.Mscorlib;
IProjectContent swf = ProjectContentRegistry.WinForms;
IProjectContent swf = ProjectContentRegistry.GetProjectContentForReference(new ReferenceProjectItem(null, "System.Windows.Forms"));
public IReturnType DictionaryRT {
get {

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

@ -12,6 +12,7 @@ using System.IO; @@ -12,6 +12,7 @@ using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
using ICSharpCode.SharpDevelop.Project;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
@ -27,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Tests @@ -27,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Tests
p.Parse();
DefaultProjectContent pc = new DefaultProjectContent();
pc.ReferencedContents.Add(ProjectContentRegistry.Mscorlib);
pc.ReferencedContents.Add(ProjectContentRegistry.WinForms);
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(new ReferenceProjectItem(null, "System.Windows.Forms")));
ParserService.ForceProjectContent(pc);
lastPC = pc;
NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor(pc);
@ -51,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Tests @@ -51,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Tests
DefaultProjectContent pc = new DefaultProjectContent();
ParserService.ForceProjectContent(pc);
pc.ReferencedContents.Add(ProjectContentRegistry.Mscorlib);
pc.ReferencedContents.Add(ProjectContentRegistry.WinForms);
pc.ReferencedContents.Add(ProjectContentRegistry.GetProjectContentForReference(new ReferenceProjectItem(null, "System.Windows.Forms")));
pc.Language = LanguageProperties.VBNet;
lastPC = pc;
NRefactoryASTConvertVisitor visitor = new NRefactoryASTConvertVisitor(pc);

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save