/// <summary>
        /// Clears the highlight.
        /// </summary>
        /// <param name="plugin">The plugin.</param>
        private void ClearHighlight(UIPlugin plugin)
        {
            foreach (var dockWindow in plugin.DockWindows)
            {
                var content = dockWindow.Content as UIElement;
                if (content != null && adornerDictionary.ContainsKey(content))
                {
                    var adornerLayer = AdornerLayer.GetAdornerLayer(content);
                    if (adornerLayer != null)
                    {
                        adornerLayer.Remove(adornerDictionary[content]);
                        adornerDictionary.Remove(content);
                    }
                }
            }

            foreach (var ribbonGroup in plugin.RibbonEntries.Select(r => r.RibbonGroup))
            {
                if (adornerDictionary.ContainsKey(ribbonGroup))
                {
                    var adornerLayer = AdornerLayer.GetAdornerLayer(ribbonGroup);
                    if (adornerLayer != null)
                    {
                        adornerLayer.Remove(adornerDictionary[ribbonGroup]);
                        adornerDictionary.Remove(ribbonGroup);
                    }
                }
            }
        }
        private void ReorderRibbonGroups(Ribbon ribbonContainer)
        {
            var enabledPlugins = GetActiveUIPlugins().ToArray();

            for (int i = enabledPlugins.Length - 1; i >= 0; i--)
            {
                UIPlugin currentPlugin = enabledPlugins[i];
                foreach (var ribbonEntry in currentPlugin.RibbonEntries.OrderBy(r => r.RibbonGroupIndex).Reverse())
                {
                    RibbonTab containingRibbonTab = GetRibbonTabContaining(ribbonEntry, ribbonContainer);
                    containingRibbonTab.Items.Remove(ribbonEntry.RibbonGroup);

                    int    insertIndex        = 0;
                    string ribbonTabHeaderKey = RibbonExtension.GetRibbonTabHeader(containingRibbonTab);
                    if ("HomeRibbonTabHeader".Equals(ribbonTabHeaderKey, StringComparison.Ordinal))
                    {
                        insertIndex = 1;
                    }
                    containingRibbonTab.Items.Insert(insertIndex, ribbonEntry.RibbonGroup);
                }
            }
        }
        /// <summary>
        /// Highlights the specified plugin.
        /// </summary>
        /// <param name="plugin">The plugin.</param>
        private void Highlight(UIPlugin plugin)
        {
            foreach (var dockWindow in plugin.DockWindows)
            {
                var content = dockWindow.Content as UIElement;

                if (content != null)
                {
                    //bring the dock window to the top
                    GisEditor.DockWindowManager.OpenDockWindow(dockWindow);
                    content.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        //add the red border
                        AdornUIElement(content);
                    }), DispatcherPriority.Background);
                }
            }

            foreach (var ribbonGroup in plugin.RibbonEntries.Select(r => r.RibbonGroup))
            {  //switch the tab
                var containerTab = ribbonGroup.Ribbon.Items
                                   .OfType <RibbonTab>()
                                   .Where(tab => tab.Items.Contains(ribbonGroup))
                                   .FirstOrDefault();

                if (containerTab != null)
                {
                    containerTab.IsSelected = true;
                    containerTab.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        //add the red border
                        AdornUIElement(ribbonGroup);
                    }), DispatcherPriority.Background);
                }
            }
        }
 public void Unselect(UIPlugin plugin)
 {
     //GisEditor.LayoutManager.HighlightUIPlugins.Remove(plugin);
     plugin.IsHighlighted = false;
     SelectedPlugin       = null;
 }