You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.0 KiB
128 lines
3.0 KiB
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) |
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) |
|
|
|
using System; |
|
using System.Windows; |
|
using System.Windows.Input; |
|
using ICSharpCode.Core; |
|
using ICSharpCode.Core.Presentation; |
|
using ICSharpCode.NRefactory.TypeSystem; |
|
|
|
namespace ICSharpCode.SharpDevelop.Bookmarks |
|
{ |
|
/// <summary> |
|
/// Bookmark used to give additional operations for class members. |
|
/// Does not derive from SDBookmark because it is not stored in the central BookmarkManager, |
|
/// but only in the document's BookmarkManager. |
|
/// </summary> |
|
public class ClassMemberBookmark : IBookmark |
|
{ |
|
IMember member; |
|
|
|
public IMember Member { |
|
get { |
|
return member; |
|
} |
|
} |
|
|
|
public ClassMemberBookmark(IMember member) |
|
{ |
|
this.member = member; |
|
} |
|
|
|
public const string ContextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassMemberContextMenu"; |
|
|
|
public virtual IImage Image { |
|
get { return ClassBrowserIconService.GetIcon(member); } |
|
} |
|
|
|
public int LineNumber { |
|
get { return member.Region.BeginLine; } |
|
} |
|
|
|
public virtual void MouseDown(MouseButtonEventArgs e) |
|
{ |
|
if (e.ChangedButton == MouseButton.Left) { |
|
var f = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Bookmarks.ClassMemberBookmark.ShowContextMenu"); |
|
var ctx = MenuService.ShowContextMenu(e.Source as UIElement, this, ContextMenuPath); |
|
ctx.Closed += delegate { f.EndTracking(); }; |
|
e.Handled = true; |
|
} |
|
} |
|
|
|
public virtual void MouseUp(MouseButtonEventArgs e) |
|
{ |
|
} |
|
|
|
int IBookmark.ZOrder { |
|
get { return -10; } |
|
} |
|
|
|
bool IBookmark.CanDragDrop { |
|
get { return false; } |
|
} |
|
|
|
void IBookmark.Drop(int lineNumber) |
|
{ |
|
throw new NotSupportedException(); |
|
} |
|
} |
|
|
|
public class ClassBookmark : IBookmark |
|
{ |
|
ITypeDefinition @class; |
|
|
|
public ITypeDefinition Class { |
|
get { |
|
return @class; |
|
} |
|
set { |
|
@class = value; |
|
} |
|
} |
|
|
|
public ClassBookmark(ITypeDefinition @class) |
|
{ |
|
this.@class = @class; |
|
} |
|
|
|
public const string ContextMenuPath = "/SharpDevelop/ViewContent/DefaultTextEditor/ClassBookmarkContextMenu"; |
|
|
|
public virtual IImage Image { |
|
get { |
|
return ClassBrowserIconService.GetIcon(@class); |
|
} |
|
} |
|
|
|
public int LineNumber { |
|
get { return @class.Region.BeginLine; } |
|
} |
|
|
|
public virtual void MouseDown(MouseButtonEventArgs e) |
|
{ |
|
if (e.ChangedButton == MouseButton.Left) { |
|
var f = AnalyticsMonitorService.TrackFeature("ICSharpCode.SharpDevelop.Bookmarks.ClassBookmark.ShowContextMenu"); |
|
var ctx = MenuService.ShowContextMenu(e.Source as UIElement, this, ContextMenuPath); |
|
ctx.Closed += delegate { f.EndTracking(); }; |
|
e.Handled = true; |
|
} |
|
} |
|
|
|
public virtual void MouseUp(MouseButtonEventArgs e) |
|
{ |
|
} |
|
|
|
int IBookmark.ZOrder { |
|
get { return -10; } |
|
} |
|
|
|
bool IBookmark.CanDragDrop { |
|
get { return false; } |
|
} |
|
|
|
void IBookmark.Drop(int lineNumber) |
|
{ |
|
throw new NotSupportedException(); |
|
} |
|
} |
|
}
|
|
|