static void FileRenamed(object sender, ProjectFileRenamedEventArgs e) { bool historyChanged = false; bool closedHistoryChanged = false; foreach (ProjectFileRenamedEventInfo args in e) { foreach (NavigationHistoryItem point in history) { DocumentNavigationPoint dp = point.NavigationPoint as DocumentNavigationPoint; historyChanged &= (dp != null && dp.HandleRenameEvent(args.OldName, args.NewName)); } foreach (NavigationHistoryItem point in history) { ClosedDocumentNavigationPoint cdp = point.NavigationPoint as ClosedDocumentNavigationPoint; closedHistoryChanged &= (cdp != null && cdp.HandleRenameEvent(args.OldName, args.NewName)); } } if (historyChanged) { OnHistoryChanged(); } if (closedHistoryChanged) { OnClosedHistoryChanged(); } }
static NavigationHistoryService() { IdeApp.Workspace.LastWorkspaceItemClosed += delegate { history.Clear(); OnHistoryChanged(); }; IdeApp.Workbench.DocumentClosed += delegate(object sender, DocumentEventArgs e) { ClosedDocumentNavigationPoint point = new ClosedDocumentNavigationPoint( e.Document.FileName, IdeApp.Workbench.Documents.IndexOf(IdeApp.Workbench.ActiveDocument) ); NavigationHistoryItem item = new NavigationHistoryItem(point); closedHistory.AddPoint(item); OnClosedHistoryChanged(); }; //keep nav points up to date TextEditorService.LineCountChanged += LineCountChanged; TextEditorService.LineCountChangesCommitted += CommitCountChanges; TextEditorService.LineCountChangesReset += ResetCountChanges; IdeApp.Workspace.FileRenamedInProject += FileRenamed; IdeApp.Workbench.ActiveDocumentChanged += ActiveDocChanged; }
static NavigationHistoryService () { IdeApp.Workspace.LastWorkspaceItemClosed += delegate { history.Clear (); OnHistoryChanged (); }; IdeApp.Workbench.DocumentClosed += delegate(object sender, DocumentEventArgs e) { ClosedDocumentNavigationPoint point = new ClosedDocumentNavigationPoint ( e.Document.FileName, IdeApp.Workbench.Documents.IndexOf (IdeApp.Workbench.ActiveDocument) ); NavigationHistoryItem item = new NavigationHistoryItem (point); closedHistory.AddPoint (item); OnClosedHistoryChanged (); }; //keep nav points up to date TextEditorService.LineCountChanged += LineCountChanged; TextEditorService.LineCountChangesCommitted += CommitCountChanges; TextEditorService.LineCountChangesReset += ResetCountChanges; IdeApp.Workspace.FileRenamedInProject += FileRenamed; IdeApp.Workbench.ActiveDocumentChanged += ActiveDocChanged; }
public override bool Equals(object o) { ClosedDocumentNavigationPoint dp = o as ClosedDocumentNavigationPoint; return(dp != null && ((FileName != FilePath.Null && FileName == dp.FileName))); }