public static ImplementInterfaceWithDisposePatternCodeAction CreateImplementExplicitlyWithDisposePatternCodeAction( AbstractImplementInterfaceService service, Document document, State state) { return(new ImplementInterfaceWithDisposePatternCodeAction(service, document, state, explicitly: true, abstractly: false, throughMember: null)); }
public static ImplementInterfaceCodeAction CreateImplementExplicitlyCodeAction( AbstractImplementInterfaceService service, Document document, State state) { return new ImplementInterfaceCodeAction(service, document, state, explicitly: true, abstractly: false, throughMember: null); }
public static ImplementInterfaceCodeAction CreateImplementThroughMemberCodeAction( AbstractImplementInterfaceService service, Document document, State state, ISymbol throughMember) { return new ImplementInterfaceCodeAction(service, document, state, explicitly: false, abstractly: false, throughMember: throughMember); }
public static ImplementInterfaceCodeAction CreateImplementThroughMemberCodeAction( AbstractImplementInterfaceService service, Document document, State state, ISymbol throughMember) { return(new ImplementInterfaceCodeAction(service, document, state, explicitly: false, abstractly: false, throughMember: throughMember)); }
internal ImplementInterfaceWithDisposePatternCodeAction( AbstractImplementInterfaceService service, Document document, State state, bool explicitly, bool abstractly, ISymbol throughMember) : base(service, document, state, explicitly, abstractly, throughMember) { }
internal ImplementInterfaceCodeAction( AbstractImplementInterfaceService service, Document document, State state, bool explicitly, bool abstractly, ISymbol throughMember) { this.Service = service; this.Document = document; this.State = state; this.Abstractly = abstractly; this.Explicitly = explicitly; this.ThroughMember = throughMember; _equivalenceKey = ComputeEquivalenceKey(state, explicitly, abstractly, throughMember, this.GetType().FullName); }
public static State Generate( AbstractImplementInterfaceService service, Document document, SemanticModel model, SyntaxNode interfaceNode, CancellationToken cancellationToken) { SyntaxNode classOrStructDecl; INamedTypeSymbol classOrStructType; IEnumerable <INamedTypeSymbol> interfaceTypes; if (!service.TryInitializeState(document, model, interfaceNode, cancellationToken, out classOrStructDecl, out classOrStructType, out interfaceTypes)) { return(null); } if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken)) { return(null); } var state = new State(interfaceNode, classOrStructDecl, classOrStructType, interfaceTypes, model); if (service.CanImplementImplicitly) { state.UnimplementedMembers = state.ClassOrStructType.GetAllUnimplementedMembers( interfaceTypes, cancellationToken); state.UnimplementedExplicitMembers = state.ClassOrStructType.GetAllUnimplementedExplicitMembers( interfaceTypes, cancellationToken); var allMembersImplemented = state.UnimplementedMembers == null || state.UnimplementedMembers.Count == 0; var allMembersImplementedExplicitly = state.UnimplementedExplicitMembers == null || state.UnimplementedExplicitMembers.Count == 0; return(!allMembersImplementedExplicitly && !allMembersImplemented ? state : null); } else { state.UnimplementedMembers = state.ClassOrStructType.GetAllUnimplementedExplicitMembers( interfaceTypes, cancellationToken); var allMembersImplemented = state.UnimplementedMembers == null || state.UnimplementedMembers.Count == 0; return(!allMembersImplemented ? state : null); } }
public static State Generate( AbstractImplementInterfaceService service, Document document, SemanticModel model, SyntaxNode interfaceNode, CancellationToken cancellationToken) { SyntaxNode classOrStructDecl; INamedTypeSymbol classOrStructType; IEnumerable<INamedTypeSymbol> interfaceTypes; if (!service.TryInitializeState(document, model, interfaceNode, cancellationToken, out classOrStructDecl, out classOrStructType, out interfaceTypes)) { return null; } if (!CodeGenerator.CanAdd(document.Project.Solution, classOrStructType, cancellationToken)) { return null; } var state = new State(interfaceNode, classOrStructDecl, classOrStructType, interfaceTypes, model); if (service.CanImplementImplicitly) { state.UnimplementedMembers = state.ClassOrStructType.GetAllUnimplementedMembers( interfaceTypes, cancellationToken); state.UnimplementedExplicitMembers = state.ClassOrStructType.GetAllUnimplementedExplicitMembers( interfaceTypes, cancellationToken); var allMembersImplemented = state.UnimplementedMembers == null || state.UnimplementedMembers.Count == 0; var allMembersImplementedExplicitly = state.UnimplementedExplicitMembers == null || state.UnimplementedExplicitMembers.Count == 0; return !allMembersImplementedExplicitly && !allMembersImplemented ? state : null; } else { state.UnimplementedMembers = state.ClassOrStructType.GetAllUnimplementedExplicitMembers( interfaceTypes, cancellationToken); var allMembersImplemented = state.UnimplementedMembers == null || state.UnimplementedMembers.Count == 0; return !allMembersImplemented ? state : null; } }