Since the series of articles analyzed by SharpDevelop Source Code, many friends gave a good evaluation, thank you for your encouragement. In addition, a friend who commented that I would like to see the AddintreeView plug-in in the article. In fact, this is a very simple little thing, so I will have a separate issue (it seems that I can upload the file there, so I directly post the code) .
If you want to see another article, you can find (or in my blog list):
SharpDevelop Source Code Analysis (First, Order Basic Concept)
SharpDevelop source analysis (II, main program hidden initialization)
SharpDevelop source analysis (three, plugin system)
AddintreeViewCommand.cs
/ ** /
/ * * Created by SharpDevelop. * User: Administrator * Date: 2004-10-4 * Time: 4:12 * * To change this Template Use Tools | Options | Coding | Edit Standard Headers. * /
Using
System;
Using
System.windows.forms;
Using
System.codedom.compiler;
Using
Icsharpcode.sharpdevelop.gui;
Using
Icsharpcode.sharpdevelop.gui.pads;
Using
Icsharpcode.core.addins;
Using
Icsharpcode.core.addins.codons;
Using
Icsharpcode.sharpDevelop.services;
Namespace
Addins.AddintreeView
{/ ** ////
}} Public void SaveFile () {} public void Undo () {} public void Redo () {} public override void Save () {} public override void Save (string filename) {} public override void Load (string filename) { } Public override string tabpageText {get {return "addintree";}}}} addintreeViewControl.cs
Using
System;
Using
System.collections;
Using
System.componentmodel;
Using
System.drawing;
Using
System.data;
Using
System.windows.forms;
Using
Icsharpcode.sharpdevelop.gui;
Using
Icsharpcode.core.addins;
Using
Icsharpcode.core.addins.codons;
Namespace
Addins.AddintreeView
{/ ** ////
/// summary> private void InitializeComponent () {this.chName = new System.Windows.Forms.ColumnHeader (); this.lvAddin = new System.Windows.Forms.ListView (); this.chValue = new System. Windows.Forms.ColumnHeader (); this.chInfo = new System.Windows.Forms.ColumnHeader (); this.cbShowAddinInfo = new System.Windows.Forms.CheckBox (); this.splitter2 = new System.Windows.Forms.Splitter (); This.lvdebug = new system.windows.forms.listview (); this.splitter1 = new system.windows.forms.splitter (); this.tvaddin = new system.windows.forms.treeView (); this. SuspendLayout (); // // chname // this.chname.text = "attribute"; this.chname.width = 217; /// lvaddin // this.lvaddin.columns.addrange (new system.windows.form.forms .Columnheader [] {] { this.chName, this.chValue}); this.lvAddin.Dock = System.Windows.Forms.DockStyle.Fill; this.lvAddin.FullRowSelect = true; this.lvAddin.GridLines = true; this.lvAddin.HoverSelection = true; This.lvaddin.location = new system.drawing.point (443, 24); this.lvaddin.multiSelect = false; this.lvaddin.name = "lvaddin"; this.lvaddin.size = new system.drawing.size (661 , 509); this.lvaddin.tabindex = 13;
This.lvaddin.view = system.windows.Forms.view.details; // // chavalue // this.chvalue.text = "value"; this.chvalue.width = 668; /// chinfo // this. chInfo.Text = "Info"; this.chInfo.Width = 673; // // cbShowAddinInfo // this.cbShowAddinInfo.Dock = System.Windows.Forms.DockStyle.Top; this.cbShowAddinInfo.Location = new System.Drawing. Point (443, 0); this.cbShowAddinInfo.Name = "cbShowAddinInfo"; this.cbShowAddinInfo.Size = new System.Drawing.Size (661, 24); this.cbShowAddinInfo.TabIndex = 12; this.cbShowAddinInfo.Text = " Displaying Codon membership Addin information "; // // splitter2 // this.splitter2.dock = system.windows.forms.dockstyle.Bottom; this.splitter2.Location = new system.drawing.point (443, 533); this .splitter2.name = "splitter2"; This.Splitter2.Size = new system.drawing.size (661, 3); this.splitter2.tabindex = 11; this.splitter2.tabstop = false; this.splitter2.visible = false; // // lvdebug // this .lvDebug.Columns.AddRange (new System.Windows.Forms.ColumnHeader [] {this.chInfo}); this.lvDebug.Dock = System.Windows.Forms.DockStyle.Bottom; this.lvDebug.Location = new System.Drawing .Point (443, 536); this.lvdebug.name = "
Lvdebug "; this.lvdebug.size = new system.drawing.size (661, 216); this.lvdebug.tabindex = 10; this.lvdebug.view = system.windows.Forms.View.Details; this.lvdebug.visible = False; // // // splitter1 // this.splitter1.Location = new system.drawing.point (440, 0); this.splitter1.name = "splitter1"; this.splitter1.size = new system.drawing.size (3, 752); this.splitter1.tabindex = 9; this.splitter1.tabstop = false; // // TVAddin // this.tvaddin.dock = system.windows.forms.dockstyle.wind; this.tvaddin.FullrowSelectElect = True; this.tvaddin.hideselection = false; this.tvaddin.imageIndex = -1; this.tvaddin.location = new system.drawing.point (0, 0); this.tvaddin.name = "tvaddin"; this. Tvaddin.selectedImageIndex = -1; this.tvaddin.size = new system.draw ing.Size (440, 752); this.tvAddin.TabIndex = 8; this.tvAddin.AfterSelect = new System.Windows.Forms.TreeViewEventHandler (this.tvAddin_AfterSelect); // // AddinTreeViewControl // this.Controls.Add (thislvaddin); this.Controls.add (this.cbshowaddinInfo); this.controls.add (this.splitter2); this.controls.add (this.lvdebug); this.controls.add (this.splitter1); This.Controls.add (this.tvaddin); this.name = "addintreeViewControl"; this.size = new system.drawing.size (1104, 752);
this.ResumeLayout (false);} #endregion void InitAddinTreeView () {TreeNode pathNode = tvAddin.Nodes.Add ( "AddinRoot"); tvAddin.BeginUpdate (); try {foreach (AddIn addIn in AddInTreeSingleton.AddInTree.AddIns) {foreach (Icsharpcode.core.Addins.addin.extension e in addin.extensions) {string [] Paths = E.Path.Split ('/'); PathNode = tvaddin.nodes [0]; for (int i = 0; i Pathnode.tag = new arraylist (); //lvdebug.Items.add ("add " E.PATH " ---- " Paths [i]);}} (pathnode.tag as arraylist) .add ( e);}}} finally {tvAddin.EndUpdate ();}} void AddInfo (string Name, string Value) {lvAddin.Items.Add (Name) .SubItems.Add (Value);} private void tvAddin_AfterSelect (object sender, System.windows.Forms.TreeViewEventargs e) {lvaddin.items.clear (); if (e.node.tag! = Null) {foreach (addin.extension et in (e.node.tag as arraylist) {AddInfo "Extension", et.tostring ()); foreach (icodon codon in et.codoncollection) {addInfo ("┏ Codon ID ", Codon.id); AddInfo (" ┣ Codon name ", Codon.Name); AddInfo (" ┗ Codon Class ", CODON.CLASS); if (CBShowAddinInfo.checked) {AddInfo (" ┣ addin name ", Codon. Addin.Name); AddInfo ("┗ addin filename", codon.addin.filename); foreach (ICSharpcode.core.addins.addin.extension ex in codon.addin.extensions) {addInfo ("