示例#1
0
        public void MoveTo(IToolWindowGroup destGroup, ToolWindowContent content)
        {
            if (destGroup == null)
            {
                throw new ArgumentNullException(nameof(destGroup));
            }
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                throw new InvalidOperationException();
            }
            if (destGroup == this)
            {
                return;
            }
            var destGroupImpl = destGroup as ToolWindowGroup;

            if (destGroupImpl == null)
            {
                throw new InvalidOperationException();
            }

            impl.PrepareMove();
            Close(impl);

            impl = new TabContentImpl(destGroupImpl, content);
            impl.PrepareMove();
            destGroupImpl.TabGroup.Add(impl);
        }
示例#2
0
        void Show(ToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var t = GetToolWindowGroup(content);

            if (t != null)
            {
                if (active)
                {
                    t.Item2.ActiveTabContent = content;
                }
                if (focus)
                {
                    t.Item2.SetFocus(content);
                }
                return;
            }

            var g = GetOrCreateGroup(location);

            g.Add(content);
            SaveLocationAndActivate(g, content, location, active, focus);
        }
示例#3
0
 public TabContentImpl(ToolWindowGroup owner, ToolWindowContent content)
 {
     elementZoomer = new TabElementZoomer();
     this.owner    = owner;
     Content       = content;
     AddEvents();
 }
示例#4
0
 public void Show(ToolWindowContent content, AppToolWindowLocation?location)
 {
     if (content == null)
     {
         throw new ArgumentNullException(nameof(content));
     }
     Show(content, GetLocation(content.Guid, location), true, true);
 }
示例#5
0
		public void Close(ToolWindowContent content) {
			if (content == null)
				throw new ArgumentNullException(nameof(content));
			var impl = GetTabContentImpl(content);
			Debug.Assert(impl != null);
			if (impl == null)
				return;
			TabGroup.Close(impl);
		}
示例#6
0
        public bool CanMove(ToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return(false);
            }

            return(true);
        }
示例#7
0
 void SaveLocationAndActivate(IToolWindowGroup g, ToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
 {
     if (active)
     {
         g.ActiveTabContent = content;
     }
     if (focus)
     {
         g.SetFocus(content);
     }
     savedLocations[content.Guid] = location;
 }
示例#8
0
 Tuple <ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(ToolWindowContent content)
 {
     foreach (var ui in this.toolWindowUIs.Values)
     {
         foreach (var g in ui.ToolWindowGroupService.TabGroups)
         {
             if (g.TabContents.Contains(content))
             {
                 return(Tuple.Create(ui, g));
             }
         }
     }
     return(null);
 }
示例#9
0
        public void Close(ToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var t = GetToolWindowGroup(content);

            Debug.Assert(t != null);
            if (t == null)
            {
                throw new InvalidOperationException();
            }
            t.Item2.Close(content);
        }
示例#10
0
        public void Move(ToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return;
            }

            var g = GetOrCreateGroup(location);

            t.Item2.MoveTo(g, content);
            SaveLocationAndActivate(g, content, location, true, true);
        }
示例#11
0
        public void Close(ToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                return;
            }
            TabGroup.Close(impl);
        }
示例#12
0
		public void MoveTo(IToolWindowGroup destGroup, ToolWindowContent content) {
			if (destGroup == null)
				throw new ArgumentNullException(nameof(destGroup));
			if (content == null)
				throw new ArgumentNullException(nameof(content));
			var impl = GetTabContentImpl(content);
			Debug.Assert(impl != null);
			if (impl == null)
				throw new InvalidOperationException();
			if (destGroup == this)
				return;
			var destGroupImpl = destGroup as ToolWindowGroup;
			if (destGroupImpl == null)
				throw new InvalidOperationException();

			impl.PrepareMove();
			Close(impl);

			impl = new TabContentImpl(destGroupImpl, content);
			impl.PrepareMove();
			destGroupImpl.TabGroup.Add(impl);
		}
