internal Document WrapDocument(IWorkbenchWindow window) { if (window == null) { return(null); } Document doc = FindDocument(window); if (doc != null) { return(doc); } doc = new Document(window); window.Closing += OnWindowClosing; window.Closed += OnWindowClosed; documents.Add(doc); doc.OnDocumentAttached(); OnDocumentOpened(new DocumentEventArgs(doc)); return(doc); }