Browse Source

Merged SharpDevelop 2.1 r2356:2376 to trunk.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2379 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
555654b78a
  1. BIN
      data/resources/StringResources.cn-gb.resources
  2. BIN
      data/resources/StringResources.cz.resources
  3. BIN
      data/resources/StringResources.de.resources
  4. BIN
      data/resources/StringResources.es-mx.resources
  5. BIN
      data/resources/StringResources.es.resources
  6. BIN
      data/resources/StringResources.hu.resources
  7. BIN
      data/resources/StringResources.kr.resources
  8. BIN
      data/resources/StringResources.nl.resources
  9. BIN
      data/resources/StringResources.pt-br.resources
  10. BIN
      data/resources/StringResources.pt.resources
  11. BIN
      data/resources/StringResources.tr.resources
  12. 2
      data/resources/languages/LanguageDefinition.xml
  13. 10
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin
  14. 9
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/BreakPointsPad.cs
  15. 1
      src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs
  16. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs
  17. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs
  18. 7
      src/Main/Base/Project/Src/Gui/Components/LocalizedPropertyGrid/LocalizedPropertyDescriptor.cs
  19. 1
      src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs
  20. 91
      src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs
  21. 1
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  22. 15
      src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkManager.cs
  23. 53
      src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPad.cs
  24. 5
      src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPadToolbarCommands.cs
  25. 28
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs
  26. 2
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/Search.cs
  27. 18
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/TextIterator/ForwardTextIterator.cs
  28. 91
      src/Main/Base/Test/FindNextWithCursorAtEndTestFixture.cs
  29. 117
      src/Main/Base/Test/ForwardTextIteratorPositionIsEndOffsetTestFixture.cs
  30. 4
      src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj
  31. 60
      src/Main/Base/Test/Utils/MockCurrentDocumentIterator.cs
  32. 254
      src/Main/Base/Test/Utils/MockDocument.cs
  33. 1
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractDecoration.cs
  34. 6
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs
  35. 9
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultParameter.cs
  36. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultProperty.cs
  37. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources
  38. 3
      src/Setup/Files.wxs

BIN
data/resources/StringResources.cn-gb.resources

Binary file not shown.

BIN
data/resources/StringResources.cz.resources

Binary file not shown.

BIN
data/resources/StringResources.de.resources

Binary file not shown.

BIN
data/resources/StringResources.es-mx.resources

Binary file not shown.

BIN
data/resources/StringResources.es.resources

Binary file not shown.

BIN
data/resources/StringResources.hu.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.pt-br.resources

Binary file not shown.

BIN
data/resources/StringResources.pt.resources

Binary file not shown.

BIN
data/resources/StringResources.tr.resources

Binary file not shown.

2
data/resources/languages/LanguageDefinition.xml

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<!--<Languages name="Bulgarian" code="bg" page="" icon="bulgaria.png" />-->
<!--<Languages name="Catalan" code="ca" page="" icon="catalonia.png" />-->
<!--<Languages name="Chinese (BIG5)" code="cn-big" page="" icon="chinalg.png" />-->
<!--<Languages name="Chinese (GB)" code="cn-gb" page="" icon="chinalg.png" />-->
<Languages name="Chinese (GB)" code="cn-gb" page="" icon="chinalg.png" />
<Languages name="Czech" code="cz" page="" icon="czech.png" />
<!--<Languages name="Danish" code="dk" page="" icon="denmark.png" />-->
<Languages name="Dutch" code="nl" page="" icon="netherlands.png" />

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

@ -36,21 +36,21 @@ @@ -36,21 +36,21 @@
</Path>-->
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "BreakPointsPad"
<Pad id = "BreakPointsPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.Breakpoints}"
icon = "PadIcons.BreakPoints"
shortcut = "Control|Alt|P"
class = "ICSharpCode.SharpDevelop.Gui.Pads.BreakPointsPad"/>
<Pad id = "CallStackPad"
<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 = "LoadedModulesPad"
<Pad id = "LoadedModulesPad"
category = "Debugger"
title = "${res:MainWindow.Windows.Debug.Modules}"
icon = "PadIcons.LoadedModules"
@ -64,14 +64,14 @@ @@ -64,14 +64,14 @@
shortcut = "Control|Alt|H"
class = "ICSharpCode.SharpDevelop.Gui.Pads.RunningThreadsPad"/>
<Pad id = "LocalVarPad"
<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"

