diff options
author | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2015-09-22 22:46:20 +0300 |
---|---|---|
committer | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2015-09-25 17:26:56 +0300 |
commit | c0221a18f12b320768616f0d69bc86eaaa97251c (patch) | |
tree | 5e64fbcfb9b8634420ea5113ffcf8ad691e56537 /main/src/addins/VersionControl | |
parent | 061767f96076c05a68fbe01f02608b584a1cde7f (diff) |
[VersionControl] Use type-safer collections.
Replaces ArrayList with typed List<>s.
Diffstat (limited to 'main/src/addins/VersionControl')
3 files changed, 15 insertions, 11 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs index 6a723a0f01..437ef02106 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs @@ -39,14 +39,16 @@ using Mono.Addins; using MonoDevelop.Ide; using MonoDevelop.Projects; using MonoDevelop.Components; +using System.Collections.Generic; +using System.Linq; namespace MonoDevelop.VersionControl.Dialogs { partial class CommitDialog : Gtk.Dialog { ListStore store; - ArrayList selected = new ArrayList (); - ArrayList extensions = new ArrayList (); + List<FilePath> selected = new List<FilePath> (); + List<CommitDialogExtension> extensions = new List<CommitDialogExtension> (); ChangeSet changeSet; string oldMessage; bool responseSensitive; @@ -220,7 +222,7 @@ namespace MonoDevelop.VersionControl.Dialogs } // Update the change set - ArrayList todel = new ArrayList (); + List<FilePath> todel = new List<FilePath> (); foreach (ChangeSetItem it in changeSet.Items) { if (!selected.Contains (it.LocalPath)) todel.Add (it.LocalPath); @@ -233,7 +235,7 @@ namespace MonoDevelop.VersionControl.Dialogs int n; for (n=0; n<extensions.Count; n++) { - CommitDialogExtension ext = (CommitDialogExtension) extensions [n]; + CommitDialogExtension ext = extensions [n]; bool res; try { res = ext.OnBeginCommit (changeSet); @@ -244,7 +246,7 @@ namespace MonoDevelop.VersionControl.Dialogs if (!res) { // Commit failed. Rollback the previous extensions for (int m=0; m<n; m++) { - ext = (CommitDialogExtension) extensions [m]; + ext = extensions [m]; try { ext.OnEndCommit (changeSet, false); } catch {} @@ -289,7 +291,7 @@ namespace MonoDevelop.VersionControl.Dialogs public string[] GetFilesToCommit () { - return (string[]) selected.ToArray (typeof(string)); + return selected.ToPathStrings ().ToArray (); } public string Message { diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/EditRepositoryDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/EditRepositoryDialog.cs index 32a43eddf8..091af96b7b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/EditRepositoryDialog.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/EditRepositoryDialog.cs @@ -1,12 +1,13 @@ using System; using System.Collections; +using System.Collections.Generic; namespace MonoDevelop.VersionControl.Dialogs { internal partial class EditRepositoryDialog : Gtk.Dialog { Repository repo; - ArrayList systems = new ArrayList (); + List<VersionControlSystem> systems = new List<VersionControlSystem> (); IRepositoryEditor editor; public EditRepositoryDialog (Repository editedRepository) @@ -58,7 +59,7 @@ namespace MonoDevelop.VersionControl.Dialogs string oldname = repo != null ? repo.Name : ""; - VersionControlSystem vcs = (VersionControlSystem) systems [versionControlType.Active]; + VersionControlSystem vcs = systems [versionControlType.Active]; repo = vcs.CreateRepositoryInstance (); repo.Name = oldname; repo.NameChanged += OnNameChanged; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs index 972fad24cf..a514938b0e 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs @@ -6,6 +6,7 @@ using MonoDevelop.Core; using Gtk; using MonoDevelop.Ide; using MonoDevelop.Components; +using System.Collections.Generic; namespace MonoDevelop.VersionControl.Dialogs { @@ -18,10 +19,10 @@ namespace MonoDevelop.VersionControl.Dialogs internal partial class SelectRepositoryDialog : Gtk.Dialog { Repository repo; - ArrayList systems = new ArrayList (); + List<VersionControlSystem> systems = new List<VersionControlSystem> (); Gtk.TreeStore store; SelectRepositoryMode mode; - ArrayList loadingRepos = new ArrayList (); + List<Repository> loadingRepos = new List<Repository> (); IRepositoryEditor currentEditor; string defaultPath; @@ -116,7 +117,7 @@ namespace MonoDevelop.VersionControl.Dialogs if (repCombo.Active == -1) return; - VersionControlSystem vcs = (VersionControlSystem) systems [repCombo.Active]; + VersionControlSystem vcs = systems [repCombo.Active]; repo = vcs.CreateRepositoryInstance (); currentEditor = vcs.CreateRepositoryEditor (repo); repoContainer.Add (currentEditor.Widget); |