예제 #1
0
 static string Common(ScintillaControl sci, string sourceText, int ch)
 {
     sci.Text = sourceText;
     sci.Colourise(0, -1);
     SnippetHelper.PostProcessSnippets(sci, 0);
     sci.OnSmartIndent(sci, ch);
     return(sci.Text);
 }
예제 #2
0
 static string Common(string sourceText, MemberModel currentMember, string newName, ScintillaControl sci)
 {
     sci.Text = sourceText;
     SnippetHelper.PostProcessSnippets(sci, 0);
     ASContext.Context.CurrentMember.Returns(currentMember);
     CommandFactoryProvider.GetFactory(sci)
     .CreateExtractLocalVariableCommand(false, newName)
     .Execute();
     return(sci.Text);
 }
예제 #3
0
            static string Common(string sourceText, string newName, ScintillaControl sci)
            {
                sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(sci, 0);
                var model = ASContext.Context.GetCodeModel(sourceText);

                ASContext.Context.CurrentMember.Returns(model.Classes.First().Members.Items.First());
                CommandFactoryProvider.GetFactory(sci)
                .CreateExtractMethodCommand(newName)
                .Execute();
                return(sci.Text);
            }
예제 #4
0
            static bool Common(string sourceText, ScintillaControl sci)
            {
                sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, sci.Text);
                var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass;

                ASContext.Context.CurrentClass.Returns(currentClass);
                ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault());
                return(Provider.CommandFactoryProvider.GetFactory(sci.ConfigurationLanguage).IsValidForConvertForeachToKeyValueIterator(sci));
            }
예제 #5
0
            internal static string Common(ScintillaControl sci, string sourceText, string fileName)
            {
                sci.Text = sourceText;
                sci.Colourise(0, -1); // Needed for preprocessor directives...
                SnippetHelper.PostProcessSnippets(sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, sci.Text);
                CommandFactoryProvider.GetFactory(sci)
                .CreateOrganizeImportsCommand()
                .Execute();
                return(sci.Text);
            }
예제 #6
0
 public string AS3(string sourceText, MemberModel currentMember, string newName)
 {
     ASContext.Context.SetAs3Features();
     ASContext.Context.CurrentModel.Returns(new FileModel {
         Context = ASContext.Context
     });
     ASContext.Context.CurrentMember.Returns(currentMember);
     Sci.Text = sourceText;
     Sci.ConfigurationLanguage = "as3";
     SnippetHelper.PostProcessSnippets(Sci, 0);
     new ExtractLocalVariableCommand(false, newName).Execute();
     return(Sci.Text);
 }
예제 #7
0
            bool Common(string sourceText)
            {
                Sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(Sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, Sci.Text);
                var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass;

                ASContext.Context.CurrentClass.Returns(currentClass);
                ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault());
                var target = RefactoringHelper.GetDefaultRefactorTarget();

                return(RefactoringHelper.IsPrivateTarget(target));
            }
예제 #8
0
            static EForeach Common(string sourceText, ScintillaControl sci)
            {
                sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, sci.Text);
                var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass;

                ASContext.Context.CurrentClass.Returns(currentClass);
                ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault());
                var result = Complete.GetExpression(sci, sci.CurrentPos);

                return(result);
            }
예제 #9
0
            public string Haxe(string sourceText, MemberModel currentMember, string newName, int contextualGeneratorItem)
            {
                ASContext.Context.SetHaxeFeatures();
                ASContext.Context.CurrentModel.Returns(new FileModel {
                    haXe = true, Context = ASContext.Context
                });
                ASContext.Context.CurrentMember.Returns(currentMember);
                Sci.Text = sourceText;
                Sci.ConfigurationLanguage = "haxe";
                SnippetHelper.PostProcessSnippets(Sci, 0);
                var command = (ExtractLocalVariableCommand)CommandFactoryProvider.GetFactory(Sci).CreateExtractLocalVariableCommand(false, newName);

                command.Execute();
                ((CompletionListItem)command.CompletionList[contextualGeneratorItem]).PerformClick();
                return(Sci.Text);
            }
예제 #10
0
        protected static void SetSrc(ScintillaControl sci, string sourceText)
        {
            sci.Text = sourceText;
            SnippetHelper.PostProcessSnippets(sci, 0);
            var currentModel = ASContext.Context.CurrentModel;

            ASContext.Context.GetCodeModel(currentModel, sci.Text);
            var line         = sci.CurrentLine;
            var currentClass = currentModel.Classes.FirstOrDefault(line);

            ASContext.Context.CurrentClass.Returns(currentClass);
            var currentMember = currentClass?.Members.FirstOrDefault(line);

            ASContext.Context.CurrentMember.Returns(currentMember);
            ASGenerator.contextToken = sci.GetWordFromPosition(sci.CurrentPos);
        }
예제 #11
0
            public Result Common(string sourceText)
            {
                ASContext.Context.SetHaxeFeatures();
                Sci.ConfigurationLanguage = "haxe";
                Sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(Sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, Sci.Text);
                var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass;

                ASContext.Context.CurrentClass.Returns(currentClass);
                ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault());
                var target = RefactoringHelper.GetDefaultRefactorTarget();

                return(new Result(target.IsPackage, target.Member, target.Type));
            }
예제 #12
0
            public string Haxe(string sourceText, string fileName)
            {
                Sci.ConfigurationLanguage = "haxe";
                ASContext.Context.SetHaxeFeatures();
                ASContext.Context.CurrentModel.Returns(new FileModel
                {
                    haXe     = true,
                    Context  = ASContext.Context,
                    FileName = fileName
                });
                Sci.Text = sourceText;
                SnippetHelper.PostProcessSnippets(Sci, 0);
                var currentModel = ASContext.Context.CurrentModel;

                new ASFileParser().ParseSrc(currentModel, Sci.Text);
                CommandFactoryProvider.GetFactory(Sci)
                .CreateOrganizeImportsCommand()
                .Execute();
                return(Sci.Text);
            }
예제 #13
0
 static string Common(ScintillaControl sci, string sourceText, bool skipWS)
 {
     sci.Text = sourceText;
     SnippetHelper.PostProcessSnippets(sci, 0);
     return(sci.GetWordRight(sci.CurrentPos, skipWS));
 }
예제 #14
0
 static int Common(string sourceText, ScintillaControl sci)
 {
     sci.Text = sourceText;
     SnippetHelper.PostProcessSnippets(sci, 0);
     return(Complete.GetStartOfIfStatement(sci, sci.CurrentPos));
 }