Example #1
0
        FileTabManager(IFileTabUIContextLocatorCreator fileTabUIContextLocatorCreator, FileTreeView fileTreeView, ITabManagerCreator tabManagerCreator, IFileTabContentFactoryManager fileTabContentFactoryManager, IFileTabManagerSettings fileTabManagerSettings, IWpfFocusManager wpfFocusManager, IDecompilationCache decompilationCache, [ImportMany] IEnumerable <Lazy <IReferenceFileTabContentCreator, IReferenceFileTabContentCreatorMetadata> > mefRefFactories)
        {
            this.fileTabManagerSettings         = fileTabManagerSettings;
            this.fileTabUIContextLocatorCreator = fileTabUIContextLocatorCreator;
            this.fileTabContentFactoryManager   = fileTabContentFactoryManager;
            this.wpfFocusManager    = wpfFocusManager;
            this.decompilationCache = decompilationCache;
            this.refFactories       = mefRefFactories.OrderBy(a => a.Metadata.Order).ToArray();
            var tvElem = fileTreeView.TreeView.UIObject as UIElement;

            Debug.Assert(tvElem != null);
            if (tvElem != null)
            {
                tvElem.IsVisibleChanged += TreeView_IsVisibleChanged;
                isTreeViewVisible        = tvElem.IsVisible;
            }
            this.fileTreeView = fileTreeView;
            this.fileTreeView.FileManager.CollectionChanged += FileManager_CollectionChanged;
            this.fileTreeView.SelectionChanged     += FileTreeView_SelectionChanged;
            this.fileTreeView.NodesTextChanged     += FileTreeView_NodesTextChanged;
            this.fileTreeView.NodeActivated        += FileTreeView_NodeActivated;
            this.fileTreeView.TreeView.NodeRemoved += TreeView_NodeRemoved;
            this.tabManager      = tabManagerCreator.Create();
            this.tabGroupManager = this.tabManager.Create(new TabGroupManagerOptions(MenuConstants.GUIDOBJ_FILES_TABCONTROL_GUID));
            this.tabGroupManager.TabSelectionChanged      += TabGroupManager_TabSelectionChanged;
            this.tabGroupManager.TabGroupSelectionChanged += TabGroupManager_TabGroupSelectionChanged;
        }
        public ToolWindowGroupManager(ITabGroupManager tabGroupManager)
        {
            this.tabGroupManager                  = tabGroupManager;
            this.tabSelectionChanged              = new WeakEventList <ToolWindowSelectedEventArgs>();
            this.tabGroupSelectionChanged         = new WeakEventList <ToolWindowGroupSelectedEventArgs>();
            this.toolWindowGroupCollectionChanged = new WeakEventList <ToolWindowGroupCollectionChangedEventArgs>();

            this.tabGroupManager.TabSelectionChanged       += TabGroupManager_TabSelectionChanged;
            this.tabGroupManager.TabGroupSelectionChanged  += TabGroupManager_TabGroupSelectionChanged;
            this.tabGroupManager.TabGroupCollectionChanged += TabGroupManager_TabGroupCollectionChanged;
        }
        public ToolWindowGroupManager(ITabGroupManager tabGroupManager)
        {
            this.tabGroupManager = tabGroupManager;
            this.tabSelectionChanged = new WeakEventList<ToolWindowSelectedEventArgs>();
            this.tabGroupSelectionChanged = new WeakEventList<ToolWindowGroupSelectedEventArgs>();
            this.toolWindowGroupCollectionChanged = new WeakEventList<ToolWindowGroupCollectionChangedEventArgs>();

            this.tabGroupManager.TabSelectionChanged += TabGroupManager_TabSelectionChanged;
            this.tabGroupManager.TabGroupSelectionChanged += TabGroupManager_TabGroupSelectionChanged;
            this.tabGroupManager.TabGroupCollectionChanged += TabGroupManager_TabGroupCollectionChanged;
        }
Example #4
0
        public void Remove(ITabGroupManager mgr)
        {
            if (mgr == null)
            {
                throw new ArgumentNullException(nameof(mgr));
            }
            int index = tabGroupManagers.IndexOf((TabGroupManager)mgr);

            Debug.Assert(index >= 0);
            if (index >= 0)
            {
                tabGroupManagers.RemoveAt(index);
                if (selectedIndex >= tabGroupManagers.Count)
                {
                    selectedIndex = tabGroupManagers.Count - 1;
                }
            }
        }
