public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { SDBookmark bookmark = value as SDBookmark; if (destinationType == typeof(string) && bookmark != null) { StringBuilder b = new StringBuilder(); if (bookmark is Debugging.BreakpointBookmark) { b.Append("Breakpoint"); } else { b.Append("Bookmark"); } b.Append('|'); b.Append(bookmark.FileName); b.Append('|'); b.Append(bookmark.LineNumber); b.Append('|'); b.Append(bookmark.IsEnabled.ToString()); return(b.ToString()); } else { return(base.ConvertTo(context, culture, value, destinationType)); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); string fileName = v[1]; int lineNumber = int.Parse(v[2], culture); if (lineNumber < 0) { return(null); } SDBookmark bookmark; switch (v[0]) { case "Breakpoint": bookmark = new Debugging.BreakpointBookmark(fileName, null, lineNumber); break; default: bookmark = new SDBookmark(fileName, null, lineNumber); break; } bookmark.IsEnabled = bool.Parse(v[3]); return(bookmark); } else { return(base.ConvertFrom(context, culture, value)); } }
/// <summary> /// Have to add the bookmark to the BookmarkManager otherwise the bookmark is /// not remembered when re-opening the file and does not show in the /// bookmark manager. /// </summary> void BookmarkAdded(object sender, ICSharpCode.TextEditor.Document.BookmarkEventArgs e) { ICSharpCode.SharpDevelop.Bookmarks.SDBookmark b = e.Bookmark as ICSharpCode.SharpDevelop.Bookmarks.SDBookmark; if (b != null) { ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.AddMark(b); } }
public static void AddMark(SDBookmark bookmark) { if (bookmark == null) return; if (bookmarks.Contains(bookmark)) return; if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark))) return; bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) { return; } listView.Add(new ListViewPadItemModel(mark)); }
public static void AddMark(SDBookmark bookmark) { WorkbenchSingleton.AssertMainThread(); if (bookmark == null) return; if (bookmarks.Contains(bookmark)) return; if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark))) return; bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
public static void Clear() { while (bookmarks.Count > 0) { SDBookmark b = bookmarks[bookmarks.Count - 1]; bookmarks.RemoveAt(bookmarks.Count - 1); OnRemoved(new BookmarkEventArgs(b)); } }
public static void AddMark(SDBookmark bookmark) { if (bookmarks.Contains(bookmark)) { return; } bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); FileName fileName = FileName.Create(v[1]); int lineNumber = int.Parse(v[2], culture); int columnNumber = int.Parse(v[3], culture); if (lineNumber < 0) return null; if (columnNumber < 0) return null; SDBookmark bookmark; switch (v[0]) { case "Breakpoint": Debugging.BreakpointAction action = Debugging.BreakpointAction.Break; string scriptLanguage = ""; string script = ""; action = (Debugging.BreakpointAction)Enum.Parse(typeof(Debugging.BreakpointAction), v[5]); scriptLanguage = v[6]; script = v[7]; var bbm = new Debugging.BreakpointBookmark(fileName, new Location(columnNumber, lineNumber), action, scriptLanguage, script); bbm.IsEnabled = bool.Parse(v[4]); bbm.Action = action; bbm.ScriptLanguage = scriptLanguage; bbm.Condition = script; bookmark = bbm; break; case "PinBookmark": var pin = new PinBookmark(fileName, new Location(columnNumber, lineNumber)); pin.Comment = v[4]; pin.PinPosition = new Point { X = double.Parse(v[5], culture), Y = double.Parse(v[6], culture) }; // pop-up nodes pin.SavedNodes = new System.Collections.Generic.List<Tuple<string, string, string>>(); for (int i = 7; i < v.Length; i+=3) { pin.SavedNodes.Add(new Tuple<string, string, string>(v[i], v[i+1], v[i+2])); } bookmark = pin; break; default: bookmark = new SDBookmark(fileName, new Location(columnNumber, lineNumber)); break; } return bookmark; } else { return base.ConvertFrom(context, culture, value); } }
public static void Clear() { WorkbenchSingleton.AssertMainThread(); while (bookmarks.Count > 0) { SDBookmark b = bookmarks[bookmarks.Count - 1]; bookmarks.RemoveAt(bookmarks.Count - 1); OnRemoved(new BookmarkEventArgs(b)); } }
protected void deleteBookMark(SDBookmark bookmark) { if (bookmark == null) { return; } if (bookmark is BreakpointBookmark) { return; } ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.RemoveMark(bookmark); }
static bool IsEqualBookmark(SDBookmark a, SDBookmark b) { if (a == b) return true; if (a == null || b == null) return false; if (a.GetType() != b.GetType()) return false; if (a.FileName != b.FileName) return false; return a.LineNumber == b.LineNumber; }
public void ChangeFilename(string newFileName) { fileName = newFileName; foreach (Bookmark mark in manager.Marks) { SDBookmark sdMark = mark as SDBookmark; if (sdMark != null) { sdMark.FileName = newFileName; } } }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) { return; } var model = new ListViewPadItemModel(mark); model.PropertyChanged += OnModelPropertyChanged; listView.Add(model); }
void TreeViewDoubleClick(object sender, EventArgs e) { TreeNode node = bookmarkTreeView.SelectedNode; if (node != null) { SDBookmark mark = node.Tag as SDBookmark; if (mark != null) { FileService.JumpToFilePosition(mark.FileName, mark.LineNumber, 0); } } }
protected virtual void OnItemActivated(object sender, EventArgs e) { var node = CurrentItem; if (node != null) { SDBookmark mark = node.Mark as SDBookmark; if (mark != null) { FileService.JumpToFilePosition(mark.FileName, mark.LineNumber, 1); } } }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) { return; } if (!fileNodes.ContainsKey(mark.FileName)) { BookmarkFolderNode folderNode = new BookmarkFolderNode(mark.FileName); fileNodes.Add(mark.FileName, folderNode); bookmarkTreeView.Nodes.Add(folderNode); } fileNodes[mark.FileName].AddMark(mark); fileNodes[mark.FileName].Expand(); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); if (v.Length != 8) { return(null); } string fileName = v[1]; int lineNumber = int.Parse(v[2], culture); int columnNumber = int.Parse(v[3], culture); Debugging.BreakpointAction action = Debugging.BreakpointAction.Break; string scriptLanguage = ""; string script = ""; if (v[0] == "Breakpoint") { action = (Debugging.BreakpointAction)Enum.Parse(typeof(Debugging.BreakpointAction), v[5]); scriptLanguage = v[6]; script = v[7]; } if (lineNumber < 0) { return(null); } if (columnNumber < 0) { return(null); } SDBookmark bookmark; switch (v[0]) { case "Breakpoint": bookmark = new Debugging.BreakpointBookmark(fileName, null, new TextLocation(columnNumber, lineNumber), action, scriptLanguage, script); break; default: bookmark = new SDBookmark(fileName, null, new TextLocation(columnNumber, lineNumber)); break; } bookmark.IsEnabled = bool.Parse(v[4]); return(bookmark); } else { return(base.ConvertFrom(context, culture, value)); } }
public BookmarkNode(SDBookmark bookmark) { drawDefault = false; this.bookmark = bookmark; Tag = bookmark; // Checked = bookmark.IsEnabled; positionText = "(" + (bookmark.LineNumber) + ") "; bookmark.DocumentChanged += BookmarkDocumentChanged; bookmark.LineNumberChanged += BookmarkLineNumberChanged; if (bookmark.Document != null) { BookmarkDocumentChanged(null, null); } else { Text = positionText; } }
public void RemoveMark(SDBookmark mark) { marks.Remove(mark); if (isInitialized) { for (int i = 0; i < Nodes.Count; ++i) { if (((BookmarkNode)Nodes[i]).Bookmark == mark) { Nodes.RemoveAt(i); break; } } } SetText(); }
public static void AddMark(SDBookmark bookmark) { if (bookmark == null) { return; } if (bookmarks.Contains(bookmark)) { return; } if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark))) { return; } bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
public static void RemoveAll(Predicate <SDBookmark> match) { if (match == null) { throw new ArgumentNullException("Predicate is null!"); } for (int index = bookmarks.Count - 1; index >= 0; --index) { SDBookmark bookmark = bookmarks[index]; if (match(bookmark)) { bookmarks.RemoveAt(index); OnRemoved(new BookmarkEventArgs(bookmark)); } } }
public static void AddMark(SDBookmark bookmark) { WorkbenchSingleton.AssertMainThread(); if (bookmark == null) { return; } if (bookmarks.Contains(bookmark)) { return; } if (bookmarks.Exists(b => IsEqualBookmark(b, bookmark))) { return; } bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
public BookmarkNode(SDBookmark bookmark) { drawDefault = false; this.bookmark = bookmark; Tag = bookmark; // Checked = bookmark.IsEnabled; positionText = "(" + (bookmark.LineNumber) + ") "; bookmark.DocumentChanged += BookmarkDocumentChanged; bookmark.LineNumberChanged += BookmarkLineNumberChanged; if (bookmark.Document != null) { BookmarkDocumentChanged(null, null); } else { Text = positionText; } }
static bool IsEqualBookmark(SDBookmark a, SDBookmark b) { if (a == b) { return(true); } if (a == null || b == null) { return(false); } if (a.GetType() != b.GetType()) { return(false); } if (!FileUtility.IsEqualFileName(a.FileName, b.FileName)) { return(false); } return(a.LineNumber == b.LineNumber); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); string fileName = v[1]; int lineNumber = int.Parse(v[2], culture); if (lineNumber < 0) return null; SDBookmark bookmark; switch (v[0]) { case "Breakpoint": bookmark = new Debugging.BreakpointBookmark(fileName, null, lineNumber); break; default: bookmark = new SDBookmark(fileName, null, lineNumber); break; } bookmark.IsEnabled = bool.Parse(v[3]); return bookmark; } else { return base.ConvertFrom(context, culture, value); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); if (v.Length != 8) return null; FileName fileName = FileName.Create(v[1]); int lineNumber = int.Parse(v[2], culture); int columnNumber = int.Parse(v[3], culture); Debugging.BreakpointAction action = Debugging.BreakpointAction.Break; string scriptLanguage = ""; string script = ""; if (v[0] == "Breakpoint") { action = (Debugging.BreakpointAction)Enum.Parse(typeof(Debugging.BreakpointAction), v[5]); scriptLanguage = v[6]; script = v[7]; } if (lineNumber < 0) return null; if (columnNumber < 0) return null; SDBookmark bookmark; switch (v[0]) { case "Breakpoint": var bbm = new Debugging.BreakpointBookmark(fileName, new Location(columnNumber, lineNumber), action, scriptLanguage, script); bbm.IsEnabled = bool.Parse(v[4]); bookmark = bbm; break; default: bookmark = new SDBookmark(fileName, new Location(columnNumber, lineNumber)); break; } return bookmark; } else { return base.ConvertFrom(context, culture, value); } }
public void AddMark(SDBookmark mark) { int index = -1; for (int i = 0; i < marks.Count; ++i) { if (mark.LineNumber < marks[i].LineNumber) { index = i; break; } } if (index < 0) { marks.Add(mark); } else { marks.Insert(index, mark); } if (isInitialized) { BookmarkNode newNode = new BookmarkNode(mark); if (index < 0) { Nodes.Add(newNode); } else { Nodes.Insert(index, newNode); } newNode.EnsureVisible(); } SetText(); }
public void AddMark(SDBookmark mark) { int index = -1; for (int i = 0; i < marks.Count; ++i) { if (mark.LineNumber < marks[i].LineNumber) { index = i; break; } } if (index < 0) marks.Add(mark); else marks.Insert(index, mark); if (isInitialized) { BookmarkNode newNode = new BookmarkNode(mark); if (index < 0) Nodes.Add(newNode); else Nodes.Insert(index, newNode); newNode.EnsureVisible(); } SetText(); }
protected virtual bool ShowBookmarkInThisPad(SDBookmark mark) { return(mark.IsVisibleInBookmarkPad && !(mark is Debugging.BreakpointBookmark)); }
protected void deleteBookMark (SDBookmark bookmark) { if (bookmark == null) return; if (bookmark is BreakpointBookmark) return; ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.RemoveMark(bookmark); }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) return; var model = new ListViewPadItemModel(mark); model.PropertyChanged += OnModelPropertyChanged; listView.Add(model); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { SDBookmark bookmark = value as SDBookmark; if (destinationType == typeof(string) && bookmark != null) { StringBuilder b = new StringBuilder(); if (bookmark is DecompiledBreakpointBookmark) { b.Append("DecompiledBreakpointBookmark"); } else if (bookmark is Debugging.BreakpointBookmark) { b.Append("Breakpoint"); } else { if (bookmark is PinBookmark) { b.Append("PinBookmark"); } else { b.Append("Bookmark"); } } b.Append('|'); b.Append(bookmark.FileName); b.Append('|'); b.Append(bookmark.LineNumber); b.Append('|'); b.Append(bookmark.ColumnNumber); if (bookmark is DecompiledBreakpointBookmark) { var bbm = (DecompiledBreakpointBookmark)bookmark; b.Append('|'); b.Append(bbm.IsEnabled.ToString()); b.Append('|'); b.Append(bbm.Action.ToString()); b.Append('|'); b.Append(bbm.ScriptLanguage); b.Append('|'); b.Append(bbm.Condition); } else if (bookmark is Debugging.BreakpointBookmark) { var bbm = (Debugging.BreakpointBookmark)bookmark; b.Append('|'); b.Append(bbm.IsEnabled.ToString()); b.Append('|'); b.Append(bbm.Action.ToString()); b.Append('|'); b.Append(bbm.ScriptLanguage); b.Append('|'); b.Append(bbm.Condition); } if (bookmark is PinBookmark) { var pin = (PinBookmark)bookmark; b.Append('|'); b.Append(pin.Comment ?? string.Empty); // popup position b.Append('|'); b.Append(pin.PinPosition.Value.X); b.Append('|'); b.Append(pin.PinPosition.Value.Y); //popup nodes foreach (var node in pin.Nodes) { b.Append('|'); b.Append(node.ImageName); b.Append('|'); b.Append(node.FullName); b.Append('|'); b.Append(node.Text); } } return(b.ToString()); } else { return(base.ConvertTo(context, culture, value, destinationType)); } }
void AddMark(SDBookmark mark) { if (!mark.IsVisibleInBookmarkPad) return; if (!fileNodes.ContainsKey(mark.FileName)) { BookmarkFolderNode folderNode = new BookmarkFolderNode(mark.FileName); fileNodes.Add(mark.FileName, folderNode); bookmarkTreeView.Nodes.Add(folderNode); } fileNodes[mark.FileName].AddMark(mark); fileNodes[mark.FileName].Expand(); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string[] v = ((string)value).Split('|'); FileName fileName = FileName.Create(v[1]); int lineNumber = int.Parse(v[2], culture); int columnNumber = int.Parse(v[3], culture); if (lineNumber < 0) { return(null); } if (columnNumber < 0) { return(null); } SDBookmark bookmark; switch (v[0]) { case "Breakpoint": Debugging.BreakpointAction action = Debugging.BreakpointAction.Break; string scriptLanguage = ""; string script = ""; action = (Debugging.BreakpointAction)Enum.Parse(typeof(Debugging.BreakpointAction), v[5]); scriptLanguage = v[6]; script = v[7]; var bbm = new Debugging.BreakpointBookmark(fileName, new Location(columnNumber, lineNumber), action, scriptLanguage, script); bbm.IsEnabled = bool.Parse(v[4]); bbm.Action = action; bbm.ScriptLanguage = scriptLanguage; bbm.Condition = script; bookmark = bbm; break; case "PinBookmark": var pin = new PinBookmark(fileName, new Location(columnNumber, lineNumber)); pin.Comment = v[4]; pin.PinPosition = new Point { X = double.Parse(v[5], culture), Y = double.Parse(v[6], culture) }; // pop-up nodes pin.SavedNodes = new System.Collections.Generic.List <Tuple <string, string, string> >(); for (int i = 7; i < v.Length; i += 3) { pin.SavedNodes.Add(new Tuple <string, string, string>(v[i], v[i + 1], v[i + 2])); } bookmark = pin; break; default: bookmark = new SDBookmark(fileName, new Location(columnNumber, lineNumber)); break; } return(bookmark); } else { return(base.ConvertFrom(context, culture, value)); } }
public BookmarkEventArgs(SDBookmark bookmark) { this.bookmark = bookmark; }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) return; if (!fileNodes.ContainsKey(mark.FileName)) { BookmarkFolderNode folderNode = new BookmarkFolderNode(mark.FileName); fileNodes.Add(mark.FileName, folderNode); bookmarkTreeView.Nodes.Add(folderNode); } fileNodes[mark.FileName].AddMark(mark); fileNodes[mark.FileName].Expand(); }
protected virtual bool ShowBookmarkInThisPad(SDBookmark mark) { return mark.IsVisibleInBookmarkPad; }
public static void RemoveMark(SDBookmark bookmark) { bookmarks.Remove(bookmark); OnRemoved(new BookmarkEventArgs(bookmark)); }
public BookmarkEventArgs(SDBookmark bookmark) { this.bookmark = bookmark; }
public static void AddMark(SDBookmark bookmark) { if (bookmarks.Contains(bookmark)) return; bookmarks.Add(bookmark); OnAdded(new BookmarkEventArgs(bookmark)); }
public void RemoveMark(SDBookmark mark) { marks.Remove(mark); if (isInitialized) { for (int i = 0; i < Nodes.Count; ++i) { if (((BookmarkNode)Nodes[i]).Bookmark == mark) { Nodes.RemoveAt(i); break; } } } SetText(); }
void AddMark(SDBookmark mark) { if (!ShowBookmarkInThisPad(mark)) return; listView.Add(new ListViewPadItemModel(mark)); }
protected virtual bool ShowBookmarkInThisPad(SDBookmark mark) { return mark.IsVisibleInBookmarkPad && !(mark is BreakpointBookmark); }
public static void RemoveMark(SDBookmark bookmark) { bookmarks.Remove(bookmark); OnRemoved(new BookmarkEventArgs(bookmark)); }
public static void RemoveMark(SDBookmark bookmark) { WorkbenchSingleton.AssertMainThread(); bookmarks.Remove(bookmark); OnRemoved(new BookmarkEventArgs(bookmark)); }
public static void RemoveMark(SDBookmark bookmark) { WorkbenchSingleton.AssertMainThread(); bookmarks.Remove(bookmark); OnRemoved(new BookmarkEventArgs(bookmark)); }
protected override bool ShowBookmarkInThisPad(SDBookmark mark) { return mark.IsVisibleInBookmarkPad && mark is BreakpointBookmark; }