Skip to content

d-kochanzhi/VSExtensibilityHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

VSExtensibilityHelper

Basic useful feature list:

Services:

  • DteService
  • MsgBoxService
  • PaneService
  • ServiceLocator

Core:

  • BaseEditorFactory
  • BaseEditorPane
  • BaseWinFormsEditorPane
  • BaseWpfEditorPane

Making custom VSIX Editor for "*.myExtension" files example:

 public sealed class WinFormsEditorFactory 
 	: BaseEditorFactory<WinFormsEditorEditorPane>
{
}

public class WinFormsEditorEditorPane 
	: BaseWinFormsEditorPane<WinFormsEditorFactory, Controls.WinForms.WinFormUserControl>
{
	#region Methods

    protected override string GetFileExtension()
    {
    	return ".myExtension";
    }
    protected override void LoadFile(string fileName)
    {}
	protected override void SaveFile(string fileName)
    {}    

    #endregion Methods
}

Package registration:

 [ProvideEditorExtension(typeof(Editors.WinFormsEditorFactory), ".myExtension", 50,
      ProjectGuid = "7D346946-3421-48C0-A98A-20790CB68B3C", NameResourceID = 133,
      TemplateDir = @".\NullPath")]
public sealed class VSPackageCustomEditors : Package
{
 	protected override void Initialize()
	{
        base.Initialize();

            /*
             * Registering editor with WinForms control
             * *.myExtension
             */
            base.RegisterEditorFactory(new Editors.WinFormsEditorFactory()); 
    }
}

Sample project

\src\VSIXProject_Editor

Result

image

image

Based on:

License

This project is licensed under the MIT License