protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress) { file.AddUsing("log4net", factory); var log4netType = CreateIType("log4net.ILog"); var logField = log4netType != null ? classDeclaration.FieldDeclarations.FirstOrDefault(x => x.Type.IsSubtypeOf(log4netType)) : classDeclaration.FieldDeclarations.FirstOrDefault(x => x.Type.GetInterfaceType()?.ShortName == "ILog"); if (log4netType == null && logField == null) { return(null); } if (logField == null) { logField = CreateFieldDeclaration(log4netType); AddKeywords(logField, CSharpTokenType.READONLY_KEYWORD, CSharpTokenType.STATIC_KEYWORD); AddInitializer(logField, $"LogManager.GetLogger(typeof({classDeclaration.DeclaredName}))"); classDeclaration.AddClassMemberDeclaration(logField); } literalExpression.ReplaceBy(factory.CreateExpression($"{logField.NameIdentifier.Name}.Info($0)", literalExpression)); return(null); }