Skip to content

Commit

Permalink
Restore modified UI accessors
Browse files Browse the repository at this point in the history
Restored EncapsulateFieldModel and IObjectStateUDT accessors used by the UI to keep all changes for this PR within the RefactoringActions.
  • Loading branch information
BZngr committed Sep 21, 2020
1 parent dd5f544 commit 3a74f8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Expand Up @@ -198,7 +198,7 @@ public bool ConvertFieldsToUDTMembers
private bool _selectionHasValidEncapsulationAttributes;
public bool SelectionHasValidEncapsulationAttributes => _selectionHasValidEncapsulationAttributes;

public string PropertiesPreview => Model.PreviewProvider?.Preview(Model) ?? string.Empty;
public string PropertiesPreview => Model.PreviewRefactoring();

public CommandBase SelectAllCommand { get; }

Expand Down
Expand Up @@ -29,6 +29,8 @@ public class EncapsulateFieldModel : IRefactoringModel

public EncapsulateFieldUseBackingFieldModel EncapsulateFieldUseBackingFieldModel { get; }

public string PreviewRefactoring() => PreviewProvider?.Preview(this) ?? string.Empty;

public IRefactoringPreviewProvider<EncapsulateFieldModel> PreviewProvider { set; get; }

public Action<EncapsulateFieldModel> StrategyChangedAction { set; get; } = (m) => { };
Expand Down
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Rubberduck.Parsing.Grammar;

namespace Rubberduck.Refactorings.EncapsulateField
{
Expand All @@ -12,6 +13,7 @@ public interface IObjectStateUDT : IEncapsulateFieldRefactoringElement
Declaration Declaration { get; }
string TypeIdentifier { set; get; }
string FieldIdentifier { set; get; }
string FieldDeclarationBlock { get; }
bool IsExistingDeclaration { get; }
Declaration AsTypeDeclaration { get; }
bool IsSelected { set; get; }
Expand Down Expand Up @@ -61,6 +63,9 @@ private ObjectStateUDT(string fieldIdentifier, string typeIdentifier)

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

public string FieldDeclarationBlock
=> $"{Accessibility.Private} {IdentifierName} {Tokens.As} {AsTypeName}";

private bool _isSelected;
public bool IsSelected
{
Expand Down

0 comments on commit 3a74f8d

Please sign in to comment.