Skip to content

Commit 3a74f8d

Browse files
committed
Restore modified UI accessors
Restored EncapsulateFieldModel and IObjectStateUDT accessors used by the UI to keep all changes for this PR within the RefactoringActions.
1 parent dd5f544 commit 3a74f8d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Rubberduck.Core/UI/Refactorings/EncapsulateField/EncapsulateFieldViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public bool ConvertFieldsToUDTMembers
198198
private bool _selectionHasValidEncapsulationAttributes;
199199
public bool SelectionHasValidEncapsulationAttributes => _selectionHasValidEncapsulationAttributes;
200200

201-
public string PropertiesPreview => Model.PreviewProvider?.Preview(Model) ?? string.Empty;
201+
public string PropertiesPreview => Model.PreviewRefactoring();
202202

203203
public CommandBase SelectAllCommand { get; }
204204

Rubberduck.Refactorings/EncapsulateField/EncapsulateFieldModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public EncapsulateFieldModel(EncapsulateFieldUseBackingFieldModel backingFieldMo
2929

3030
public EncapsulateFieldUseBackingFieldModel EncapsulateFieldUseBackingFieldModel { get; }
3131

32+
public string PreviewRefactoring() => PreviewProvider?.Preview(this) ?? string.Empty;
33+
3234
public IRefactoringPreviewProvider<EncapsulateFieldModel> PreviewProvider { set; get; }
3335

3436
public Action<EncapsulateFieldModel> StrategyChangedAction { set; get; } = (m) => { };

Rubberduck.Refactorings/EncapsulateField/ObjectStateUDT/ObjectStateUDT.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Linq;
7+
using Rubberduck.Parsing.Grammar;
78

89
namespace Rubberduck.Refactorings.EncapsulateField
910
{
@@ -12,6 +13,7 @@ public interface IObjectStateUDT : IEncapsulateFieldRefactoringElement
1213
Declaration Declaration { get; }
1314
string TypeIdentifier { set; get; }
1415
string FieldIdentifier { set; get; }
16+
string FieldDeclarationBlock { get; }
1517
bool IsExistingDeclaration { get; }
1618
Declaration AsTypeDeclaration { get; }
1719
bool IsSelected { set; get; }
@@ -61,6 +63,9 @@ private ObjectStateUDT(string fieldIdentifier, string typeIdentifier)
6163

6264
public string AsTypeName => _wrappedUDTField?.AsTypeName ?? TypeIdentifier;
6365

66+
public string FieldDeclarationBlock
67+
=> $"{Accessibility.Private} {IdentifierName} {Tokens.As} {AsTypeName}";
68+
6469
private bool _isSelected;
6570
public bool IsSelected
6671
{

0 commit comments

Comments
 (0)