示例#13
0
		TabContentImpl GetTabContentImpl(ToolWindowContent content) => TabContentImpls.FirstOrDefault(a => a.Content == content);
示例#14
0
		public void Add(ToolWindowContent content) => TabGroup.Add(new TabContentImpl(this, content));
示例#15
0
		void Show(ToolWindowContent content, AppToolWindowLocation location, bool active, bool focus) {
			if (content == null)
				throw new ArgumentNullException(nameof(content));
			var t = GetToolWindowGroup(content);
			if (t != null) {
				if (active)
					t.Item2.ActiveTabContent = content;
				if (focus)
					t.Item2.SetFocus(content);
				return;
			}

			var g = GetOrCreateGroup(location);
			g.Add(content);
			SaveLocationAndActivate(g, content, location, active, focus);
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="tabGroup">Tab group</param>
		/// <param name="selected">Selected content or null</param>
		/// <param name="unselected">Unselected content or null</param>
		public ToolWindowSelectedEventArgs(IToolWindowGroup tabGroup, ToolWindowContent selected, ToolWindowContent unselected) {
			TabGroup = tabGroup;
			Selected = selected;
			Unselected = unselected;
		}
示例#17
0
 public void Add(ToolWindowContent content) => TabGroup.Add(new TabContentImpl(this, content));
示例#18
0
		void SaveLocationAndActivate(IToolWindowGroup g, ToolWindowContent content, AppToolWindowLocation location, bool active, bool focus) {
			if (active)
				g.ActiveTabContent = content;
			if (focus)
				g.SetFocus(content);
			savedLocations[content.Guid] = location;
		}
示例#19
0
		public bool IsShown(ToolWindowContent content) => GetToolWindowGroup(content) != null;
示例#20
0
 TabContentImpl GetTabContentImpl(ToolWindowContent content) => TabContentImpls.FirstOrDefault(a => a.Content == content);
示例#21
0
		public void Close(ToolWindowContent content) {
			if (content == null)
				throw new ArgumentNullException(nameof(content));
			var t = GetToolWindowGroup(content);
			Debug.Assert(t != null);
			if (t == null)
				throw new InvalidOperationException();
			t.Item2.Close(content);
		}
示例#22
0
		Tuple<ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(ToolWindowContent content) {
			foreach (var ui in toolWindowUIs.Values) {
				foreach (var g in ui.ToolWindowGroupService.TabGroups) {
					if (g.TabContents.Contains(content))
						return Tuple.Create(ui, g);
				}
			}
			return null;
		}
示例#23
0
		public bool CanMove(ToolWindowContent content, AppToolWindowLocation location) {
			var t = GetToolWindowGroup(content);
			location = Convert(location);
			if (t == null || t.Item1.Location == location)
				return false;

			return true;
		}
示例#24
0
		public void Move(ToolWindowContent content, AppToolWindowLocation location) {
			var t = GetToolWindowGroup(content);
			location = Convert(location);
			if (t == null || t.Item1.Location == location)
				return;

			var g = GetOrCreateGroup(location);
			t.Item2.MoveTo(g, content);
			SaveLocationAndActivate(g, content, location, true, true);
		}
示例#25
0
		public void Show(ToolWindowContent content, AppToolWindowLocation? location) {
			if (content == null)
				throw new ArgumentNullException(nameof(content));
			Show(content, GetLocation(content.Guid, location), true, true);
		}
示例#26
0
		public TabContentImpl(ToolWindowGroup owner, ToolWindowContent content) {
			elementZoomer = new TabElementZoomer();
			this.owner = owner;
			Content = content;
			AddEvents();
		}
示例#27
0
 public ToolWindowContentState Save(ToolWindowContent c)
 {
     this.Guid = c.Guid;
     return(this);
 }
示例#28
0
 public bool IsShown(ToolWindowContent content) => GetToolWindowGroup(content) != null;
示例#29
0
		public ToolWindowContentState Save(ToolWindowContent c) {
			Guid = c.Guid;
			return this;
		}