public void Open(string filename, int line, int column, IWindow window) { if (!File.Exists(filename)) { FLogger.Log(LogType.Error, "File {0} doesn't exist!", filename); return; } foreach (var entry in FExportLifetimeContexts) { var editorNode = entry.Key as INode; var editor = entry.Value.Value; if (new Uri(editor.OpenedFile) == new Uri(filename)) { editor.MoveTo(line, column); FHDEHost.ShowGUI(FindNodeFromInternal(editorNode)); return; } } // if (window == null) // { // // Before we open the editor in a new window, see if the file to // // open is a project file and search for an editor already // // editing this project. // // If we find one, open the editor there. // var project = FSolution.FindProject(filename); // if (project != null && project.IsLoaded) // { // foreach (var doc in project.Documents) // { // var docFilename = doc.Location.LocalPath; // // var editorNodes = // from entry in FExportLifetimeContexts // let e = entry.Value.Value // where new Uri(e.OpenedFile) == new Uri(docFilename) // select entry.Key as INode; // // var editorNode = editorNodes.First(); // if (editorNode != null) // { // window = editorNode.Window; // break; // } // } // } // } // The following Open will trigger a call by vvvv to IInternalHDEHost.ExtractNodeInfos() // Force the hde host to collect node infos from us only. var addonFactories = new List <IAddonFactory>(FHDEHost.AddonFactories); try { FMoveToLine = line; FMoveToColumn = column; FInOpen = true; FHDEHost.AddonFactories.Clear(); FHDEHost.AddonFactories.Add(this); FHDEHost.Open(filename, false, window); } finally { FInOpen = false; FHDEHost.AddonFactories.Clear(); FHDEHost.AddonFactories.AddRange(addonFactories); foreach (var factory in addonFactories) { try { factory.ExtractNodeInfos(filename, null).ToList(); } catch (Exception) { // Swallow exceptions } } } }