void UpdatePath (object sender, Mono.TextEditor.DocumentLocationEventArgs e) { var parsedDocument = Document.ParsedDocument; if (parsedDocument == null || parsedDocument.ParsedFile == null) return; amb = new AstAmbience (document.GetFormattingOptions ()); var unit = parsedDocument.GetAst<SyntaxTree> (); if (unit == null) return; var loc = Document.Editor.Caret.Location; var curType = (EntityDeclaration)unit.GetNodeAt (loc, n => n is TypeDeclaration || n is DelegateDeclaration); var curMember = unit.GetNodeAt<EntityDeclaration> (loc); if (curType == curMember) curMember = null; if (isPathSet && curType == lastType && lastMember == curMember) return; var curTypeMakeup = GetEntityMarkup (curType); var curMemberMarkup = GetEntityMarkup (curMember); if (isPathSet && curType != null && lastType != null && curType.StartLocation == lastType.StartLocation && curTypeMakeup == lastTypeMarkup && curMember != null && lastMember != null && curMember.StartLocation == lastMember.StartLocation && curMemberMarkup == lastMemberMarkup) return; lastType = curType; lastTypeMarkup = curTypeMakeup; lastMember = curMember; lastMemberMarkup = curMemberMarkup; if (curType == null) { if (CurrentPath != null && CurrentPath.Length == 1 && CurrentPath [0].Tag is IUnresolvedFile) return; var prevPath = CurrentPath; CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit } }; OnPathChanged (new DocumentPathChangedEventArgs (prevPath)); return; } // ThreadPool.QueueUserWorkItem (delegate { var result = new List<PathEntry> (); if (curType != null) { var type = curType; while (type != null) { var declaringType = type.Parent as TypeDeclaration; result.Insert (0, new PathEntry (ImageService.GetPixbuf (type.GetStockIcon (false), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = (AstNode)declaringType ?? unit }); type = declaringType; } } if (curMember != null) { result.Add (new PathEntry (ImageService.GetPixbuf (curMember.GetStockIcon (true), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember }); if (curMember is Accessor) { var parent = curMember.Parent as EntityDeclaration; if (parent != null) result.Insert (result.Count - 1, new PathEntry (ImageService.GetPixbuf (parent.GetStockIcon (true), Gtk.IconSize.Menu), GetEntityMarkup (parent)) { Tag = parent }); } } var entry = GetRegionEntry (parsedDocument, loc); if (entry != null) result.Add (entry); PathEntry noSelection = null; if (curType == null) { noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = unit }; } else if (curMember == null && !(curType is DelegateDeclaration)) { noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = curType }; } if (noSelection != null) result.Add (noSelection); var prev = CurrentPath; if (prev != null && prev.Length == result.Count) { bool equals = true; for (int i = 0; i < prev.Length; i++) { if (prev [i].Markup != result [i].Markup) { equals = false; break; } } if (equals) return; } // Gtk.Application.Invoke (delegate { CurrentPath = result.ToArray (); OnPathChanged (new DocumentPathChangedEventArgs (prev)); // }); // }); }