Browse Source

SharpTreeView: throw NotSupportedException when required members are not overridden.

pull/1/head
Daniel Grunwald 15 years ago
parent
commit
2cd9d2c146
  1. 10
      SharpTreeView/SharpTreeNode.cs

10
SharpTreeView/SharpTreeNode.cs

@ -156,10 +156,14 @@ namespace ICSharpCode.TreeView
get { return Icon != null; } get { return Icon != null; }
} }
public virtual void LoadChildren() protected virtual void LoadChildren()
{ {
throw new NotSupportedException(GetType().Name + " does not support lazy loading");
} }
/// <summary>
/// Ensures the children were initialized (loads children if lazy loading is enabled)
/// </summary>
public void EnsureLazyChildren() public void EnsureLazyChildren()
{ {
if (LazyLoading) { if (LazyLoading) {
@ -433,10 +437,12 @@ namespace ICSharpCode.TreeView
public virtual void Delete(SharpTreeNode[] nodes) public virtual void Delete(SharpTreeNode[] nodes)
{ {
throw new NotSupportedException(GetType().Name + " does not support deletion");
} }
public virtual void DeleteCore(SharpTreeNode[] nodes) public virtual void DeleteCore(SharpTreeNode[] nodes)
{ {
throw new NotSupportedException(GetType().Name + " does not support deletion");
} }
public virtual bool CanCopy(SharpTreeNode[] nodes) public virtual bool CanCopy(SharpTreeNode[] nodes)
@ -446,7 +452,7 @@ namespace ICSharpCode.TreeView
public virtual IDataObject Copy(SharpTreeNode[] nodes) public virtual IDataObject Copy(SharpTreeNode[] nodes)
{ {
return null; throw new NotSupportedException(GetType().Name + " does not support copy/paste or drag'n'drop");
} }
public virtual bool CanPaste(IDataObject data) public virtual bool CanPaste(IDataObject data)

Loading…
Cancel
Save