Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/Issue5109_Consolidate_copy_comma…
…nd_logic' into nextIntoIssue5109
- Loading branch information
Showing
19 changed files
with
295 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Rubberduck.Common; | ||
using Rubberduck.Parsing.Symbols; | ||
using Rubberduck.Resources; | ||
|
||
namespace Rubberduck.Formatters | ||
{ | ||
public class DeclarationFormatter : IExportable | ||
{ | ||
private readonly Declaration _declaration; | ||
|
||
public DeclarationFormatter(Declaration declaration) | ||
{ | ||
_declaration = declaration; | ||
} | ||
|
||
public object[] ToArray() | ||
{ | ||
return _declaration.ToArray(); | ||
} | ||
|
||
public string ToClipboardString() | ||
{ | ||
return string.Format(RubberduckUI.CodeExplorer_IExportable_DeclarationFormat, | ||
_declaration.Project.Name, | ||
_declaration.CustomFolder, | ||
_declaration.ComponentName, | ||
_declaration.DeclarationType, | ||
_declaration.Scope, | ||
_declaration.IdentifierName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Rubberduck.Common; | ||
using Rubberduck.Parsing.Inspections.Abstract; | ||
using Rubberduck.Inspections.Abstract; | ||
using System.IO; | ||
using Rubberduck.Resources.Inspections; | ||
|
||
namespace Rubberduck.Formatters | ||
{ | ||
public class InspectionResultFormatter : IExportable | ||
{ | ||
private readonly IInspectionResult _inspectionResult; | ||
|
||
public InspectionResultFormatter(IInspectionResult inspectionResult) | ||
{ | ||
_inspectionResult = inspectionResult; | ||
} | ||
|
||
public object[] ToArray() | ||
{ | ||
var module = _inspectionResult.QualifiedSelection.QualifiedName; | ||
return new object[] | ||
{ | ||
_inspectionResult.Inspection.Severity.ToString(), | ||
module.ProjectName, | ||
module.ComponentName, | ||
_inspectionResult.Description, | ||
_inspectionResult.QualifiedSelection.Selection.StartLine, | ||
_inspectionResult.QualifiedSelection.Selection.StartColumn | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// WARNING: This property can have side effects. It can change the ActiveVBProject if the result has a null Declaration, | ||
/// which causes a flicker in the VBE. This should only be called if it is *absolutely* necessary. | ||
/// </summary> | ||
public string ToClipboardString() | ||
{ | ||
var module = _inspectionResult.QualifiedSelection.QualifiedName; | ||
var documentName = _inspectionResult.Target != null | ||
? _inspectionResult.Target.ProjectDisplayName | ||
: string.Empty; | ||
|
||
//todo: Find a sane way to reimplement this. | ||
//if (string.IsNullOrEmpty(documentName)) | ||
//{ | ||
// var component = module.Component; | ||
// documentName = component != null | ||
// ? component.ParentProject.ProjectDisplayName | ||
// : string.Empty; | ||
//} | ||
|
||
if (string.IsNullOrEmpty(documentName)) | ||
{ | ||
documentName = Path.GetFileName(module.ProjectPath); | ||
} | ||
|
||
return string.Format( | ||
InspectionsUI.QualifiedSelectionInspection, | ||
_inspectionResult.Inspection.Severity, | ||
_inspectionResult.Description, | ||
$"({documentName})", | ||
module.ProjectName, | ||
module.ComponentName, | ||
_inspectionResult.QualifiedSelection.Selection.StartLine); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Rubberduck.Core/Formatters/TestMethodViewModelFormatter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Rubberduck.UI.UnitTesting.ViewModels; | ||
using Rubberduck.Common; | ||
|
||
namespace Rubberduck.Formatters | ||
{ | ||
public class TestMethodViewModelFormatter : IExportable | ||
{ | ||
private readonly TestMethodViewModel _testMethodViewModel; | ||
|
||
public TestMethodViewModelFormatter(TestMethodViewModel testMethodViewModel) | ||
{ | ||
_testMethodViewModel = testMethodViewModel; | ||
} | ||
|
||
public object[] ToArray() | ||
{ | ||
return _testMethodViewModel.ToArray(); | ||
} | ||
|
||
public string ToClipboardString() | ||
{ | ||
return _testMethodViewModel.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Rubberduck.ToDoItems; | ||
using Rubberduck.Common; | ||
using Rubberduck.Resources; | ||
|
||
namespace Rubberduck.Formatters | ||
{ | ||
public class ToDoItemFormatter : IExportable | ||
{ | ||
private readonly ToDoItem _toDoItem; | ||
|
||
public ToDoItemFormatter(ToDoItem toDoItem) | ||
{ | ||
_toDoItem = toDoItem; | ||
} | ||
|
||
public object[] ToArray() | ||
{ | ||
var module = _toDoItem.Selection.QualifiedName; | ||
return new object[] { _toDoItem.Type, _toDoItem.Description, module.ProjectName, module.ComponentName, _toDoItem.Selection.Selection.StartLine, _toDoItem.Selection.Selection.StartColumn }; | ||
} | ||
|
||
public string ToClipboardString() | ||
{ | ||
var module = _toDoItem.Selection.QualifiedName; | ||
return string.Format(RubberduckUI.ToDoExplorerToDoItemFormat, | ||
_toDoItem.Type, | ||
_toDoItem.Description, | ||
module.ProjectName, | ||
module.ComponentName, | ||
_toDoItem.Selection.Selection.StartLine); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.