diff options
author | Therzok <teromario@yahoo.com> | 2013-08-20 22:26:13 +0400 |
---|---|---|
committer | Therzok <teromario@yahoo.com> | 2013-08-20 22:26:13 +0400 |
commit | 3477113fc4c9576980d10471948da33e7afe66fb (patch) | |
tree | be1af6b83169646f050d0cdd5b64df5ef3da64aa /main/src/addins/VersionControl/MonoDevelop.VersionControl | |
parent | 06171035180442c81ad5f1b603d90985a5ba7ae7 (diff) |
[Version Control Cleanup in Dialog and Views folders.
Remove redundant usings.
Add StringComparison argument.
Removed some redundant qualifiers from definitions.
Made some functions static. =D
Diffstat (limited to 'main/src/addins/VersionControl/MonoDevelop.VersionControl')
18 files changed, 63 insertions, 98 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs index c7e66e0ff0..cc3873574b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitMessageStylePanelWidget.cs @@ -26,7 +26,6 @@ // using System; -using MonoDevelop.Ide.Gui; using MonoDevelop.Ide; using MonoDevelop.Projects; @@ -121,14 +120,14 @@ namespace MonoDevelop.VersionControl OnChanged (); } - string FromCString (string txt) + static string FromCString (string txt) { - return txt.Replace ("\\t","\t").Replace ("\\n","\n"); + return txt.Replace ("\\t", "\t").Replace ("\\n", "\n"); } - string ToCString (string txt) + static string ToCString (string txt) { - return txt.Replace ("\t","\\t").Replace ("\n","\\n"); + return txt.Replace ("\t", "\\t").Replace ("\n", "\\n"); } void UpdateBullets () 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 b62c1befc4..79aeca9679 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 @@ -272,7 +272,7 @@ namespace MonoDevelop.VersionControl.Dialogs Gtk.Application.Invoke (delegate { if (ex != null) { store.AppendValues (piter, null, "ERROR: " + ex.Message, "", true); - MonoDevelop.Core.LoggingService.LogError (ex.ToString ()); + LoggingService.LogError (ex.ToString ()); } else { foreach (Repository rep in repos) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs index c54e557ee7..aeb604d3e7 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/VersionControlPolicyPanel.cs @@ -27,9 +27,7 @@ using Gtk; using MonoDevelop.Core; -using MonoDevelop.Ide.Gui; using MonoDevelop.Ide.Gui.Dialogs; -using MonoDevelop.Ide; using MonoDevelop.Projects; namespace MonoDevelop.VersionControl diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs index 656a2f2ab3..ee6571fb78 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameView.cs @@ -25,11 +25,9 @@ // THE SOFTWARE. using System; using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide; using MonoDevelop.Core; using MonoDevelop.Ide.Gui.Content; using Mono.TextEditor; -using System.Linq; namespace MonoDevelop.VersionControl.Views { public interface IBlameView : IAttachableViewContent diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs index 41162f841c..c8e5c0cfd0 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/BlameWidget.cs @@ -33,7 +33,6 @@ using Mono.TextEditor; using MonoDevelop.Ide; using System.Threading; using MonoDevelop.Core; -using System.Text.RegularExpressions; using System.Text; using MonoDevelop.Components.Commands; @@ -384,7 +383,7 @@ namespace MonoDevelop.VersionControl.Views this.widget = widget; widget.info.Updated += delegate { QueueDraw (); }; annotations = new List<Annotation> (); - UpdateAnnotations (null, null); + UpdateAnnotations (); // widget.Document.Saved += UpdateAnnotations; document = widget.Editor.Document; document.TextReplacing += EditorDocumentTextReplacing; @@ -545,7 +544,7 @@ namespace MonoDevelop.VersionControl.Views /// <summary> /// Reloads annotations for the current document /// </summary> - internal void UpdateAnnotations (object sender, EventArgs e) + internal void UpdateAnnotations () { StatusBarContext ctx = IdeApp.Workbench.StatusBar.CreateContext (); ctx.AutoPulse = true; @@ -614,7 +613,7 @@ namespace MonoDevelop.VersionControl.Views } } else if (startLine > endLine) { // revert - UpdateAnnotations (null, null); + UpdateAnnotations (); return; } @@ -673,7 +672,7 @@ namespace MonoDevelop.VersionControl.Views string truncated = revision.Substring (0, initalLength); var history = widget.info.History; if (history != null) { - bool isMisleadingMatch = history.Select (r => r.ToString ()).Any (rev => rev != revision && rev.StartsWith (truncated)); + bool isMisleadingMatch = history.Select (r => r.ToString ()).Any (rev => rev != revision && rev.StartsWith (truncated, StringComparison.Ordinal)); if (isMisleadingMatch) truncated = TruncRevision (revision, initalLength + 1); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs index 5c8bc56c46..9543398df7 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs @@ -111,11 +111,11 @@ namespace MonoDevelop.VersionControl.Views return layout; } - string ProcessLine (string line) + static string ProcessLine (string line) { if (line == null) return null; - return line.Replace ("\t"," "); + return line.Replace ("\t", " "); } const int leftSpace = 16; @@ -182,7 +182,8 @@ namespace MonoDevelop.VersionControl.Views char tag = line [0]; - if (line.StartsWith ("---") || line.StartsWith ("+++")) { + if (line.StartsWith ("---", StringComparison.Ordinal) || + line.StartsWith ("+++", StringComparison.Ordinal)) { // Ignore this part of the header. currentBlock = null; y -= lineHeight; @@ -325,7 +326,7 @@ namespace MonoDevelop.VersionControl.Views } } - bool IsChangeBlock (BlockType t) + static bool IsChangeBlock (BlockType t) { return t == BlockType.Added || t == BlockType.Removed; } @@ -516,7 +517,7 @@ namespace MonoDevelop.VersionControl.Views } } - StateType GetState (Gtk.Widget widget, CellRendererState flags) + static StateType GetState (Gtk.Widget widget, CellRendererState flags) { if ((flags & CellRendererState.Selected) != 0) return widget.HasFocus ? StateType.Selected : StateType.Active; @@ -524,7 +525,7 @@ namespace MonoDevelop.VersionControl.Views return StateType.Normal; } - int ParseCurrentLine (string line) + static int ParseCurrentLine (string line) { int i = line.IndexOf ('+'); if (i == -1) return -1; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ChangeSetView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ChangeSetView.cs index 2a259cb3f5..4b97aed600 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ChangeSetView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ChangeSetView.cs @@ -1,17 +1,11 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Threading; -using Mono.Addins; using Gtk; using MonoDevelop.Core; -using MonoDevelop.Components.Commands; -using MonoDevelop.Projects; using MonoDevelop.Ide.Gui.Components; using MonoDevelop.Ide; -using MonoDevelop.Ide.Gui; namespace MonoDevelop.VersionControl.Views { @@ -271,12 +265,12 @@ namespace MonoDevelop.VersionControl.Views void OnRowActivated (object o, RowActivatedArgs args) { - OnOpen (null, null); + OnOpen (); } void OnDiffLineActivated (object o, EventArgs a) { - OnOpen (null, null); + OnOpen (); } private void OnTestExpandRow (object sender, Gtk.TestExpandRowArgs args) @@ -291,7 +285,7 @@ namespace MonoDevelop.VersionControl.Views } } - void OnOpen (object s, EventArgs args) + void OnOpen () { string[] files = GetCurrentFiles (); if (files.Length == 0) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs index a9f9bf7307..7d7c006e96 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs @@ -26,7 +26,6 @@ // THE SOFTWARE. using System; -using System.Linq; using Gtk; using Gdk; using System.Collections.Generic; @@ -70,8 +69,8 @@ namespace MonoDevelop.VersionControl.Views protected override void CreateComponents () { this.editors = new [] { - new TextEditor (new Mono.TextEditor.TextDocument (), new CommonTextEditorOptions ()), - new TextEditor (new Mono.TextEditor.TextDocument (), new CommonTextEditorOptions ()), + new TextEditor (new TextDocument (), new CommonTextEditorOptions ()), + new TextEditor (new TextDocument (), new CommonTextEditorOptions ()), }; if (!viewOnly) { diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffParser.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffParser.cs index bb05a35d32..9d92426ff6 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffParser.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffParser.cs @@ -28,7 +28,6 @@ using System; using System.IO; using System.Text.RegularExpressions; -using MonoDevelop.Core; using MonoDevelop.Ide.TypeSystem; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem.Implementation; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs index 027674c179..4d3521553b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs @@ -24,16 +24,10 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; -using System.Linq; -using System.IO; -using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; using System.Collections.Generic; -using System.Threading; using MonoDevelop.Core; using MonoDevelop.Ide.Gui.Content; -using Mono.Addins; -using MonoDevelop.Projects.Text; namespace MonoDevelop.VersionControl.Views { diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs index c51f6eff76..7e811045f6 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffWidget.cs @@ -24,7 +24,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; -using System.Linq; using MonoDevelop.Core; using MonoDevelop.Ide.Gui; @@ -35,7 +34,7 @@ namespace MonoDevelop.VersionControl.Views { VersionControlDocumentInfo info; Mono.TextEditor.TextEditor diffTextEditor; - MonoDevelop.VersionControl.Views.ComparisonWidget comparisonWidget; + ComparisonWidget comparisonWidget; Gtk.Button buttonNext; Gtk.Button buttonPrev; Gtk.Button buttonDiff; @@ -78,7 +77,7 @@ namespace MonoDevelop.VersionControl.Views { this.info = info; this.Build (); - comparisonWidget = new MonoDevelop.VersionControl.Views.ComparisonWidget (viewOnly); + comparisonWidget = new ComparisonWidget (viewOnly); buttonNext = new DocumentToolButton (Gtk.Stock.GoUp, GettextCatalog.GetString ("Previous Change")); buttonPrev = new DocumentToolButton (Gtk.Stock.GoDown, GettextCatalog.GetString ("Next Change")); labelOverview = new Gtk.Label () { Xalign = 0 }; @@ -148,7 +147,7 @@ namespace MonoDevelop.VersionControl.Views } } - string GetRevisionText (Mono.TextEditor.TextEditor editor, Revision rev) + static string GetRevisionText (Mono.TextEditor.TextEditor editor, Revision rev) { if (!editor.Document.ReadOnly) return GettextCatalog.GetString ("(working copy)"); diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs index 46ae372d4e..42e827a26b 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs @@ -33,12 +33,8 @@ using System.Collections.Generic; using Mono.TextEditor; using Mono.TextEditor.Utils; using MonoDevelop.Ide; -using MonoDevelop.Components; -using System.ComponentModel; using MonoDevelop.Core; -using System.Globalization; using MonoDevelop.Components.Commands; -using MonoDevelop.Ide.Gui.Content; using MonoDevelop.Projects.Text; namespace MonoDevelop.VersionControl.Views @@ -273,7 +269,7 @@ namespace MonoDevelop.VersionControl.Views return rectangles; } - Dictionary<List<Mono.TextEditor.Utils.Hunk>, Dictionary<Hunk, Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>>>> diffCache = new Dictionary<List<Mono.TextEditor.Utils.Hunk>, Dictionary<Hunk, Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>>>> (); + Dictionary<List<Hunk>, Dictionary<Hunk, Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>>>> diffCache = new Dictionary<List<Hunk>, Dictionary<Hunk, Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>>>> (); protected void ClearDiffCache () { @@ -285,7 +281,7 @@ namespace MonoDevelop.VersionControl.Views return TextBreaker.BreakLinesIntoWords(editor, start, count); } - List<Cairo.Rectangle> CalculateChunkPath (TextEditor editor, List<Hunk> diff, List<TextSegment> words, bool useRemove) + static List<Cairo.Rectangle> CalculateChunkPath (TextEditor editor, List<Hunk> diff, List<TextSegment> words, bool useRemove) { List<Cairo.Rectangle> result = new List<Cairo.Rectangle> (); int startOffset = -1; @@ -308,7 +304,7 @@ namespace MonoDevelop.VersionControl.Views return result; } - Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>> GetDiffPaths (List<Mono.TextEditor.Utils.Hunk> diff, TextEditor editor, Hunk hunk) + Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>> GetDiffPaths (List<Hunk> diff, TextEditor editor, Hunk hunk) { if (!diffCache.ContainsKey (diff)) diffCache[diff] = new Dictionary<Hunk, Tuple<List<Cairo.Rectangle>, List<Cairo.Rectangle>>> (); @@ -523,7 +519,7 @@ namespace MonoDevelop.VersionControl.Views children.ForEach (child => child.Child.SizeRequest ()); } - public static Cairo.Color GetColor (Mono.TextEditor.Utils.Hunk hunk, bool removeSide, bool dark, double alpha) + public static Cairo.Color GetColor (Hunk hunk, bool removeSide, bool dark, double alpha) { Cairo.Color result; if (hunk.Removed > 0 && hunk.Inserted > 0) { @@ -545,7 +541,7 @@ namespace MonoDevelop.VersionControl.Views return result; } - void PaintEditorOverlay (TextArea editor, PaintEventArgs args, List<Mono.TextEditor.Utils.Hunk> diff, bool paintRemoveSide) + void PaintEditorOverlay (TextArea editor, PaintEventArgs args, List<Hunk> diff, bool paintRemoveSide) { if (diff == null) return; @@ -673,7 +669,7 @@ namespace MonoDevelop.VersionControl.Views TextEditor fromEditor, toEditor; bool useLeft; - IEnumerable<Mono.TextEditor.Utils.Hunk> Diff { + IEnumerable<Hunk> Diff { get { return useLeft ? widget.LeftDiff : widget.RightDiff; } @@ -700,11 +696,11 @@ namespace MonoDevelop.VersionControl.Views QueueDraw (); } - Mono.TextEditor.Utils.Hunk selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; + Hunk selectedHunk = Hunk.Empty; protected override bool OnMotionNotifyEvent (EventMotion evnt) { bool hideButton = widget.MainEditor.Document.ReadOnly; - Mono.TextEditor.Utils.Hunk selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; + Hunk selectedHunk = Hunk.Empty; if (!hideButton) { int delta = widget.MainEditor.Allocation.Y - Allocation.Y; if (Diff != null) { @@ -731,7 +727,7 @@ namespace MonoDevelop.VersionControl.Views } } } else { - selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; + selectedHunk = Hunk.Empty; } if (selectedHunk.IsEmpty) @@ -755,7 +751,7 @@ namespace MonoDevelop.VersionControl.Views protected override bool OnLeaveNotifyEvent (EventCrossing evnt) { - selectedHunk = Mono.TextEditor.Utils.Hunk.Empty; + selectedHunk = Hunk.Empty; TooltipText = null; QueueDraw (); return base.OnLeaveNotifyEvent (evnt); @@ -763,7 +759,7 @@ namespace MonoDevelop.VersionControl.Views const int buttonSize = 16; - public bool GetButtonPosition (Mono.TextEditor.Utils.Hunk hunk, double y1, double y2, double z1, double z2, out double x, out double y, out double w, out double h) + public bool GetButtonPosition (Hunk hunk, double y1, double y2, double z1, double z2, out double x, out double y, out double w, out double h) { if (hunk.Removed > 0) { var b1 = z1; @@ -813,7 +809,7 @@ namespace MonoDevelop.VersionControl.Views cr.Clip (); int delta = widget.MainEditor.Allocation.Y - Allocation.Y; if (Diff != null) { - foreach (Mono.TextEditor.Utils.Hunk hunk in Diff) { + foreach (Hunk hunk in Diff) { double z1 = delta + fromEditor.LineToY (hunk.RemoveStart) - fromEditor.VAdjustment.Value; double z2 = delta + fromEditor.LineToY (hunk.RemoveStart + hunk.Removed) - fromEditor.VAdjustment.Value; if (z1 == z2) @@ -890,7 +886,7 @@ namespace MonoDevelop.VersionControl.Views // mx -= (int)x; // my -= (int)y; using (var gradient = new Cairo.RadialGradient (mx, my, h, mx, my, 2)) { - var color = (Mono.TextEditor.HslColor)Style.Mid (StateType.Normal); + var color = (HslColor)Style.Mid (StateType.Normal); color.L *= 1.05; gradient.AddColorStop (0, color); color.L *= 1.07; @@ -898,11 +894,11 @@ namespace MonoDevelop.VersionControl.Views cr.SetSource (gradient); } } else { - cr.SetSourceColor ((Mono.TextEditor.HslColor)Style.Mid (StateType.Normal)); + cr.SetSourceColor ((HslColor)Style.Mid (StateType.Normal)); } cr.FillPreserve (); - cr.SetSourceColor ((Mono.TextEditor.HslColor)Style.Dark (StateType.Normal)); + cr.SetSourceColor ((HslColor)Style.Dark (StateType.Normal)); cr.Stroke (); cr.LineWidth = 1; cr.SetSourceRGB (0, 0, 0); @@ -1040,7 +1036,7 @@ namespace MonoDevelop.VersionControl.Views DrawBar (cr, barY, barH); cr.Rectangle (0.5, 0.5, Allocation.Width - 1, Allocation.Height - 1); - cr.SetSourceColor ((Mono.TextEditor.HslColor)Style.Dark (StateType.Normal)); + cr.SetSourceColor ((HslColor)Style.Dark (StateType.Normal)); cr.Stroke (); } return true; @@ -1050,10 +1046,10 @@ namespace MonoDevelop.VersionControl.Views { cr.Rectangle (0.5, y, Allocation.Width, h); using (var grad = new Cairo.LinearGradient (0, y, Allocation.Width, y)) { - var col = (Mono.TextEditor.HslColor)Style.Base (StateType.Normal); + var col = (HslColor)Style.Base (StateType.Normal); col.L *= 0.95; grad.AddColorStop (0, col); - grad.AddColorStop (0.7, (Mono.TextEditor.HslColor)Style.Base (StateType.Normal)); + grad.AddColorStop (0.7, (HslColor)Style.Base (StateType.Normal)); grad.AddColorStop (1, col); cr.SetSource (grad); cr.Fill (); @@ -1072,7 +1068,7 @@ namespace MonoDevelop.VersionControl.Views h, barWidth / 2); - var color = (Mono.TextEditor.HslColor)Style.Mid (StateType.Normal); + var color = (HslColor)Style.Mid (StateType.Normal); color.L = 0.5; var c = (Cairo.Color)color; c.A = 0.6; @@ -1080,7 +1076,7 @@ namespace MonoDevelop.VersionControl.Views cr.Fill (); } - void IncPos(Mono.TextEditor.Utils.Hunk h, ref int pos) + static void IncPos (Hunk h, ref int pos) { pos += System.Math.Max (h.Inserted, h.Removed); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs index aa7a933ca8..f3000a4c36 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs @@ -25,7 +25,6 @@ // THE SOFTWARE. using System; -using System.IO; using Gtk; using MonoDevelop.Core; using MonoDevelop.Ide.Gui; @@ -39,7 +38,7 @@ namespace MonoDevelop.VersionControl.Views [System.ComponentModel.ToolboxItem(true)] public partial class LogWidget : Gtk.Bin { - MonoDevelop.VersionControl.Revision[] history; + Revision[] history; public Revision[] History { get { return history; @@ -510,8 +509,8 @@ namespace MonoDevelop.VersionControl.Views string author = rev.Author; if (string.IsNullOrEmpty (author)) return; - int idx = author.IndexOf ("<"); - if (idx >= 0 && idx < author.IndexOf (">")) + int idx = author.IndexOf ("<", StringComparison.Ordinal); + if (idx >= 0 && idx < author.IndexOf (">", StringComparison.Ordinal)) author = author.Substring (0, idx).Trim (); if (string.IsNullOrEmpty (currentFilter)) renderer.Text = author; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs index b6242cb062..609d6727cd 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeView.cs @@ -23,9 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide; using MonoDevelop.Core; namespace MonoDevelop.VersionControl.Views diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs index 1d4377df66..6f0acb0286 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs @@ -27,13 +27,10 @@ using System; using System.Linq; using Gtk; -using Gdk; using System.Collections.Generic; using Mono.TextEditor; using Mono.TextEditor.Utils; using MonoDevelop.Ide; -using MonoDevelop.Components; -using System.ComponentModel; using MonoDevelop.Core; using MonoDevelop.Ide.Gui; @@ -82,7 +79,7 @@ namespace MonoDevelop.VersionControl.Views public void Load (string fileName) { MainEditor.Document.MimeType = DesktopService.GetMimeTypeForUri (fileName); - MainEditor.Document.Text = Mono.TextEditor.Utils.TextFileUtility.ReadAllText (fileName); + MainEditor.Document.Text = TextFileUtility.ReadAllText (fileName); this.CreateDiff (); Show (); @@ -103,9 +100,9 @@ namespace MonoDevelop.VersionControl.Views protected override void CreateComponents () { this.editors = new [] { - new TextEditor (new Mono.TextEditor.TextDocument (), new CommonTextEditorOptions ()), - new TextEditor (new Mono.TextEditor.TextDocument (), new CommonTextEditorOptions ()), - new TextEditor (new Mono.TextEditor.TextDocument (), new CommonTextEditorOptions ()), + new TextEditor (new TextDocument (), new CommonTextEditorOptions ()), + new TextEditor (new TextDocument (), new CommonTextEditorOptions ()), + new TextEditor (new TextDocument (), new CommonTextEditorOptions ()), }; this.editors[0].Document.ReadOnly = true; @@ -119,7 +116,7 @@ namespace MonoDevelop.VersionControl.Views } // todo: move to version control backend - IEnumerable<Conflict> Conflicts (Mono.TextEditor.TextDocument doc) + static IEnumerable<Conflict> Conflicts (TextDocument doc) { int mergeStart = 0; while ((mergeStart = doc.IndexOf ("<<<<<<<", mergeStart, doc.TextLength - mergeStart, StringComparison.Ordinal)) >= 0) { @@ -161,13 +158,13 @@ namespace MonoDevelop.VersionControl.Views } List<Conflict> currentConflicts = new List<Conflict> (); - List<Mono.TextEditor.Utils.Hunk> leftConflicts = new List<Mono.TextEditor.Utils.Hunk> (); - List<Mono.TextEditor.Utils.Hunk> rightConflicts = new List<Mono.TextEditor.Utils.Hunk> (); + List<Hunk> leftConflicts = new List<Hunk> (); + List<Hunk> rightConflicts = new List<Hunk> (); public override void UpdateDiff () { - LeftDiff = new List<Mono.TextEditor.Utils.Hunk> (editors[0].Document.Diff (MainEditor.Document)); - RightDiff = new List<Mono.TextEditor.Utils.Hunk> (editors[2].Document.Diff (MainEditor.Document)); + LeftDiff = new List<Hunk> (editors[0].Document.Diff (MainEditor.Document)); + RightDiff = new List<Hunk> (editors[2].Document.Diff (MainEditor.Document)); DocumentLine line; LeftDiff.RemoveAll (item => null != (line = MainEditor.Document.GetLine (item.InsertStart)) && @@ -185,8 +182,8 @@ namespace MonoDevelop.VersionControl.Views int middleA = MainEditor.Document.OffsetToLineNumber (curConflict.StartSegment.Offset); int middleB = MainEditor.Document.OffsetToLineNumber (curConflict.EndSegment.Offset) + 1; - LeftDiff.Add (new Mono.TextEditor.Utils.Hunk (left.RemoveStart, middleA, left.Removed, middleB - middleA)); - RightDiff.Add (new Mono.TextEditor.Utils.Hunk (right.RemoveStart, middleA, right.Removed, middleB - middleA)); + LeftDiff.Add (new Hunk (left.RemoveStart, middleA, left.Removed, middleB - middleA)); + RightDiff.Add (new Hunk (right.RemoveStart, middleA, right.Removed, middleB - middleA)); } base.UpdateDiff (); QueueDraw (); @@ -218,8 +215,8 @@ namespace MonoDevelop.VersionControl.Views int middleA = MainEditor.Document.OffsetToLineNumber (conflict.StartSegment.Offset); int middleB = MainEditor.Document.OffsetToLineNumber (conflict.EndSegment.EndOffset); - leftConflicts.Add (new Mono.TextEditor.Utils.Hunk (leftA, middleA, leftB - leftA, middleB - middleA)); - rightConflicts.Add (new Mono.TextEditor.Utils.Hunk (rightA, middleA, rightB - rightA, middleB - middleA)); + leftConflicts.Add (new Hunk (leftA, middleA, leftB - leftA, middleB - middleA)); + rightConflicts.Add (new Hunk (rightA, middleA, rightB - rightA, middleB - middleA)); } int endOffset = 0; if (currentConflicts.Count > 0) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs index 376084913a..f65ef10d28 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs @@ -661,7 +661,7 @@ namespace MonoDevelop.VersionControl.Views UpdateSelectionStatus (); } - string GetCommitMessage (string file) + static string GetCommitMessage (string file) { string txt = VersionControlService.GetCommitComment (file); return txt ?? String.Empty; @@ -989,7 +989,7 @@ namespace MonoDevelop.VersionControl.Views return true; } - bool FileVisible (VersionInfo vinfo) + static bool FileVisible (VersionInfo vinfo) { return vinfo != null && (vinfo.HasLocalChanges || vinfo.HasRemoteChanges); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs index d9f241464a..b311c05a05 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/SubviewAttachmentHandler.cs @@ -69,7 +69,7 @@ namespace MonoDevelop.VersionControl.Views } } - void TryAttachView <T>(Document document, VersionControlDocumentInfo info, string type) + static void TryAttachView <T>(Document document, VersionControlDocumentInfo info, string type) where T : IAttachableViewContent { var handler = AddinManager.GetExtensionObjects<IVersionControlViewHandler<T>> (type) diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs index ee6dcbd4cd..3d4d448009 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/VersionControlDocumentInfo.cs @@ -25,15 +25,10 @@ // THE SOFTWARE. using System; -using System.Linq; -using System.IO; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; -using System.Collections.Generic; using System.Threading; using MonoDevelop.Core; -using MonoDevelop.Ide.Gui.Content; -using Mono.Addins; namespace MonoDevelop.VersionControl.Views { |