Пример #1
0
 public void OrganizeImportsFixtureSetUp()
 {
     // Needed for preprocessor directives...
     Sci.SetProperty("fold", "1");
     Sci.SetProperty("fold.preprocessor", "1");
     CommandFactoryProvider.Register("haxe", new HaxeCommandFactory());
 }
Пример #2
0
 static string Common(string sourceText, string newName, ScintillaControl sci)
 {
     SetSrc(sci, sourceText);
     CommandFactoryProvider.GetFactory(sci)
     .CreateExtractLocalVariableCommand(false, newName)
     .Execute();
     return(sci.Text);
 }
Пример #3
0
 internal static string Common(ScintillaControl sci, string sourceText, string fileName)
 {
     ASContext.Context.CurrentModel.FileName = fileName;
     SetSrc(sci, sourceText);
     sci.Colourise(0, -1); // Needed for preprocessor directives...
     CommandFactoryProvider.GetFactory(sci)
     .CreateOrganizeImportsCommand()
     .Execute();
     return(sci.Text);
 }
Пример #4
0
            public string Haxe(string sourceText, string newName, int contextualGeneratorItem)
            {
                SetHaxeFeatures(sci);
                SetSrc(sci, sourceText);
                var command = (ExtractLocalVariableCommand)CommandFactoryProvider.GetFactory(sci).CreateExtractLocalVariableCommand(false, newName);

                command.Execute();
                ((CompletionListItem)command.CompletionList[contextualGeneratorItem]).PerformClick();
                return(sci.Text);
            }
Пример #5
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);
            }
Пример #6
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);
            }
Пример #7
0
            static string Common(ScintillaControl sci, string sourceText, string newName)
            {
                SetSrc(sci, sourceText);
                var waitHandle = new AutoResetEvent(false);

                CommandFactoryProvider.GetFactory(sci)
                .CreateRenameCommandAndExecute(RefactoringHelper.GetDefaultRefactorTarget(), false, newName)
                .OnRefactorComplete += (sender, args) => waitHandle.Set();
                var end    = DateTime.Now.AddSeconds(2);
                var result = false;

                while ((!result) && (DateTime.Now < end))
                {
                    context.Send(state => {}, new {});
                    result = waitHandle.WaitOne(0);
                }
                return(sci.Text);
            }
Пример #8
0
        protected override void ExecutionImplementation()
        {
            String oldFileName = Path.GetFileNameWithoutExtension(oldPath);
            String newFileName = Path.GetFileNameWithoutExtension(newPath);
            String msg         = TextHelper.GetString("Info.RenamingFile");
            String title       = String.Format(TextHelper.GetString("Title.RenameDialog"), oldFileName);

            if (MessageBox.Show(msg, title, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                var target = RefactoringHelper.GetRefactorTargetFromFile(oldPath, AssociatedDocumentHelper);
                if (target != null)
                {
                    var command = CommandFactoryProvider.GetFactory(target).CreateRenameCommandAndExecute(target, true, newFileName);
                    command.RegisterDocumentHelper(AssociatedDocumentHelper);
                    return;
                }
            }
            // refactor failed or was refused
            if (Path.GetFileName(oldPath).Equals(newPath, StringComparison.OrdinalIgnoreCase))
            {
                // name casing changed
                string tmpPath = oldPath + "$renaming$";
                File.Move(oldPath, tmpPath);
                oldPath = tmpPath;
            }
            if (!Path.IsPathRooted(newPath))
            {
                newPath = Path.Combine(Path.GetDirectoryName(oldPath), newPath);
            }

            if (FileHelper.ConfirmOverwrite(newPath))
            {
                FileHelper.ForceMove(oldPath, newPath);
                DocumentManager.MoveDocuments(oldPath, newPath);
                RefactoringHelper.RaiseMoveEvent(oldPath, newPath);
            }
        }
Пример #9
0
 public UserChannelHandler(IInternalLogger logger, int userId, CommandFactoryProvider provider)
 {
     _logger   = logger;
     _userId   = userId;
     _provider = provider;
 }
Пример #10
0
 public AuthHandler(AuthManager authManager, IInternalLogger logger, CommandFactoryProvider provider)
 {
     _authManager = authManager;
     _logger      = logger;
     _provider    = provider;
 }