9
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/BreakPointsPad.cs

@ -10,10 +10,12 @@ using Debugger; @@ -10,10 +10,12 @@ using Debugger;
using ICSharpCode.SharpDevelop.Bookmarks;
using ICSharpCode.SharpDevelop.Services;
using ICSharpCode.SharpDevelop.Debugging;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui.Pads
{
public class BreakPointsPad : BookmarkPad
public class BreakPointsPad : BookmarkPadBase
{
WindowsDebugger debugger;
NDebugger debuggerCore;
@ -40,5 +42,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -40,5 +42,10 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
debuggerCore = debugger.DebuggerCore;
}
protected override bool ShowBookmarkInThisPad(SDBookmark mark)
{
return mark.IsVisibleInBookmarkPad && mark is Debugging.BreakpointBookmark;
}
}
}

1
src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs

@ -324,6 +324,7 @@ namespace ICSharpCode.UnitTesting @@ -324,6 +324,7 @@ namespace ICSharpCode.UnitTesting
if (TaskService.SomethingWentWrong && ErrorListPad.ShowAfterBuild) {
ShowErrorList();
}
ProjectService.RaiseEventEndBuild();
}
}

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/BookmarkManager/BookmarkManager.cs

@ -141,7 +141,7 @@ namespace ICSharpCode.TextEditor.Document @@ -141,7 +141,7 @@ namespace ICSharpCode.TextEditor.Document
OnRemoved(new BookmarkEventArgs(mark));
--i;
changed = true;
} else if (mark.LineNumber > e.LineStart + 1 || (e.LinesMoved < 0 && mark.LineNumber > e.LineStart)) {
} else if (mark.LineNumber > e.LineStart) {
changed = true;
int newLine = mark.LineNumber + e.LinesMoved;
if (newLine >= 0) {

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs

@ -695,7 +695,7 @@ namespace ICSharpCode.TextEditor @@ -695,7 +695,7 @@ namespace ICSharpCode.TextEditor
}
/// <remarks>
/// Overwritten refresh method that locks if the control is in
/// Overwritten refresh method that does nothing if the control is in
/// an update cycle.
/// </remarks>
public override void Refresh()

7
src/Main/Base/Project/Src/Gui/Components/LocalizedPropertyGrid/LocalizedPropertyDescriptor.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
public class LocalizedPropertyDescriptor : PropertyDescriptor
{
PropertyDescriptor basePropertyDescriptor;
PropertyDescriptor basePropertyDescriptor;
string localizedName = String.Empty;
string localizedDescription = String.Empty;
@ -118,6 +118,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -118,6 +118,9 @@ namespace ICSharpCode.SharpDevelop.Gui
public override void ResetValue(object component)
{
this.basePropertyDescriptor.ResetValue(component);
if (component is LocalizedObject) {
((LocalizedObject)component).InformSetValue(this, component, null);
}
}
public override bool ShouldSerializeValue(object component)
@ -128,7 +131,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -128,7 +131,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public override void SetValue(object component, object value)
{
if (this.customTypeConverter != null && value.GetType() != PropertyType) {
this.basePropertyDescriptor.SetValue(component, this.customTypeConverter.ConvertFrom(value));
this.basePropertyDescriptor.SetValue(component, this.customTypeConverter.ConvertFrom(value));
} else {
this.basePropertyDescriptor.SetValue(component, value);
}

1
src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs

@ -73,6 +73,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -73,6 +73,7 @@ namespace ICSharpCode.SharpDevelop.Gui
StatusBarService.Initialize();
DomHostCallback.Register(); // must be called after StatusBarService.Initialize()
ParserService.InitializeParserService();
Bookmarks.BookmarkManager.Initialize();
Project.CustomToolsService.Initialize();
workbench = new DefaultWorkbench();

91
src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs

@ -48,24 +48,35 @@ namespace ICSharpCode.SharpDevelop.Project @@ -48,24 +48,35 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[DefaultValue("global")]
[LocalizedProperty("${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.Aliases}",
Description = "${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.Aliases.Description}")]
public string Aliases {
get {
return GetEvaluatedMetadata("Aliases", "global");
}
set {
SetEvaluatedMetadata("Aliases", value);
}
}
[DefaultValue(false)]
[LocalizedProperty("${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.SpecificVersion}",
Description = "${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.SpecificVersion.Description}")]
public bool SpecificVersion {
get {
return GetEvaluatedMetadata("SpecificVersion", true);
return GetEvaluatedMetadata("SpecificVersion", false);
}
set {
SetEvaluatedMetadata("SpecificVersion", value);
}
}
[DefaultValue(true)]
[LocalizedProperty("${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.LocalCopy}",
Description = "${res:ICSharpCode.SharpDevelop.Internal.Project.ProjectReference.LocalCopy.Description}")]
public bool Private {
get {
return GetEvaluatedMetadata("Private", true);
return GetEvaluatedMetadata("Private", !IsGacReference);
}
set {
SetEvaluatedMetadata("Private", value);
@ -131,6 +142,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -131,6 +142,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[ReadOnly(true)]
public override string FileName {
get {
if (Project != null) {
@ -159,6 +171,13 @@ namespace ICSharpCode.SharpDevelop.Project @@ -159,6 +171,13 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[Browsable(false)]
public bool IsGacReference {
get {
return !Path.IsPathRooted(this.FileName);
}
}
AssemblyName GetAssemblyName(string include)
{
try {
@ -169,5 +188,71 @@ namespace ICSharpCode.SharpDevelop.Project @@ -169,5 +188,71 @@ namespace ICSharpCode.SharpDevelop.Project
return null;
}
protected override void FilterProperties(PropertyDescriptorCollection globalizedProps)
{
base.FilterProperties(globalizedProps);
PropertyDescriptor privatePD = globalizedProps["Private"];
globalizedProps.Remove(privatePD);
globalizedProps.Add(new ReplaceDefaultValueDescriptor(privatePD, !IsGacReference));
}
sealed class ReplaceDefaultValueDescriptor : PropertyDescriptor
{
PropertyDescriptor baseDescriptor;
bool newDefaultValue;
public override bool ShouldSerializeValue(object component)
{
return (bool)GetValue(component) != newDefaultValue;
}
public override void ResetValue(object component)
{
SetValue(component, newDefaultValue);
}
public ReplaceDefaultValueDescriptor(PropertyDescriptor baseDescriptor, bool newDefaultValue)
: base(baseDescriptor)
{
this.baseDescriptor = baseDescriptor;
this.newDefaultValue = newDefaultValue;
}
public override string DisplayName {
get { return baseDescriptor.DisplayName; }
}
public override string Description {
get { return baseDescriptor.Description; }
}
public override Type ComponentType {
get { return baseDescriptor.ComponentType; }
}
public override bool IsReadOnly {
get { return baseDescriptor.IsReadOnly; }
}
public override bool CanResetValue(object component)
{
return baseDescriptor.CanResetValue(component);
}
public override object GetValue(object component)
{
return baseDescriptor.GetValue(component);
}
public override void SetValue(object component, object value)
{
baseDescriptor.SetValue(component, value);
}
public override Type PropertyType {
get { return baseDescriptor.PropertyType; }
}
}
}
}

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

@ -38,6 +38,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -38,6 +38,7 @@ namespace ICSharpCode.SharpDevelop.Project
preferences = new SolutionPreferences(this);
}
[Browsable(false)]
public MSBuild.Engine BuildEngine {
get { return buildEngine; }
}

15
src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkManager.cs

@ -51,6 +51,20 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -51,6 +51,20 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
OnRemoved(new BookmarkEventArgs(bookmark));
}
public static void Clear()
{
while (bookmarks.Count > 0) {
SDBookmark b = bookmarks[bookmarks.Count - 1];
bookmarks.RemoveAt(bookmarks.Count - 1);
OnRemoved(new BookmarkEventArgs(b));
}
}
internal static void Initialize()
{
Project.ProjectService.SolutionClosing += delegate { Clear(); };
}
static void OnRemoved(BookmarkEventArgs e)
{
if (Removed != null) {
@ -58,7 +72,6 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -58,7 +72,6 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
}
}
static void OnAdded(BookmarkEventArgs e)
{
if (Added != null) {

53
src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPad.cs

@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Bookmarks
{
public class BookmarkPad : AbstractPadContent
public sealed class BookmarkPad : BookmarkPadBase
{
static BookmarkPad instance;
@ -27,11 +27,19 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -27,11 +27,19 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
}
}
public BookmarkPad()
{
instance = this;
}
}
public abstract class BookmarkPadBase : AbstractPadContent
{
Panel myPanel = new Panel();
ExtTreeView bookmarkTreeView = new ExtTreeView();
Dictionary<string, BookmarkFolderNode> fileNodes = new Dictionary<string, BookmarkFolderNode>();
public override Control Control {
get {
return myPanel;
@ -44,21 +52,23 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -44,21 +52,23 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
}
}
public BookmarkPad()
protected virtual ToolStrip CreateToolStrip()
{
ToolStrip toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/BookmarkPad/Toolbar");
toolStrip.Stretch = true;
toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
return toolStrip;
}
protected BookmarkPadBase()
{
instance = this;
bookmarkTreeView.Dock = DockStyle.Fill;
bookmarkTreeView.CheckBoxes = true;
bookmarkTreeView.HideSelection = false;
bookmarkTreeView.Font = ExtTreeNode.RegularBigFont;
bookmarkTreeView.IsSorted = false;
ToolStrip toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/BookmarkPad/Toolbar");
toolStrip.Stretch = true;
toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
myPanel.Controls.AddRange(new Control[] { bookmarkTreeView, toolStrip} );
myPanel.Controls.AddRange(new Control[] { bookmarkTreeView, CreateToolStrip()} );
BookmarkManager.Added += new BookmarkEventHandler(BookmarkManagerAdded);
BookmarkManager.Removed += new BookmarkEventHandler(BookmarkManagerRemoved);
@ -67,11 +77,10 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -67,11 +77,10 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
}
}
public class BookmarkNodeEnumerator {
public IEnumerator<TreeNode> GetEnumerator()
{
public IEnumerable<TreeNode> AllNodes {
get {
Stack<TreeNode> treeNodes = new Stack<TreeNode>();
foreach (TreeNode node in Instance.bookmarkTreeView.Nodes) {
foreach (TreeNode node in bookmarkTreeView.Nodes) {
treeNodes.Push(node);
}
@ -84,13 +93,6 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -84,13 +93,6 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
}
}
}
BookmarkNodeEnumerator bookmarkNodeEnumerator = new BookmarkNodeEnumerator();
public BookmarkNodeEnumerator AllNodes {
get {
return bookmarkNodeEnumerator;
}
}
public void EnableDisableAll()
{
@ -112,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -112,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
void AddMark(SDBookmark mark)
{
if (!mark.IsVisibleInBookmarkPad)
if (!ShowBookmarkInThisPad(mark))
return;
if (!fileNodes.ContainsKey(mark.FileName)) {
BookmarkFolderNode folderNode = new BookmarkFolderNode(mark.FileName);
@ -123,7 +125,12 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -123,7 +125,12 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
fileNodes[mark.FileName].Expand();
}
void BookmarkManagerAdded(object sender, BookmarkEventArgs e)
protected virtual bool ShowBookmarkInThisPad(SDBookmark mark)
{
return mark.IsVisibleInBookmarkPad && !(mark is Debugging.BreakpointBookmark);
}
void BookmarkManagerAdded(object sender, BookmarkEventArgs e)
{
AddMark((SDBookmark)e.Bookmark);
}

5
src/Main/Base/Project/Src/TextEditor/Bookmarks/Pad/BookmarkPadToolbarCommands.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
{
public override void Run()
{
BookmarkNode node = BookmarkPad.Instance.CurrentNode;
BookmarkNode node = ((BookmarkPadBase)Owner).CurrentNode;
if (node != null) {
if (node.Bookmark.Document != null) {
node.Bookmark.Document.BookmarkManager.RemoveMark(node.Bookmark);
@ -51,8 +51,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -51,8 +51,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
{
public override void Run()
{
BookmarkPad.Instance.EnableDisableAll();
((BookmarkPadBase)Owner).EnableDisableAll();
}
}
}

28
src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs

@ -49,12 +49,31 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -49,12 +49,31 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
TaskService.Added += new TaskEventHandler(OnAdded);
TaskService.Removed += new TaskEventHandler(OnRemoved);
TaskService.Cleared += new EventHandler(OnCleared);
TaskService.InUpdateChanged += OnInUpdateChanged;
textEditor.FileNameChanged += new EventHandler(SetErrors);
DebuggerService.DebugStarted += OnDebugStarted;
DebuggerService.DebugStopped += OnDebugStopped;
}
bool isDisposed;
bool requireTextEditorRefresh;
void RefreshTextEditor()
{
if (TaskService.InUpdate) {
requireTextEditorRefresh = true;
} else {
textEditor.Refresh();
}
}
void OnInUpdateChanged(object sender, EventArgs e)
{
if (requireTextEditorRefresh) {
requireTextEditorRefresh = false;
textEditor.Refresh();
}
}
/// <summary>
/// Deregisters the event handlers so the error drawer (and associated TextEditorControl)
@ -68,6 +87,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -68,6 +87,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
TaskService.Added -= new TaskEventHandler(OnAdded);
TaskService.Removed -= new TaskEventHandler(OnRemoved);
TaskService.Cleared -= new EventHandler(OnCleared);
TaskService.InUpdateChanged -= OnInUpdateChanged;
textEditor.FileNameChanged -= new EventHandler(SetErrors);
DebuggerService.DebugStarted -= OnDebugStarted;
DebuggerService.DebugStopped -= OnDebugStopped;
@ -99,7 +119,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -99,7 +119,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
VisualError ve = marker as VisualError;
if (ve != null && ve.Task == t) {
textEditor.Document.MarkerStrategy.RemoveMarker(marker);
textEditor.Refresh();
RefreshTextEditor();
break;
}
}
@ -108,7 +128,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -108,7 +128,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
void OnCleared(object sender, EventArgs e)
{
if (ClearErrors()) {
textEditor.Refresh();
RefreshTextEditor();
}
}
@ -158,9 +178,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -158,9 +178,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
length = 2; // use minimum length
}
textEditor.Document.MarkerStrategy.AddMarker(new VisualError(offset, length, task));
if (refresh) {
textEditor.Refresh();
}
if (refresh) RefreshTextEditor();
}
}

2
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/Search.cs

@ -107,7 +107,7 @@ namespace SearchAndReplace @@ -107,7 +107,7 @@ namespace SearchAndReplace
if (documentIterator.MoveForward()) {
info = documentIterator.Current;
// document is valid for searching -> set iterator & fileName
if (info != null && info.TextBuffer != null && info.EndOffset >= 0 && info.EndOffset < info.TextBuffer.Length) {
if (info != null && info.TextBuffer != null && info.EndOffset >= 0 && info.EndOffset <= info.TextBuffer.Length) {
textIterator = textIteratorBuilder.BuildTextIterator(info);
} else {
textIterator = null;

18
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/TextIterator/ForwardTextIterator.cs

@ -91,9 +91,27 @@ namespace SearchAndReplace @@ -91,9 +91,27 @@ namespace SearchAndReplace
case TextIteratorState.Done:
return false;
case TextIteratorState.Iterating:
if (oldOffset == -1 && textBuffer.Length == endOffset) {
// HACK: Take off one if the iterator start
// position is at the end of the text.
Position--;
}
if (oldOffset != -1 && Position == endOffset - 1 && textBuffer.Length == endOffset) {
state = TextIteratorState.Done;
return false;
}
Position = (Position + numChars) % textBuffer.Length;
bool finish = oldOffset != -1 && (oldOffset > Position || oldOffset < endOffset) && Position >= endOffset;
// HACK: Iterating is complete if Position == endOffset - 1
// when the iterator start position was initially at the
// end of the text.
if (oldOffset != -1 && oldOffset == endOffset - 1 && textBuffer.Length == endOffset) {
finish = true;
}
oldOffset = Position;
if (finish) {
state = TextIteratorState.Done;

91
src/Main/Base/Test/FindNextWithCursorAtEndTestFixture.cs

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
using SearchAndReplace;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// SD2-857 - The search fails to find a string if the cursor is
/// positioned at the end of the last line. For example, if the
/// text editor has the text:
/// "foo"
/// without the quotes and no newline after this text, then
/// putting the cursor at the end after the last 'o' and
/// opening the search dialog and doing a find next for 'foo'
/// the string is not found.
/// </summary>
[TestFixture]
public class FindNextWithCursorAtEndTestFixture
{
Search search;
SearchResult result;
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
[SetUp]
public void SetUp()
{
// Set up SearchOptions required by the BruteForceSearchStrategy.
SearchOptions.CurrentFindPattern = "foo";
SearchOptions.MatchCase = false;
SearchOptions.MatchWholeWord = false;
// Create search.
search = new Search();
search.TextIteratorBuilder = new ForwardTextIteratorBuilder();
search.SearchStrategy = new BruteForceSearchStrategy();
MockCurrentDocumentIterator currentDocIterator = new MockCurrentDocumentIterator();
search.DocumentIterator = currentDocIterator;
// Create the document to be searched.
MockDocument doc = new MockDocument();
StringTextBufferStrategy textBufferStrategy = new StringTextBufferStrategy();
textBufferStrategy.SetContent("foo");
doc.TextBufferStrategy = textBufferStrategy;
// Create a doc info with an initial end offset right
// at the end of the text.
ProvidedDocumentInformation docInfo = new ProvidedDocumentInformation(doc, @"C:\Temp\test.txt", doc.TextLength);
currentDocIterator.Current = docInfo;
currentDocIterator.CurrentFileName = docInfo.FileName;
// Search the document.
search.SearchStrategy.CompilePattern(null);
result = search.FindNext();
}
[Test]
public void FoundMatch()
{
Assert.IsNotNull(result);
}
[Test]
public void FoundTextOffset()
{
Assert.AreEqual(0, result.Offset);
}
[Test]
public void FoundTextLength()
{
Assert.AreEqual(3, result.Length);
}
}
}

117
src/Main/Base/Test/ForwardTextIteratorPositionIsEndOffsetTestFixture.cs

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Tests.Utils;
using ICSharpCode.TextEditor.Document;
using SearchAndReplace;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// The forward text iterator never finishes if the initial
/// offset is right at the end of the text.
/// </summary>
[TestFixture]
public class ForwardTextIteratorPositionIsEndOffsetTestFixture
{
ForwardTextIterator forwardTextIterator;
[SetUp]
public void SetUp()
{
// Create the document to be iterated through.
MockDocument doc = new MockDocument();
StringTextBufferStrategy textBufferStrategy = new StringTextBufferStrategy();
textBufferStrategy.SetContent("bar");
doc.TextBufferStrategy = textBufferStrategy;
// Create a doc info with an initial end offset right
// at the end of the text.
ProvidedDocumentInformation docInfo = new ProvidedDocumentInformation(doc,
@"C:\Temp\test.txt",
doc.TextLength);
// Create the forward iterator.
forwardTextIterator = new ForwardTextIterator(docInfo);
}
/// <summary>
/// Note that we cannot move 4 chars in one go with the first
/// call to MoveAhead due to another bug in the ForwardTextIterator.
/// If the iterator has been reset then the first call to MoveAhead
/// always just moves to the DocInfo's EndOffset ignoring any
/// number of chars passed in as an argument to MoveAhead.
/// </summary>
[Test]
public void MoveAheadFourChars()
{
// First move ahead does nothing if the forward text
// iterator was reset. I consider this a bug. All this
// call does is put the iterator at the current position to
// start the iteration. In this case it is after the last
// character in the string, offset 3.
forwardTextIterator.MoveAhead(1);
bool firstMove = forwardTextIterator.MoveAhead(1);
bool secondMove = forwardTextIterator.MoveAhead(1);
bool thirdMove = forwardTextIterator.MoveAhead(1);
bool fourthMove = forwardTextIterator.MoveAhead(1);
Assert.IsTrue(firstMove);
Assert.IsTrue(secondMove);
Assert.IsTrue(thirdMove);
Assert.IsFalse(fourthMove);
}
/// <summary>
/// Check that after moving ahead one character the first
/// char in the string is selected.
/// </summary>
[Test]
public void MoveAheadOneChar()
{
// First move ahead does nothing see comment in MoveAheadThreeChars
// test.
forwardTextIterator.MoveAhead(1);
// Move one char.
forwardTextIterator.MoveAhead(1);
Assert.AreEqual(0, forwardTextIterator.Position);
}
/// <summary>
/// Tests the unusual scenario when a find all is done for a
/// single character when the starting iteration position is after the
/// last character in a string and the last character is a match.
/// </summary>
[Test]
public void ChangePositionAfterThreeMoves()
{
// First move does nothing.
forwardTextIterator.MoveAhead(1);
bool firstMove = forwardTextIterator.MoveAhead(1);
bool secondMove = forwardTextIterator.MoveAhead(1);
bool thirdMove = forwardTextIterator.MoveAhead(1);
// Change position to simulate the search when it finds a
// match at the very last offset. Here the search will
// set the position to be the end offset.
forwardTextIterator.Position = 3;
bool fourthMove = forwardTextIterator.MoveAhead(1);
Assert.IsTrue(firstMove);
Assert.IsTrue(secondMove);
Assert.IsTrue(thirdMove);
Assert.IsFalse(fourthMove);
}
}
}

4
src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

@ -53,6 +53,8 @@ @@ -53,6 +53,8 @@
<Compile Include="CodeConverterTests.cs" />
<Compile Include="CSharpExpressionFinderTests.cs" />
<Compile Include="ExceptionClassOverridesTestFixture.cs" />
<Compile Include="FindNextWithCursorAtEndTestFixture.cs" />
<Compile Include="ForwardTextIteratorPositionIsEndOffsetTestFixture.cs" />
<Compile Include="NRefactoryResolverTests.cs" />
<Compile Include="CollectionClassOverridesTestFixture.cs" />
<Compile Include="OverridableMethodsTestFixture.cs" />
@ -67,8 +69,10 @@ @@ -67,8 +69,10 @@
<Compile Include="MemberLookupHelperTests.cs" />
<Compile Include="Utils\MockAmbience.cs" />
<Compile Include="Utils\MockClass.cs" />
<Compile Include="Utils\MockCurrentDocumentIterator.cs" />
<Compile Include="Utils\MockDecoration.cs" />
<Compile Include="Utils\MockDefaultReturnType.cs" />
<Compile Include="Utils\MockDocument.cs" />
<Compile Include="Utils\MockMethod.cs" />
<Compile Include="Utils\MockProject.cs" />
<Compile Include="Utils\MockProperty.cs" />

60
src/Main/Base/Test/Utils/MockCurrentDocumentIterator.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using SearchAndReplace;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockCurrentDocumentIterator : IDocumentIterator
{
ProvidedDocumentInformation current;
string currentFileName = String.Empty;
bool moved;
public MockCurrentDocumentIterator()
{
}
public ProvidedDocumentInformation Current {
get {
return current;
}
set {
current = value;
}
}
public string CurrentFileName {
get {
return currentFileName;
}
set {
currentFileName = value;
}
}
public bool MoveForward()
{
if (moved) {
return false;
} else {
moved = true;
}
return true;
}
public bool MoveBackward()
{
return false;
}
public void Reset()
{
}
}
}

254
src/Main/Base/Test/Utils/MockDocument.cs

@ -0,0 +1,254 @@ @@ -0,0 +1,254 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Undo;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockDocument : IDocument
{
ITextBufferStrategy textBufferStrategy;
public MockDocument()
{
}
public event EventHandler UpdateCommited;
public event DocumentEventHandler DocumentAboutToBeChanged;
public event DocumentEventHandler DocumentChanged;
public event EventHandler TextContentChanged;
public ITextEditorProperties TextEditorProperties {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public UndoStack UndoStack {
get {
throw new NotImplementedException();
}
}
public bool ReadOnly {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IFormattingStrategy FormattingStrategy {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public ITextBufferStrategy TextBufferStrategy {
get {
return textBufferStrategy;
}
set {
textBufferStrategy = value;
}
}
public FoldingManager FoldingManager {
get {
throw new NotImplementedException();
}
}
public IHighlightingStrategy HighlightingStrategy {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public BookmarkManager BookmarkManager {
get {
throw new NotImplementedException();
}
}
public ICustomLineManager CustomLineManager {
get {
throw new NotImplementedException();
}
}
public MarkerStrategy MarkerStrategy {
get {
throw new NotImplementedException();
}
}
public System.Collections.Generic.List<LineSegment> LineSegmentCollection {
get {
throw new NotImplementedException();
}
}
public int TotalNumberOfLines {
get {
throw new NotImplementedException();
}
}
public string TextContent {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public int TextLength {
get {
return textBufferStrategy.Length;
}
}
public System.Collections.Generic.List<ICSharpCode.TextEditor.TextAreaUpdate> UpdateQueue {
get {
throw new NotImplementedException();
}
}
public int GetLineNumberForOffset(int offset)
{
throw new NotImplementedException();
}
public LineSegment GetLineSegmentForOffset(int offset)
{
throw new NotImplementedException();
}
public LineSegment GetLineSegment(int lineNumber)
{
throw new NotImplementedException();
}
public int GetFirstLogicalLine(int lineNumber)
{
throw new NotImplementedException();
}
public int GetLastLogicalLine(int lineNumber)
{
throw new NotImplementedException();
}
public int GetVisibleLine(int lineNumber)
{
throw new NotImplementedException();
}
public int GetNextVisibleLineAbove(int lineNumber, int lineCount)
{
throw new NotImplementedException();
}
public int GetNextVisibleLineBelow(int lineNumber, int lineCount)
{
throw new NotImplementedException();
}
public void Insert(int offset, string text)
{
throw new NotImplementedException();
}
public void Remove(int offset, int length)
{
throw new NotImplementedException();
}
public void Replace(int offset, int length, string text)
{
throw new NotImplementedException();
}
public char GetCharAt(int offset)
{
throw new NotImplementedException();
}
public string GetText(int offset, int length)
{
throw new NotImplementedException();
}
public string GetText(ISegment segment)
{
throw new NotImplementedException();
}
public System.Drawing.Point OffsetToPosition(int offset)
{
throw new NotImplementedException();
}
public int PositionToOffset(System.Drawing.Point p)
{
throw new NotImplementedException();
}
public void RequestUpdate(ICSharpCode.TextEditor.TextAreaUpdate update)
{
throw new NotImplementedException();
}
public void CommitUpdate()
{
throw new NotImplementedException();
}
public void UpdateSegmentListOnDocumentChange<T>(System.Collections.Generic.List<T> list, DocumentEventArgs e) where T : ISegment
{
throw new NotImplementedException();
}
void OnUpdateCommited()
{
if (UpdateCommited != null) {
}
}
void OnDocumentAboutToBeChanged()
{
if (DocumentAboutToBeChanged != null) {
}
}
void OnDocumentChanged()
{
if (DocumentChanged != null) {
}
}
void OnTextContentChanged()
{
if (TextContentChanged != null) {
}
}
}
}

1
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/AbstractDecoration.cs

@ -221,7 +221,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -221,7 +221,6 @@ namespace ICSharpCode.SharpDevelop.Dom
return IsAccessible(callingClass, isClassInInheritanceTree);
}
public virtual int CompareTo(IDecoration value)
{
return this.Modifiers - value.Modifiers;

6
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs

@ -166,12 +166,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -166,12 +166,6 @@ namespace ICSharpCode.SharpDevelop.Dom
{
int cmp;
cmp = base.CompareTo((IDecoration)value);
if (cmp != 0) {
return cmp;
}
if (FullyQualifiedName != null) {
cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
if (cmp != 0) {

9
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultParameter.cs

@ -143,15 +143,14 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -143,15 +143,14 @@ namespace ICSharpCode.SharpDevelop.Dom
public virtual int CompareTo(IParameter value)
{
if (value == null) return -1;
int cmp;
if(0 != (cmp = ((int)Modifiers - (int)value.Modifiers)))
return cmp;
// two parameters are equal if they have the same return type
// (they may have different names)
if (object.Equals(ReturnType, value.ReturnType))
return 0;
else
return -1;
return string.Compare(this.Name, value.Name);
// if the parameters are not equal, use the parameter name to provide the ordering
}
int IComparable.CompareTo(object value)

3
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultProperty.cs

@ -105,9 +105,6 @@ namespace ICSharpCode.SharpDevelop.Dom { @@ -105,9 +105,6 @@ namespace ICSharpCode.SharpDevelop.Dom {
{
int cmp;
if(0 != (cmp = base.CompareTo((IDecoration)value)))
return cmp;
if (FullyQualifiedName != null) {
cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
if (cmp != 0) {

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

Binary file not shown.

3
src/Setup/Files.wxs

@ -685,6 +685,7 @@ @@ -685,6 +685,7 @@
<File Source="..\..\data\resources\StringResources.ro.resources" Name="STRIN_14.RES" Id="StringResources.ro.resources" LongName="StringResources.ro.resources" />
<File Source="..\..\data\resources\StringResources.se.resources" Name="STRIN_15.RES" Id="StringResources.se.resources" LongName="StringResources.se.resources" />
<File Source="..\..\data\resources\StringResources.pt.resources" Name="STRIN_16.RES" Id="StringResources.pt.resources" LongName="StringResources.pt.resources" />
<File Source="..\..\data\resources\StringResources.cn-gb.resources" Name="CB-GB.RES" Id="StringResources.cn_gb.resources" LongName="StringResources.cn-gb.resources" />
</Component>
</Directory>
<Directory Id="SchemasFolder" Name="schemas">
@ -1238,4 +1239,4 @@ @@ -1238,4 +1239,4 @@
</Directory>
</DirectoryRef>
</Fragment>
</Wix>
</Wix>
Loading…
Cancel
Save