コード例 #1
0
ファイル: Rename.cs プロジェクト: zvoronz/flashdevelop
        /// <summary>
        /// Begins the process of renaming.
        /// </summary>
        private void StartRename(bool useInline, string oldName, string newName)
        {
            if (!string.IsNullOrEmpty(newName))
            {
                OnApply(null, oldName, newName);
                return;
            }

            if (useInline)
            {
                var sci = PluginBase.MainForm.CurrentDocument.SciControl;
                int position = sci.WordEndPosition(sci.CurrentPos, true);

                var inlineRename = new InlineRename(sci, oldName, position, null, null, isRenamePackage ? new bool?() : new bool?(true), Target);
                inlineRename.Apply += OnApply;
                inlineRename.Cancel += OnCancel;
            }
            else
            {
                string title = " " + string.Format(TextHelper.GetString("Title.RenameDialog"), oldName);
                string label = TextHelper.GetString("Label.NewName");
                var dialog = new LineEntryDialog(title, label, oldName);

                switch (dialog.ShowDialog())
                {
                    case DialogResult.OK:
                        OnApply(null, oldName, dialog.Line.Trim());
                        break;
                    case DialogResult.Cancel:
                        OnCancel(null);
                        break;
                }
            }
        }
コード例 #2
0
ファイル: InlineRename.cs プロジェクト: wise0704/FlashDevelop
 /// <summary>
 /// Add this <see cref="InlineRename"/> object as a message filter and handle internal
 /// messages and handle <see cref="ScintillaControl"/> events.
 /// </summary>
 private void AddMessageFilter()
 {
     Application.AddMessageFilter(this);
     sci.SelectionChanged += Sci_SelectionChanged;
     sci.TextInserted     += Sci_TextInserted;
     sci.TextDeleted      += Sci_TextDeleted;
     Current = this;
 }
コード例 #3
0
ファイル: Rename.cs プロジェクト: zvoronz/flashdevelop
 /// <summary>
 /// Update the default flags and clean up.
 /// </summary>
 private void UpdateDefaultFlags(InlineRename inlineRename)
 {
     if (inlineRename != null)
     {
         inlineRename.Apply -= OnApply;
         inlineRename.Cancel -= OnCancel;
     }
 }
コード例 #4
0
ファイル: Rename.cs プロジェクト: zvoronz/flashdevelop
 /// <summary>
 /// Cancel renaming and clean up.
 /// </summary>
 private void OnCancel(InlineRename sender)
 {
     UpdateDefaultFlags(sender);
     if (findAllReferencesCommand != null)
     {
         findAllReferencesCommand.OnRefactorComplete -= OnFindAllReferencesCompleted;
     }
 }
コード例 #5
0
ファイル: Rename.cs プロジェクト: zvoronz/flashdevelop
        /// <summary>
        /// Apply the new name.
        /// </summary>
        private void OnApply(InlineRename sender, string oldName, string newName)
        {
            UpdateDefaultFlags(sender);
            if (newName.Length == 0 || oldName == newName) return;

            if (isRenamePackage)
            {
                renamePackage = new Move(new Dictionary<string, string> { { renamePackagePath, newName } }, true, true);
            }

            OldName = oldName;
            NewName = newName;
            RenamingHelper.AddToQueue(this);
        }
コード例 #6
0
ファイル: InlineRename.cs プロジェクト: wise0704/FlashDevelop
        /// <summary>
        /// Remove this <see cref="InlineRename"/> from the system message filters, dispose any
        /// resources used, and re-enable controls from <see cref="IMainForm"/>.
        /// </summary>
        void IDisposable.Dispose()
        {
            Application.RemoveMessageFilter(this);
            sci.SelectionChanged -= Sci_SelectionChanged;
            sci.TextInserted     -= Sci_TextInserted;
            sci.TextDeleted      -= Sci_TextDeleted;
            Current = null;

            currentDoc = null;
            currentRef = null;
            refs       = null;

            history.Clear();
            history = null;

            PluginBase.MainForm.MenuStrip.Enabled  = true;
            PluginBase.MainForm.ToolStrip.Enabled  = true;
            PluginBase.MainForm.EditorMenu.Enabled = true;
            UITools.Manager.DisableEvents          = false;
        }