+                id = wx.NewId()
+                menu.Append(id, _("Close All but \"%s\"" % doc.GetPrintableName()))
+                def OnRightMenuSelect(event):
+                    for i in range(self._notebook.GetPageCount()-1, -1, -1): # Go from len-1 to 0
+                        if i != index:
+                            doc = self._notebook.GetPage(i).GetView().GetDocument()
+                            if not self.GetDocumentManager().CloseDocument(doc, False):
+                                return
+                wx.EVT_MENU(self, id, OnRightMenuSelect)