protected override void Run(IClassDeclaration classDeclaration, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { if (!myIsEnabled.Value) { return; } var typeElement = classDeclaration.DeclaredElement; if (typeElement == null || !ZoneConstants.IsZoneClass(typeElement)) { return; } var mark = myMarks.GetMark(typeElement.GetContainingNamespace()); var classes = myMarks.EnumerateClasses(mark).ToList(); // find all base zones var baseZones = new HashSet <IClass>(); foreach (var cls in classes) { foreach (var baseZone in MarksService.EnumerableMarkClasses(cls, true)) { if (!baseZone.Equals(cls)) { baseZones.Add(baseZone); } } } foreach (var typeUsage in classDeclaration.SuperTypeUsageNodes.OfType <IUserDeclaredTypeUsage>()) { IDeclaredType superType = CSharpTypeFactory.CreateDeclaredType(typeUsage); var superTypeElement = superType.GetTypeElement(); if (superTypeElement != null) { if (ZoneConstants.IsIRequire(superTypeElement as IInterface)) { var substitution = superType.GetSubstitution(); foreach (var parameter in substitution.Domain) { var zoneType = substitution[parameter] as IDeclaredType; if (zoneType != null) { var zoneClass = zoneType.GetTypeElement() as IClass; if (zoneClass != null && baseZones.Contains(zoneClass)) { consumer.AddHighlighting(new RedundantDependencySpecificationError(typeUsage), classDeclaration.GetContainingNode <IFile>()); } } } } } } }
public RedundantDependencyChecker(MarksService marks, IPsiServices services) { myMarks = marks; myServices = services; myIsEnabled = services.Solution.GetComponent <MarksService>().Enabled; }
public NamespaceNestingChecker(MarksService marks, IPsiServices services) { myMarks = marks; myServices = services; myIsEnabled = services.Solution.GetComponent <MarksService>().Enabled; }
public UsingsCheckerReferenceName(MarksService marks) : base(marks) { }
public UsingsCheckerBase(MarksService marks) { myMarks = marks; myIsEnabled = marks.Enabled; }
public UsingsCheckerReferenceExpression(MarksService marks) : base(marks) { }