@@ -66,9 +66,30 @@ private void ObjectInvariants()
6666 Contract . Invariant ( LevelsOpen != null ) ;
6767 }
6868
69+ /// <summary>
70+ /// Creates an instance of the specific node type.
71+ /// </summary>
72+ /// <param name="nodeType">The <see cref="Type"/> of the node.</param>
73+ /// <returns>An instance of the node type or null if the type is not a valid node type.</returns>
6974 public static BaseNode CreateInstanceFromType ( Type nodeType )
7075 {
71- return Activator . CreateInstance ( nodeType ) as BaseNode ;
76+ return CreateInstanceFromType ( nodeType , true ) ;
77+ }
78+
79+ /// <summary>
80+ /// Creates an instance of the specific node type.
81+ /// </summary>
82+ /// <param name="nodeType">The <see cref="Type"/> of the node.</param>
83+ /// <param name="callInitialize">If true <see cref="Intialize"/> gets called for the new node.</param>
84+ /// <returns>An instance of the node type or null if the type is not a valid node type.</returns>
85+ public static BaseNode CreateInstanceFromType ( Type nodeType , bool callInitialize )
86+ {
87+ var node = Activator . CreateInstance ( nodeType ) as BaseNode ;
88+ if ( callInitialize )
89+ {
90+ node ? . Intialize ( ) ;
91+ }
92+ return node ;
7293 }
7394
7495 /// <summary>Constructor which sets a unique <see cref="Name"/>.</summary>
@@ -85,6 +106,44 @@ protected BaseNode()
85106
86107 public abstract void GetUserInterfaceInfo ( out string name , out Image icon ) ;
87108
109+ public virtual bool UseMemoryPreviewToolTip ( HotSpot spot , MemoryBuffer memory , out IntPtr address )
110+ {
111+ Contract . Requires ( spot != null ) ;
112+ Contract . Requires ( memory != null ) ;
113+
114+ address = IntPtr . Zero ;
115+
116+ return false ;
117+ }
118+
119+ /// <summary>Gets informations about this node to show in a tool tip.</summary>
120+ /// <param name="spot">The spot.</param>
121+ /// <param name="memory">The process memory.</param>
122+ /// <returns>The information to show in a tool tip or null if no information should be shown.</returns>
123+ public virtual string GetToolTipText ( HotSpot spot , MemoryBuffer memory )
124+ {
125+ Contract . Requires ( spot != null ) ;
126+ Contract . Requires ( memory != null ) ;
127+
128+ return null ;
129+ }
130+
131+ /// <summary>Called when the node was created. Does not get called after loading a project.</summary>
132+ public virtual void Intialize ( )
133+ {
134+
135+ }
136+
137+ /// <summary>Initializes this object from the given node. It copies the name and the comment.</summary>
138+ /// <param name="node">The node to copy from.</param>
139+ public virtual void CopyFromNode ( BaseNode node )
140+ {
141+ Contract . Requires ( node != null ) ;
142+
143+ Name = node . Name ;
144+ Comment = node . Comment ;
145+ }
146+
88147 /// <summary>
89148 /// Gets the parent class of the node.
90149 /// </summary>
@@ -139,45 +198,6 @@ public virtual void ClearSelection()
139198 IsSelected = false ;
140199 }
141200
142- /// <summary>Initializes this object from the given node. It copies the name and the comment.</summary>
143- /// <param name="node">The node to copy from.</param>
144- public virtual void CopyFromNode ( BaseNode node )
145- {
146- Contract . Requires ( node != null ) ;
147-
148- Name = node . Name ;
149- Comment = node . Comment ;
150- }
151-
152-
153- /// <summary>Called when the node was created. Does not get called after loading a project.</summary>
154- public virtual void Intialize ( )
155- {
156-
157- }
158-
159- public virtual bool UseMemoryPreviewToolTip ( HotSpot spot , MemoryBuffer memory , out IntPtr address )
160- {
161- Contract . Requires ( spot != null ) ;
162- Contract . Requires ( memory != null ) ;
163-
164- address = IntPtr . Zero ;
165-
166- return false ;
167- }
168-
169- /// <summary>Gets informations about this node to show in a tool tip.</summary>
170- /// <param name="spot">The spot.</param>
171- /// <param name="memory">The process memory.</param>
172- /// <returns>The information to show in a tool tip or null if no information should be shown.</returns>
173- public virtual string GetToolTipText ( HotSpot spot , MemoryBuffer memory )
174- {
175- Contract . Requires ( spot != null ) ;
176- Contract . Requires ( memory != null ) ;
177-
178- return null ;
179- }
180-
181201 /// <summary>Draws the node.</summary>
182202 /// <param name="view">The view information.</param>
183203 /// <param name="x">The x coordinate.</param>
0 commit comments