protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
		{
			var parent =
				TsExpressionStatementNavigator.GetByExpression(TsCompoundExpressionNavigator.GetByExpression(_indexInvocation));

			var arguments = _indexInvocation.Arguments.ToArray();
			var info = new TsClass();
			var contrName = arguments[0].GetText().Trim('"');
			info.NameFull = contrName.Substring(0, 1).ToUpper() + contrName.Substring(1);
			ITsFunctionExpression function = null;
			var last = arguments[arguments.Length - 1];
			if (last is ITsFunctionExpression)
			{
				function = last as ITsFunctionExpression;
			}
			else if (last is ITsArrayLiteral)
			{
				var arr = last as ITsArrayLiteral;
				function = arr.ArrayElements[arr.ArrayElements.Count - 1] as ITsFunctionExpression;
			}
			else
			{
				return null;
			}
			info.ConstructorFunction = new TsFunction(function);
			TsElementFactory factory = TsElementFactory.GetInstance(_indexInvocation);
			using (WriteLockCookie.Create())
			{
				info.FindFieldsInsideFunction(info.ConstructorFunction.Block);
				info.FindAndMoveMethodsInsideFunction(info.ConstructorFunction.Block);
				info.FindAndMoveNgMethodsInsideFunction(info.ConstructorFunction.Block);
				info.CreateFieldsFromConstructorParams();
				//Replace Ng Controller body to its class name
				ModificationUtil.ReplaceChild(function, factory.CreateRefenceName(info.NameFull));
				//Insert ES6 class Before
				ModificationUtil.AddChildBefore(parent.Parent, parent, factory.CreateStatement(info.TransformForTypescript(true)));
			}
			
			return null;
		}
		protected Action<ITextControl> ExecuteOnDeclaration(ITsFunctionStatement index, IProgressIndicator progress)
		{
			var start = index;
			var info = new TsClass();
			
			info.NameFull = index.DeclaredName;
			info.Sources.Add(index);
			info.ConstructorFunction = new TsFunction(index);
			info.FindFieldsInsideFunction(info.ConstructorFunction.Block);
			if (start != null)
			{
				var prot = info.FindPrototype(start.NextSibling);
				if (prot != null)
				{
					info.Sources.Add(prot.Item1);
					info.AnalyzePrototype(prot.Item2);
				}
				info.CollectPrototypeSeparateMethods(start.NextSibling);
			}

			TsElementFactory factory = TsElementFactory.GetInstance(index);
			using (WriteLockCookie.Create())
			{
				ModificationUtil.ReplaceChild(info.Sources[0], factory.CreateStatement(info.TransformForTypescript()));
				for (var i = 1; i < info.Sources.Count; i++)
				{
					ModificationUtil.DeleteChild(info.Sources[i]);
				}
			}
			
			return null;
		}
		protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
		{
			ITreeNode parent = _index;
			while (true)
			{
				if (parent.Parent == null)
				{
					return null;
				}
				if (parent.Parent is ITsFileSection)
				{
					break;
				}
				parent = parent.Parent;
			}

			var info = new TsClass();
			info.NameFull = "SomeNamespace.SomeClass";

			info.ConstructorFunction = new TsFunction(_index);

			TsElementFactory factory = TsElementFactory.GetInstance(_index);
			using (WriteLockCookie.Create())
			{
				info.FindFieldsInsideFunction(info.ConstructorFunction.Block);
				info.FindAndMoveMethodsInsideFunction(info.ConstructorFunction.Block);
				info.FindAndMoveNgMethodsInsideFunction(info.ConstructorFunction.Block);
				info.CreateFieldsFromConstructorParams();
				//Replace Ng Controller body to its class name
				ModificationUtil.ReplaceChild(_index, factory.CreateRefenceName(info.NameFull));
				//Insert ES6 class Before
				ModificationUtil.AddChildBefore(parent.Parent, parent, factory.CreateStatement(info.TransformForTypescript(true)));
			}
			
			return null;
		}
		protected Action<ITextControl> ExecuteOnExpression(ITsSimpleAssignmentExpression index, IProgressIndicator progress)
		{
			var start = TsExpressionStatementNavigator.GetByExpression(TsCompoundExpressionNavigator.GetByExpression(index));
			var info = new TsClass();
			if (index.Source is ITsFunctionExpression && index.Dest is ITsReferenceExpression)
			{
				info.NameFull = index.Dest.GetText();
				info.Sources.Add(index);
				info.ConstructorFunction = new TsFunction(index.Source as ITsFunctionExpression);
				info.FindFieldsInsideFunction(info.ConstructorFunction.Block);
				if (start != null)
				{
					var prot = info.FindPrototype(start.NextSibling);
					if (prot != null)
					{
						info.Sources.Add(prot.Item1);
						info.AnalyzePrototype(prot.Item2);
					}
					info.CollectPrototypeSeparateMethods(start.NextSibling);
				}

			}
			else if (index.Source is ITsObjectLiteral && index.Dest is ITsReferenceExpression)
			{
				info.NameFull = index.Dest.GetText();
				info.Sources.Add(index);
				info.AnalyzeStaticClass(index.Source as ITsObjectLiteral);
			}

			TsElementFactory factory = TsElementFactory.GetInstance(index);
			using (WriteLockCookie.Create())
			{
				ModificationUtil.ReplaceChild(info.Sources[0], factory.CreateStatement(info.TransformForTypescript()));
				for (var i = 1; i < info.Sources.Count; i++)
				{
					ModificationUtil.DeleteChild(info.Sources[i]);
				}
			}

			return null;
		}