bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;
            outlineTreeStore.Clear();
            if (lastCU != null)
            {
                BuildTreeChildren(outlineTreeStore, TreeIter.Zero, lastCU);
                TreeIter it;
                if (outlineTreeStore.GetIterFirst(out it))
                {
                    outlineTreeView.Selection.SelectIter(it);
                }
                outlineTreeView.ExpandAll();
            }
            outlineReady = true;

            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }
Ejemplo n.º 2
0
		void refillOutlineStore ()
		{
			Runtime.AssertMainThread ();
			Gdk.Threads.Enter ();
			refreshingOutline = false;
			if (outlineTreeStore == null || !outlineTreeView.IsRealized)
				return;
			outlineTreeStore.Clear ();
			
			if (CU != null) {
				DateTime start = DateTime.Now;
				RefillOutlineStore (CU, outlineTreeStore);
				outlineTreeView.ExpandAll ();
				outlineTreeView.ExpandAll ();
				LoggingService.LogDebug ("Built outline in {0}ms", (DateTime.Now - start).Milliseconds);
			}
			
			Gdk.Threads.Leave ();
		}
Ejemplo n.º 3
0
        void RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                return;
            }
            outlineTreeStore.Clear();

            if (ParsedDoc != null)
            {
                DateTime start = DateTime.Now;
                RefillOutlineStore(ParsedDoc, outlineTreeStore);
                outlineTreeView.ExpandAll();
                outlineTreeView.ExpandAll();
                MonoDevelop.Core.LoggingService.LogDebug("Built outline in {0}ms", (DateTime.Now - start).Milliseconds);
            }

            Gdk.Threads.Leave();
        }
