Skip to content

Commit

Permalink
#9
Browse files Browse the repository at this point in the history
  • Loading branch information
sboulema committed Feb 14, 2017
1 parent de11312 commit 982de9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CodeNav/CodeNav.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public CodeNav(IWpfTextViewHost textViewHost, DTE dte)
_documentEvents = dte.Events.DocumentEvents;
_window = GetWindow(textViewHost, dte);

// If we can not find the window we belong to we can not do anything
if (_window == null) return;

// Setup the backgroundworker that will map the document to the codeitems
_backgroundWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_backgroundWorker.DoWork += BackgroundWorker_DoWork;
Expand All @@ -61,6 +64,7 @@ public CodeNav(IWpfTextViewHost textViewHost, DTE dte)
Children.Add(_codeNavGrid);

RegisterEvents();

LogHelper.Log($"CodeNav initialized for {_window.Caption}");
}

Expand Down
9 changes: 8 additions & 1 deletion CodeNav/Mappers/CodeItemMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ private static T MapBase<T>(CodeElement source) where T : CodeItem
element.Name = source.Name;
element.FullName = source.FullName;
element.Id = source.Name;
element.StartPoint = source.StartPoint;
try
{
element.StartPoint = source.StartPoint;
}
catch (Exception)
{
LogHelper.Log($"Could not find a StartPoint for {source.FullName}");
}
element.Foreground = CreateSolidColorBrush(Colors.Black);
element.Tooltip = element.FullName;
element.Access = MapAccessToEnum(source);
Expand Down

0 comments on commit 982de9c

Please sign in to comment.