I am experimenting with a Visual Studio 2010 extension, where I need to work with the events exposed by IMouseProcessor.
As far as I can tell from the docs, I should
Extending Visual Studio 2010 UML Designers – Part 1: Getting Started
Unfortunately there are a couple of bugs in the current VSSDK Beta 2 that we have to work around. I’ve been told they will be fixed in an update release but until then, let me take you through the project cleanup required to make this work:
Step 1 – Tweak the .csproj file
<IncludeAssemblyInVSIXContainer>
. It will be set to false. Change it to true.Step 2 – Tweak the .vsixmanifest file
At the bottom of the file in the section called add the following line. (Yes, those vertical bars are important.)
<MefComponent>|Yourprojectname|</MefComponent>
Save and close the file.
It took me a while to find the complete solution to this problem, so I will post the complete solution here:
All in all, this code works:
[Export(typeof(IMouseProcessorProvider))]
[ContentType("code")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
[Name("mouseproc")]
internal sealed class MouseProcessorFactory : IMouseProcessorProvider
{
public IMouseProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
{
return new MouseProcessor();
}
}
I believe you need to add a TextViewRole
attribute as well.
[TextViewRole(PredefinedTextViewRoles.Editable)]