예제 #1
0
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            Action <ITextControl> action = null;

            if ((myMatch & MethodSignatureMatch.IncorrectStaticModifier) ==
                MethodSignatureMatch.IncorrectStaticModifier && myExpectedMethodSignature.IsStatic.HasValue)
            {
                myMethodDeclaration.SetStatic(myExpectedMethodSignature.IsStatic.Value);
            }

            if ((myMatch & MethodSignatureMatch.IncorrectParameters) == MethodSignatureMatch.IncorrectParameters)
            {
                action = ChangeParameters(solution);
            }

            if ((myMatch & MethodSignatureMatch.IncorrectReturnType) == MethodSignatureMatch.IncorrectReturnType)
            {
                var element = myMethodDeclaration.DeclaredElement;
                Assertion.AssertNotNull(element, "element != null");

                var language         = myMethodDeclaration.Language;
                var changeTypeHelper = LanguageManager.Instance.GetService <IChangeTypeHelper>(language);
                changeTypeHelper.ChangeType(myExpectedMethodSignature.ReturnType, element);
            }

            if ((myMatch & MethodSignatureMatch.IncorrectTypeParameters) ==
                MethodSignatureMatch.IncorrectTypeParameters)
            {
                // There are no generic Unity methods, so just remove any that are already there
                myMethodDeclaration.SetTypeParameterList(null);
            }

            return(action);
        }
 protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
 {
     myMethodDeclaration.SetStatic(myExpectedStatic);
     return(null);
 }