/// <summary>
        ///  Activates the editor for the given item.If there's still an editor around  for the previous-edited item, it is deactivated. Pass in 'null' to deactivate and remove the current editor, if any.
        /// </summary>
        internal void ActivateEditor(ToolStripItem item, bool clicked)
        {
            if (item != _currentItem)
            {
                // Remove old editor
                if (_editor != null)
                {
                    _behaviorService.AdornerWindowControl.Controls.Remove(_editor);
                    _behaviorService.Invalidate(_editor.Bounds);
                    _editorUI    = null;
                    _editor      = null;
                    _currentItem = null;
                    _itemDesigner.IsEditorActive = false;

                    // Show the previously edited glyph
                    if (_currentItem != null)
                    {
                        _currentItem = null;
                    }
                }

                if (item != null)
                {
                    // Add new editor from the item...
                    _currentItem = item;
                    if (_designerHost != null)
                    {
                        _itemDesigner = (ToolStripItemDesigner)_designerHost.GetDesigner(_currentItem);
                    }

                    _editorUI = (ToolStripTemplateNode)_itemDesigner.Editor;
                    // If we got an editor, position and focus it.
                    if (_editorUI != null)
                    {
                        // Hide this glyph while it's being edited
                        _itemDesigner.IsEditorActive = true;
                        _editor = new ToolStripEditorControl(_editorUI.EditorToolStrip, _editorUI.Bounds);
                        _behaviorService.AdornerWindowControl.Controls.Add(_editor);
                        _lastKnownEditorBounds = _editor.Bounds;
                        _editor.BringToFront();
                        // this is important since the ToolStripEditorControl listens    to textchanged messages from TextBox.
                        _editorUI.ignoreFirstKeyUp = true;
                        // Select the Editor... Put Text and Select it ...
                        _editorUI.FocusEditor(_currentItem);
                    }
                }
            }
        }
 internal void ActivateEditor(ToolStripItem item, bool clicked)
 {
     if (item != this.currentItem)
     {
         if (this.editor != null)
         {
             this.behaviorService.AdornerWindowControl.Controls.Remove(this.editor);
             this.behaviorService.Invalidate(this.editor.Bounds);
             this.editorUI    = null;
             this.editor      = null;
             this.currentItem = null;
             this.itemDesigner.IsEditorActive = false;
             if (this.currentItem != null)
             {
                 this.currentItem = null;
             }
         }
         if (item != null)
         {
             this.currentItem = item;
             if (this.designerHost != null)
             {
                 this.itemDesigner = (ToolStripItemDesigner)this.designerHost.GetDesigner(this.currentItem);
             }
             this.editorUI = this.itemDesigner.Editor;
             if (this.editorUI != null)
             {
                 this.itemDesigner.IsEditorActive = true;
                 this.editor = new ToolStripEditorControl(this.editorUI.EditorToolStrip, this.editorUI.Bounds);
                 this.behaviorService.AdornerWindowControl.Controls.Add(this.editor);
                 this.lastKnownEditorBounds = this.editor.Bounds;
                 this.editor.BringToFront();
                 this.editorUI.ignoreFirstKeyUp = true;
                 this.editorUI.FocusEditor(this.currentItem);
             }
         }
     }
 }
 internal void ActivateEditor(ToolStripItem item, bool clicked)
 {
     if (item != this.currentItem)
     {
         if (this.editor != null)
         {
             this.behaviorService.AdornerWindowControl.Controls.Remove(this.editor);
             this.behaviorService.Invalidate(this.editor.Bounds);
             this.editorUI = null;
             this.editor = null;
             this.currentItem = null;
             this.itemDesigner.IsEditorActive = false;
             if (this.currentItem != null)
             {
                 this.currentItem = null;
             }
         }
         if (item != null)
         {
             this.currentItem = item;
             if (this.designerHost != null)
             {
                 this.itemDesigner = (ToolStripItemDesigner) this.designerHost.GetDesigner(this.currentItem);
             }
             this.editorUI = this.itemDesigner.Editor;
             if (this.editorUI != null)
             {
                 this.itemDesigner.IsEditorActive = true;
                 this.editor = new ToolStripEditorControl(this.editorUI.EditorToolStrip, this.editorUI.Bounds);
                 this.behaviorService.AdornerWindowControl.Controls.Add(this.editor);
                 this.lastKnownEditorBounds = this.editor.Bounds;
                 this.editor.BringToFront();
                 this.editorUI.ignoreFirstKeyUp = true;
                 this.editorUI.FocusEditor(this.currentItem);
             }
         }
     }
 }