Ejemplo n.º 4
0
        public bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();

            //refreshingOutline = false;
            if (TreeStore == null || !TreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;
            TreeStore.Clear();
            try
            {
                if (SyntaxTree != null)
                {
                    var caretLocation = Document.Editor.Caret.Location;
                    BuildTreeChildren(TreeIter.Zero, SyntaxTree, new CodeLocation(caretLocation.Column, caretLocation.Line));


                    if (DCompilerService.Instance.Outline.ExpandAll)
                    {
                        TreeView.ExpandAll();
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogError("Error while updating document outline panel", ex);
            }
            finally
            {
                outlineReady = true;
            }
            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }
Ejemplo n.º 5
0
        bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();
            refreshingOutline = false;
            if (outlineTreeStore == null || !outlineTreeView.IsRealized)
            {
                return(false);
            }

            outlineTreeStore.Clear();
            if (lastCU != null)
            {
                BuildTreeChildren(outlineTreeStore, TreeIter.Zero, lastCU);
                outlineTreeView.ExpandAll();
            }

            Gdk.Threads.Leave();

            //stop timeout handler
            return(false);
        }
Ejemplo n.º 6
0
        Widget IOutlinedDocument.GetOutlineWidget()
        {
            if (outlineView != null)
            {
                return(outlineView);
            }

            if (outlineStore == null)
            {
                throw new Exception("The treestore should be built, before initializing the TreeView of the DocumentOutline");
            }

            outlineView = new MonoDevelop.Ide.Gui.Components.PadTreeView(outlineStore);
            System.Reflection.PropertyInfo prop = typeof(Gtk.TreeView).GetProperty("EnableTreeLines");
            if (prop != null)
            {
                prop.SetValue(outlineView, true, null);
            }
            outlineView.TextRenderer.Xpad = 0;
            outlineView.TextRenderer.Ypad = 0;
            outlineView.ExpandAll();
            outlineView.AppendColumn("Node", outlineView.TextRenderer, new Gtk.TreeCellDataFunc(OutlineTreeDataFunc));
            outlineView.HeadersVisible     = false;
            outlineView.Selection.Changed += delegate {
                Gtk.TreeIter iter = Gtk.TreeIter.Zero;
                outlineView.Selection.GetSelected(out iter);
                DocumentOutlineSelectionChanged(outlineStore.GetValue(iter, 0) as XNode);
            };

            var sw = new MonoDevelop.Components.CompactScrolledWindow();

            sw.Add(outlineView);
            sw.ShowAll();

            return(sw);
        }
Ejemplo n.º 7
0
        public bool RefillOutlineStore()
        {
            DispatchService.AssertGuiThread();
            Gdk.Threads.Enter();

            //refreshingOutline = false;
            if (TreeStore == null || !TreeView.IsRealized)
            {
                refillOutlineStoreId = 0;
                return(false);
            }

            outlineReady = false;

            // Save last selection
            int[]    lastSelectedItem;
            TreeIter i;

            if (TreeView.Selection.GetSelected(out i))
            {
                lastSelectedItem = TreeStore.GetPath(i).Indices;
            }
            else
            {
                lastSelectedItem = null;
            }

            // Save previously expanded items if wanted
            var lastExpanded = new List <int[]>();

            if (DCompilerService.Instance.Outline.ExpansionBehaviour == DocOutlineCollapseBehaviour.ReopenPreviouslyExpanded &&
                TreeStore.GetIterFirst(out i))
            {
                do
                {
                    var path = TreeStore.GetPath(i);
                    if (TreeView.GetRowExpanded(path))
                    {
                        lastExpanded.Add(path.Indices);
                    }
                }while(TreeStore.IterNext(ref i));
            }

            // Clear the tree
            TreeStore.Clear();

            try
            {
                // Build up new tree
                if (SyntaxTree != null)
                {
                    var caretLocation = Document.Editor.Caret.Location;
                    BuildTreeChildren(TreeIter.Zero, SyntaxTree, new CodeLocation(caretLocation.Column, caretLocation.Line));
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogError("Error while updating document outline panel", ex);
            }
            finally
            {
                // Re-Expand tree items
                switch (DCompilerService.Instance.Outline.ExpansionBehaviour)
                {
                case DocOutlineCollapseBehaviour.ExpandAll:
                    TreeView.ExpandAll();
                    break;

                case DocOutlineCollapseBehaviour.ReopenPreviouslyExpanded:
                    foreach (var path in lastExpanded)
                    {
                        TreeView.ExpandToPath(new TreePath(path));
                    }
                    break;
                }

                // Restore selection
                if (lastSelectedItem != null)
                {
                    try
                    {
                        TreeView.ExpandToPath(new TreePath(lastSelectedItem));
                    }
                    catch { }
                }

                outlineReady = true;
            }
            Gdk.Threads.Leave();

            //stop timeout handler
            refillOutlineStoreId = 0;
            return(false);
        }
Ejemplo n.º 8
0
		Widget IOutlinedDocument.GetOutlineWidget ()
		{
			if (outlineView != null)
				return outlineView;
				
			if (outlineStore == null)
				throw new Exception ("The treestore should be built, before initializing the TreeView of the DocumentOutline");
			
			outlineView = new MonoDevelop.Ide.Gui.Components.PadTreeView (outlineStore);
			System.Reflection.PropertyInfo prop = typeof(Gtk.TreeView).GetProperty ("EnableTreeLines");
			if (prop != null)
				prop.SetValue (outlineView, true, null);
			outlineView.TextRenderer.Xpad = 0;
			outlineView.TextRenderer.Ypad = 0;
			outlineView.ExpandAll ();
			outlineView.AppendColumn ("Node", outlineView.TextRenderer, new Gtk.TreeCellDataFunc (OutlineTreeDataFunc));
			outlineView.HeadersVisible = false;
			outlineView.Selection.Changed += delegate {
				Gtk.TreeIter iter = Gtk.TreeIter.Zero;
				outlineView.Selection.GetSelected (out iter);
				DocumentOutlineSelectionChanged (outlineStore.GetValue (iter, 0) as XNode);
			};
			
			var sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.Add (outlineView);
			sw.ShowAll ();
				
			return sw;
		}