Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 23cd513

Browse files
committed
Refactor EnvDTE.EditPoint and add tests.
1 parent db9951a commit 23cd513

10 files changed

Lines changed: 180 additions & 279 deletions

File tree

src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<Compile Include="Src\Design\FakeProjectBuilder.cs" />
9090
<Compile Include="Src\Design\FakeSelectedProject.cs" />
9191
<Compile Include="Src\DocumentLoader.cs" />
92-
<Compile Include="Src\DomRegionExtensions.cs" />
92+
<Compile Include="Src\DocumentView.cs" />
9393
<Compile Include="Src\EnvDTE\CodeAttribute.cs" />
9494
<Compile Include="Src\EnvDTE\CodeAttribute2.cs" />
9595
<Compile Include="Src\EnvDTE\CodeAttributeArgument.cs" />
@@ -151,6 +151,7 @@
151151
</Compile>
152152
<Compile Include="Src\FileConflictViewModel.cs" />
153153
<Compile Include="Src\ICodeGenerator.cs" />
154+
<Compile Include="Src\IDocumentView.cs" />
154155
<Compile Include="Src\IPackageRepositoryFactoryEvents.cs" />
155156
<Compile Include="Src\IPackageViewModelParent.cs" />
156157
<Compile Include="Src\IUpdatePackagesAction.cs" />
@@ -161,10 +162,8 @@
161162
<Compile Include="Src\IUpdatePackageSettings.cs" />
162163
<Compile Include="Src\IVirtualMethodUpdater.cs" />
163164
<Compile Include="Src\IProjectBrowserUpdater.cs" />
164-
<Compile Include="Src\IRefactoringDocumentView.cs" />
165165
<Compile Include="Src\IFieldExtensions.cs" />
166166
<Compile Include="Src\IDocumentLoader.cs" />
167-
<Compile Include="Src\IMethodOrPropertyExtensions.cs" />
168167
<Compile Include="Src\InstalledPackageViewModel.cs" />
169168
<Compile Include="Src\InstalledPackageViewModelFactory.cs" />
170169
<Compile Include="Src\IPackageManagementSelectedProject.cs" />
@@ -292,7 +291,6 @@
292291
<Compile Include="Src\ProjectBrowserUpdater.cs" />
293292
<Compile Include="Src\ProjectTemplatePackageRepositoryCache.cs" />
294293
<Compile Include="Src\ProjectTemplatePackagesSettingsFileName.cs" />
295-
<Compile Include="Src\RefactoringDocumentView.cs" />
296294
<Compile Include="Src\RegisteredPackageRepositories.cs" />
297295
<Compile Include="Src\ManagePackagesView.cs">
298296
<DependentUpon>ManagePackagesView.xaml</DependentUpon>

src/AddIns/Misc/PackageManagement/Project/Src/DocumentLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ namespace ICSharpCode.PackageManagement
2323
{
2424
public class DocumentLoader : IDocumentLoader
2525
{
26-
public IRefactoringDocumentView LoadRefactoringDocumentView(string fileName)
26+
public IDocumentView LoadDocumentView(string fileName)
2727
{
2828
return SD.MainThread.InvokeIfRequired(() => {
29-
return new RefactoringDocumentView(fileName);
29+
return new DocumentView(fileName);
3030
});
3131
}
3232
}

src/AddIns/Misc/PackageManagement/Project/Src/RefactoringDocumentView.cs renamed to src/AddIns/Misc/PackageManagement/Project/Src/DocumentView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
namespace ICSharpCode.PackageManagement
2525
{
26-
public class RefactoringDocumentView : IRefactoringDocumentView
26+
public class DocumentView : IDocumentView
2727
{
28-
public RefactoringDocumentView(string fileName)
28+
public DocumentView(string fileName)
2929
{
3030
View = FileService.OpenFile(fileName);
3131
TextEditor = GetTextEditor();
3232
FormattingStrategy = TextEditor.Language.FormattingStrategy;
33-
RefactoringDocument = LoadDocument();
33+
Document = LoadDocument();
3434
}
3535

3636
IViewContent View { get; set; }
@@ -42,7 +42,7 @@ ITextEditor GetTextEditor()
4242
return View.GetService<ITextEditor>();
4343
}
4444

45-
public IDocument RefactoringDocument { get; private set; }
45+
public IDocument Document { get; private set; }
4646

4747
IDocument LoadDocument()
4848
{

src/AddIns/Misc/PackageManagement/Project/Src/DomRegionExtensions.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/EditPoint.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace ICSharpCode.PackageManagement.EnvDTE
2626
public class EditPoint : TextPoint, global::EnvDTE.EditPoint
2727
{
2828
IDocument document;
29-
IRefactoringDocumentView documentView;
29+
IDocumentView documentView;
3030

3131
internal EditPoint(string fileName, TextLocation location, IDocumentLoader documentLoader)
3232
: base(fileName, location, documentLoader)
@@ -49,8 +49,8 @@ void ReplaceText(TextPoint endPoint, string text, global::EnvDTE.vsEPReplaceText
4949

5050
void OpenDocument()
5151
{
52-
documentView = documentLoader.LoadRefactoringDocumentView(fileName);
53-
document = documentView.RefactoringDocument;
52+
documentView = documentLoader.LoadDocumentView(fileName);
53+
document = documentView.Document;
5454
}
5555

5656
int GetStartOffset()

src/AddIns/Misc/PackageManagement/Project/Src/EnvDTE/TextPoint.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System;
2020
using ICSharpCode.NRefactory;
2121
using ICSharpCode.NRefactory.TypeSystem;
22-
using ICSharpCode.SharpDevelop.Dom;
2322

2423
namespace ICSharpCode.PackageManagement.EnvDTE
2524
{

src/AddIns/Misc/PackageManagement/Project/Src/IDocumentLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ namespace ICSharpCode.PackageManagement
2222
{
2323
public interface IDocumentLoader
2424
{
25-
IRefactoringDocumentView LoadRefactoringDocumentView(string fileName);
25+
IDocumentView LoadDocumentView(string fileName);
2626
}
2727
}

src/AddIns/Misc/PackageManagement/Project/Src/IRefactoringDocumentView.cs renamed to src/AddIns/Misc/PackageManagement/Project/Src/IDocumentView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121

2222
namespace ICSharpCode.PackageManagement
2323
{
24-
public interface IRefactoringDocumentView
24+
public interface IDocumentView
2525
{
26-
IDocument RefactoringDocument { get; }
26+
IDocument Document { get; }
2727
void IndentLines(int beginLine, int endLine);
2828
}
2929
}

src/AddIns/Misc/PackageManagement/Project/Src/IMethodOrPropertyExtensions.cs

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)