Example #5
0
        public IEnumerable <object> Restore(FileTabManager fileTabManager, IFileTabContentFactoryManager fileTabContentFactoryManager, ITabGroupManager mgr)
        {
            mgr.IsHorizontal = IsHorizontal;
            for (int i = 0; i < TabGroups.Count; i++)
            {
                var stg = TabGroups[i];
                var g   = i == 0 ? mgr.ActiveTabGroup ?? mgr.Create() : mgr.Create();
                yield return(null);

                foreach (var o in stg.Restore(fileTabManager, fileTabContentFactoryManager, g))
                {
                    yield return(o);
                }
            }

            if (StackedContentState != null)
            {
                ((TabGroupManager)mgr).StackedContentState = StackedContentState;
            }

            var ary = mgr.TabGroups.ToArray();

            if ((uint)Index < (uint)ary.Length)
            {
                mgr.ActiveTabGroup = ary[Index];
            }
            yield return(null);
        }
Example #6
0
        public static SerializedTabGroupWindow Create(IFileTabContentFactoryManager factory, ITabGroupManager tabGroupManager, string name)
        {
            int index = tabGroupManager.TabGroups.ToList().IndexOf(tabGroupManager.ActiveTabGroup);
            var stackedContentState = ((TabGroupManager)tabGroupManager).StackedContentState;
            var tgw = new SerializedTabGroupWindow(name, index, tabGroupManager.IsHorizontal, stackedContentState);

            foreach (var g in tabGroupManager.TabGroups)
            {
                tgw.TabGroups.Add(SerializedTabGroup.Create(factory, g));
            }

            return(tgw);
        }
Example #7
0
 public MenuTabGroupContext(ITabGroupManager tabGroupManager)
 {
     this.TabGroup        = tabGroupManager.ActiveTabGroup;
     this.TabGroupManager = tabGroupManager;
 }
Example #8
0
 public TabGroupContext(ITabGroup tabGroup)
 {
     this.TabGroup        = tabGroup;
     this.TabGroupManager = tabGroup.TabGroupManager;
 }
Example #9
0
 public void Remove(ITabGroupManager mgr)
 {
     if (mgr == null)
         throw new ArgumentNullException();
     int index = tabGroupManagers.IndexOf((TabGroupManager)mgr);
     Debug.Assert(index >= 0);
     if (index >= 0) {
         tabGroupManagers.RemoveAt(index);
         if (selectedIndex >= tabGroupManagers.Count)
             selectedIndex = tabGroupManagers.Count - 1;
     }
 }
Example #10
0
        public IEnumerable<object> Restore(FileTabManager fileTabManager, IFileTabContentFactoryManager creator, ITabGroupManager mgr)
        {
            mgr.IsHorizontal = IsHorizontal;
            for (int i = 0; i < TabGroups.Count; i++) {
                var stg = TabGroups[i];
                var g = i == 0 ? mgr.ActiveTabGroup ?? mgr.Create() : mgr.Create();
                yield return null;
                foreach (var o in stg.Restore(fileTabManager, creator, g))
                    yield return o;
            }

            if (StackedContentState != null)
                ((TabGroupManager)mgr).StackedContentState = StackedContentState;

            var ary = mgr.TabGroups.ToArray();
            if ((uint)Index < (uint)ary.Length)
                mgr.ActiveTabGroup = ary[Index];
            yield return null;
        }
Example #11
0
        public static SerializedTabGroupWindow Create(IFileTabContentFactoryManager creator, ITabGroupManager tabGroupManager, string name)
        {
            int index = tabGroupManager.TabGroups.ToList().IndexOf(tabGroupManager.ActiveTabGroup);
            var stackedContentState = ((TabGroupManager)tabGroupManager).StackedContentState;
            var tgw = new SerializedTabGroupWindow(name, index, tabGroupManager.IsHorizontal, stackedContentState);

            foreach (var g in tabGroupManager.TabGroups)
                tgw.TabGroups.Add(SerializedTabGroup.Create(creator, g));

            return tgw;
        }