Browse Source

cleanup; converted array lists to generic lists

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1959 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Markus Palme 19 years ago
parent
commit
64eae0f20b
  1. 18
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs
  2. 1
      src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj
  3. 9
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Actions/CaretActions.cs
  4. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/CustomLineManager/CustomLineManager.cs
  5. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/CustomLineManager/ICustomLineManager.cs
  6. 22
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs
  7. 321
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextBufferStrategy/PieceTableTextBufferStrategy.cs
  8. 6
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/TaskListOptions.cs
  9. 11
      src/Main/Base/Project/Src/Internal/Templates/CodeTemplateGroup.cs
  10. 6
      src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs
  11. 15
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
  12. 15
      src/Main/StartUp/Project/Dialogs/SplashScreen.cs

18
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlSchemaCompletionDataCollection.cs

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using System;
using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.XmlEditor
{
@ -16,7 +16,7 @@ namespace ICSharpCode.XmlEditor @@ -16,7 +16,7 @@ namespace ICSharpCode.XmlEditor
/// A collection that stores <see cref='XmlSchemaCompletionData'/> objects.
/// </summary>
[Serializable()]
public class XmlSchemaCompletionDataCollection : CollectionBase {
public class XmlSchemaCompletionDataCollection : System.Collections.CollectionBase {
/// <summary>
/// Initializes a new instance of <see cref='XmlSchemaCompletionDataCollection'/>.
@ -64,14 +64,14 @@ namespace ICSharpCode.XmlEditor @@ -64,14 +64,14 @@ namespace ICSharpCode.XmlEditor
public ICompletionData[] GetNamespaceCompletionData()
{
ArrayList completionItems = new ArrayList();
List<ICompletionData> completionItems = new List<ICompletionData>();
foreach (XmlSchemaCompletionData schema in this) {
XmlCompletionData completionData = new XmlCompletionData(schema.NamespaceUri, XmlCompletionData.DataType.NamespaceUri);
completionItems.Add(completionData);
}
return (ICompletionData[])completionItems.ToArray(typeof(ICompletionData));
return completionItems.ToArray();
}
/// <summary>
@ -227,17 +227,17 @@ namespace ICSharpCode.XmlEditor @@ -227,17 +227,17 @@ namespace ICSharpCode.XmlEditor
/// <seealso cref='IEnumerator'/>
/// <seealso cref='XmlSchemaCompletionDataCollection'/>
/// <seealso cref='XmlSchemaCompletionData'/>
public class XmlSchemaCompletionDataEnumerator : IEnumerator
public class XmlSchemaCompletionDataEnumerator : System.Collections.IEnumerator
{
IEnumerator baseEnumerator;
IEnumerable temp;
System.Collections.IEnumerator baseEnumerator;
System.Collections.IEnumerable temp;
/// <summary>
/// Initializes a new instance of <see cref='XmlSchemaCompletionDataEnumerator'/>.
/// </summary>
public XmlSchemaCompletionDataEnumerator(XmlSchemaCompletionDataCollection mappings)
{
this.temp = ((IEnumerable)(mappings));
this.temp = ((System.Collections.IEnumerable)(mappings));
this.baseEnumerator = temp.GetEnumerator();
}
@ -250,7 +250,7 @@ namespace ICSharpCode.XmlEditor @@ -250,7 +250,7 @@ namespace ICSharpCode.XmlEditor
}
}
object IEnumerator.Current {
object System.Collections.IEnumerator.Current {
get {
return baseEnumerator.Current;
}

1
src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj

@ -193,7 +193,6 @@ @@ -193,7 +193,6 @@
<EmbeddedResource Include="Resources\Tex-Mode.xshd" />
<EmbeddedResource Include="Resources\VBNET-Mode.xshd" />
<EmbeddedResource Include="Resources\XML-Mode.xshd" />
<Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" />
<Compile Include="Src\Util\FileReader.cs" />
<EmbeddedResource Include="Resources\Boo.xshd" />
<Compile Include="Src\Gui\DrawableLine.cs" />

9
src/Libraries/ICSharpCode.TextEditor/Project/Src/Actions/CaretActions.cs

@ -39,14 +39,7 @@ namespace ICSharpCode.TextEditor.Actions @@ -39,14 +39,7 @@ namespace ICSharpCode.TextEditor.Actions
position = new Point(lineAbove.Length, position.Y - 1);
}
}
// ArrayList foldings = textArea.Document.FoldingManager.GetFoldingsFromPosition(position.Y, position.X);
// foreach (FoldMarker foldMarker in foldings) {
// if (foldMarker.IsFolded) {
// if (foldMarker.StartLine < position.Y || foldMarker.StartLine == position.Y && foldMarker.StartColumn < position.X) {
// position = new Point(foldMarker.StartColumn, foldMarker.StartLine);
// }
// }
// }
textArea.Caret.Position = position;
textArea.SetDesiredColumn();
}

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/CustomLineManager/CustomLineManager.cs

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
namespace ICSharpCode.TextEditor.Document
@ -42,7 +42,7 @@ namespace ICSharpCode.TextEditor.Document @@ -42,7 +42,7 @@ namespace ICSharpCode.TextEditor.Document
/// </summary>
public class CustomLineManager : ICustomLineManager
{
ArrayList lines = new ArrayList();
List<CustomLine> lines = new List<CustomLine>();
/// <summary>
/// Creates a new instance of <see cref="CustomLineManager"/>
@ -55,7 +55,7 @@ namespace ICSharpCode.TextEditor.Document @@ -55,7 +55,7 @@ namespace ICSharpCode.TextEditor.Document
/// <value>
/// Contains all custom lines
/// </value>
public ArrayList CustomLines {
public List<CustomLine> CustomLines {
get {
return lines;
}

4
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/CustomLineManager/ICustomLineManager.cs

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
namespace ICSharpCode.TextEditor.Document
@ -19,7 +19,7 @@ namespace ICSharpCode.TextEditor.Document @@ -19,7 +19,7 @@ namespace ICSharpCode.TextEditor.Document
/// <value>
/// Contains all custom lines
/// </value>
ArrayList CustomLines {
List<CustomLine> CustomLines {
get;
}

22
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs

@ -6,20 +6,19 @@ @@ -6,20 +6,19 @@
// </file>
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
namespace ICSharpCode.TextEditor.Document
{
public static class HighlightingDefinitionParser
{
static ArrayList errors = null;
static List<ValidationEventArgs> errors = null;
public static DefaultHighlightingStrategy Parse(SyntaxMode syntaxMode, XmlReader xmlReader)
{
@ -40,12 +39,6 @@ namespace ICSharpCode.TextEditor.Document @@ -40,12 +39,6 @@ namespace ICSharpCode.TextEditor.Document
settings.ValidationType = ValidationType.Schema;
XmlReader validatingReader = XmlReader.Create(xmlReader, settings);
// XmlValidatingReader validatingReader = new XmlValidatingReader(xmlTextReader);
// Stream shemaStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Resources.Mode.xsd");
// validatingReader.Schemas.Add("", new XmlTextReader(shemaStream));
// validatingReader.ValidationType = ValidationType.Schema;
XmlDocument doc = new XmlDocument();
doc.Load(validatingReader);
@ -112,8 +105,8 @@ namespace ICSharpCode.TextEditor.Document @@ -112,8 +105,8 @@ namespace ICSharpCode.TextEditor.Document
private static void ValidationHandler(object sender, ValidationEventArgs args)
{
if (errors==null) {
errors=new ArrayList();
if (errors == null) {
errors=new List<ValidationEventArgs>();
}
errors.Add(args);
}
@ -128,6 +121,5 @@ namespace ICSharpCode.TextEditor.Document @@ -128,6 +121,5 @@ namespace ICSharpCode.TextEditor.Document
}
MessageBox.Show(msg.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
}
}
}

321
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextBufferStrategy/PieceTableTextBufferStrategy.cs

@ -1,321 +0,0 @@ @@ -1,321 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David McCloskey" email="dave_a_mccloskey@hotmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
namespace ICSharpCode.TextEditor.Document
{
// Currently not in use and doesn't compile because SetContent is not implemented.
// If anyone wants to use this, it should be easy to fix it.
/*
public class PieceTableTextBufferStrategy : ITextBufferStrategy
{
protected struct PieceTableDescriptor
{
public bool Buffer; // False for original, True for modified
public int Offset;
public int Length;
}
protected string OriginalBuffer = "";
protected string ModifiedBuffer = ""; // Use StringBuilder
// Use List<PieceTableDescriptor>
protected ArrayList Descriptors = new ArrayList();
public int Length
{
get
{
int length = 0;
for(int i = 0; i < Descriptors.Count; i++)
{
length += ((PieceTableDescriptor)Descriptors[i]).Length;
}
return length;
}
}
public void Insert(int offset, string text)
{
int Len = 0;
int CurrentDesc = 0;
while(true)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[CurrentDesc];
// Is the offset in this descriptor
if((Len + desc.Length) >= offset)
{
int gap = offset - Len;
int newoffset = ModifiedBuffer.Length;
// Add the text to the end of the buffer
ModifiedBuffer += text;
// Set up descriptor for the new text
PieceTableDescriptor newtext = new PieceTableDescriptor();
newtext.Offset = newoffset;
newtext.Length = text.Length;
newtext.Buffer = true;
// Is the offset in the middle of the descriptor
if(gap != 0 && gap != desc.Length)
{
int end = desc.Offset + desc.Length;
desc.Length = gap;
// Set up descriptor for the end of the current descriptor
PieceTableDescriptor newdesc = new PieceTableDescriptor();
newdesc.Offset = desc.Offset + desc.Length;
newdesc.Length = end - newdesc.Offset;
Descriptors[CurrentDesc] = desc;
Descriptors.Insert(CurrentDesc + 1, newtext);
Descriptors.Insert(CurrentDesc + 2, newdesc);
}
else if(gap == desc.Length) // Is it at the end
{
Descriptors.Insert(CurrentDesc + 1, newtext);
}
else // Is it at the beginning
{
Descriptors.Insert(CurrentDesc, newtext);
}
break;
}
else
{
CurrentDesc++;
Len += desc.Length;
if(CurrentDesc == Descriptors.Count)
break;
}
}
}
public void Remove(int offset, int length)
{
int Len = 0;
int CurrentDesc = 0;
while(true)
{
// Does the descriptor contain the offset
if((Len + ((PieceTableDescriptor)Descriptors[CurrentDesc]).Length) >= offset)
{
// Remove the text from the descriptor
RemoveInternal(CurrentDesc, Len, offset, length);
break;
}
else
{
CurrentDesc++;
Len += ((PieceTableDescriptor)Descriptors[CurrentDesc]).Length;
if(CurrentDesc == Descriptors.Count)
break;
}
}
}
protected void RemoveInternal(int descriptor, int lentodesc, int offset, int length)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[descriptor];
int gap = offset - lentodesc;
// Is all the text we want to remove span over multiple descriptors
if((offset + length) > (lentodesc + desc.Length))
{
lentodesc += desc.Length;
length -= lentodesc - offset;
offset = lentodesc;
desc.Length = gap;
// Does the text we want to remove encompass all of this descriptor
if(gap != 0)
{
Descriptors[descriptor] = desc;
RemoveInternal(descriptor + 1, lentodesc, offset, length);
}
else // It does encompass all of this descriptor so remove it
{
Descriptors.RemoveAt(descriptor);
RemoveInternal(descriptor, lentodesc, offset, length);
}
}
else
{
// Set up new descriptor to reflect removed text
PieceTableDescriptor newdesc = new PieceTableDescriptor();
newdesc.Buffer = desc.Buffer;
newdesc.Offset = desc.Offset + gap + length;
newdesc.Length = (desc.Offset + desc.Length) - newdesc.Offset;
desc.Length = gap;
// Does the text we want to remove encompass all of this descriptor
if(gap != 0)
{
Descriptors.Insert(descriptor + 1, newdesc);
Descriptors[descriptor] = desc;
}
else
{
// Instead of removing the old and inserting the new, just set the old to the new inside the array
Descriptors[descriptor] = newdesc;
}
}
}
public void Replace(int offset, int length, string text)
{
Remove(offset, length);
Insert(offset, text);
}
public void SetText(string text)
{
Descriptors.Clear();
ModifiedBuffer = "";
OriginalBuffer = text;
PieceTableDescriptor desc = new PieceTableDescriptor();
desc.Buffer = false;
desc.Offset = 0;
desc.Length = text.Length;
Descriptors.Add(desc);
}
public char GetCharAt(int offset)
{
int off = 0;
int currdesc = 0;
while(true)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[currdesc];
// Is the offset in the current descriptor
if((off + desc.Length) > offset)
{
// Find the difference between the beginning of the descriptor and the offset
int gap = offset - off;
if(desc.Buffer == false) // Original Buffer
{
return OriginalBuffer[desc.Offset + gap];
}
else // Modified Buffer
{
return ModifiedBuffer[desc.Offset + gap];
}
}
else
{
off += desc.Length;
}
currdesc++;
if(currdesc == Descriptors.Count) return '\0';
}
}
public string GetText(int offset, int length)
{
string text = "";
int off = 0;
int currdesc = 0;
while(true)
{
// Does the descriptor contain the offset
if((off + ((PieceTableDescriptor)Descriptors[currdesc]).Length) > offset)
{
// Get the text
text += GetTextInternal(currdesc, off, offset, length);
break;
}
else
{
currdesc++;
off += ((PieceTableDescriptor)Descriptors[currdesc]).Length;
if(currdesc == Descriptors.Count)
break;
}
}
return text;
}
protected string GetTextInternal(int descriptor, int lentodesc, int offset, int length)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[descriptor];
int gap = offset - lentodesc;
string text = "";
// Is the text we want greater than this descriptor
if((offset + length) > (lentodesc + desc.Length))
{
if(desc.Buffer)
{
text += ModifiedBuffer.Substring(desc.Offset + gap, desc.Length);
}
else
{
text += OriginalBuffer.Substring(desc.Offset + gap, desc.Length);
}
lentodesc += desc.Length;
length -= lentodesc - offset;
offset = lentodesc;
// Get the text from the next descriptor
text += GetTextInternal(descriptor + 1, lentodesc, offset, length);
}
else
{
// The text we want is in this descriptor so get it
if(desc.Buffer)
{
text += ModifiedBuffer.Substring(desc.Offset + gap, length);
}
else
{
text += OriginalBuffer.Substring(desc.Offset + gap, length);
}
}
return text;
}
}
*/
}

6
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/IDEOptions/TaskListOptions.cs

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.ExternalTool;
@ -47,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -47,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public override bool StorePanelContents()
{
ArrayList tokens = new ArrayList();
List<string> tokens = new List<string>();
foreach (ListViewItem item in taskList.Items) {
string text = item.Text.Trim();
@ -56,7 +56,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -56,7 +56,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
}
PropertyService.Set("SharpDevelop.TaskListTokens", tokens.ToArray(typeof(string)));
PropertyService.Set("SharpDevelop.TaskListTokens", tokens.ToArray());
return true;
}

11
src/Main/Base/Project/Src/Internal/Templates/CodeTemplateGroup.cs

@ -6,9 +6,8 @@ @@ -6,9 +6,8 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Diagnostics;
namespace ICSharpCode.SharpDevelop.Internal.Templates
{
@ -17,16 +16,16 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates @@ -17,16 +16,16 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
/// </summary>
public class CodeTemplateGroup
{
ArrayList extensions = new ArrayList();
ArrayList templates = new ArrayList();
List<string> extensions = new List<string>();
List<CodeTemplate> templates = new List<CodeTemplate>();
public ArrayList Extensions {
public List<string> Extensions {
get {
return extensions;
}
}
public ArrayList Templates {
public List<CodeTemplate> Templates {
get {
return templates;
}

6
src/Main/Base/Project/Src/TextEditor/Gui/OptionPanels/CodeTemplatePanel.cs

@ -213,9 +213,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -213,9 +213,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
int i = GetCurrentIndex();
if (i != -1) {
ControlDictionary["templateTextBox"].Text = ((CodeTemplate)((ListView)ControlDictionary["templateListView"]).SelectedItems[0].Tag).Text;
ControlDictionary["templateTextBox"].Text = ((CodeTemplate)((ListView)ControlDictionary["templateListView"]).SelectedItems[0].Tag).Text;
} else {
ControlDictionary["templateTextBox"].Text = String.Empty;
ControlDictionary["templateTextBox"].Text = String.Empty;
}
SetEnabledStatus();
}
@ -233,7 +233,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -233,7 +233,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
if (CurrentTemplateGroup != null) {
CurrentTemplateGroup.Templates.Clear();
foreach (ListViewItem item in ((ListView)ControlDictionary["templateListView"]).Items) {
CurrentTemplateGroup.Templates.Add(item.Tag);
CurrentTemplateGroup.Templates.Add((CodeTemplate)item.Tag);
}
}
}

15
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -5,19 +5,14 @@ @@ -5,19 +5,14 @@
// <version>$Revision$</version>
// </file>
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Resources;
using System.Diagnostics;
using System.Windows.Forms;
using System.Xml;
using Microsoft.Win32;
namespace ICSharpCode.Core
{
@ -80,14 +75,14 @@ namespace ICSharpCode.Core @@ -80,14 +75,14 @@ namespace ICSharpCode.Core
string installRoot = NETFrameworkInstallRoot;
string[] files = Directory.GetDirectories(installRoot);
ArrayList runtimes = new ArrayList();
List<string> runtimes = new List<string>();
foreach (string file in files) {
string runtime = Path.GetFileName(file);
if (runtime.StartsWith("v")) {
runtimes.Add(runtime);
}
}
return (string[])runtimes.ToArray(typeof(string));
return runtimes.ToArray();
}
public static string Combine(params string[] paths)

15
src/Main/StartUp/Project/Dialogs/SplashScreen.cs

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Drawing;
@ -20,8 +20,8 @@ namespace ICSharpCode.SharpDevelop @@ -20,8 +20,8 @@ namespace ICSharpCode.SharpDevelop
public const string VersionText = "Serralongue build " + RevisionClass.Revision;
static SplashScreenForm splashScreen;
static ArrayList requestedFileList = new ArrayList();
static ArrayList parameterList = new ArrayList();
static List<string> requestedFileList = new List<string>();
static List<string> parameterList = new List<string>();
Bitmap bitmap;
public static SplashScreenForm SplashScreen {
@ -73,17 +73,12 @@ namespace ICSharpCode.SharpDevelop @@ -73,17 +73,12 @@ namespace ICSharpCode.SharpDevelop
public static string[] GetParameterList()
{
return GetStringArray(parameterList);
return parameterList.ToArray();
}
public static string[] GetRequestedFileList()
{
return GetStringArray(requestedFileList);
}
static string[] GetStringArray(ArrayList list)
{
return (string[])list.ToArray(typeof(string));
return requestedFileList.ToArray();
}
public static void SetCommandLineArgs(string[] args)

Loading…
Cancel
Save