Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / April 2006

Tip: Looking for answers? Try searching our database.

IVsSingleFileGenerator Generate method call

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gabriel Bota - 18 Apr 2006 09:03 GMT
Hi,

In my Visual Studio I have a VS plug-in for editing XML schema definition
files (.xsd) and a VS plug-in for generating .cs files from .xsd files. This
is achieved by using the Custom Tool Property of the xsd files that are part
of the project. When the "Run Custom Tool" context menu option is being
selected it gets called with a string filled with the contents of the file.
Where do these file contents come from? I could not find anything in the
documentation on this issue. It seems that the contents are coming from the
editor but I do not know how. Fact is that if the file is open with my custom
.xsd editor the file contents are in an ASCII string. If the file is not open
the contents are in an Unicode string.
Which interface shall be implemented by the editor to pass the file contents
to the IVsSingleFileGenerator::Generate method correctly?

Any help will be appreciated.
Thanks,
Gabriel Bota.
Stuart Carnie - 18 Apr 2006 17:26 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks,
> Gabriel Bota.

Have you created a custom editor, or are you using a provided Visual
Studio editor, such as the XML editor or XSD designer?

The contents come from an in memory buffer, which is managed by Visual
Studio.  One interface I suggest you look at is IVsTextLines.

There is a good example of an editor in the VSIP sdk on these.

under VisualStudioIntegration\Samples\IDE\CSharp, see Example.XmlDesigner

Cheers,

Stu
Gabriel Bota - 19 Apr 2006 08:00 GMT
> > Hi,
> >
[quoted text clipped - 28 lines]
>
> Stu

Hi Stu,

Thanks for the answer. It is a custom editor. If the xsd file is open with
the XSD designer or with the XML editor from VS the problem does not appear.
I'll take a look at the samples that you directed me to. But....
IVsTextLines is the interface that my editor will have to implement? Did I
get this right?

Thanks,
Gabriel.
Stuart Carnie - 19 Apr 2006 17:29 GMT
>>> Hi,
>>>
[quoted text clipped - 38 lines]
> Thanks,
> Gabriel.

No, but you should notify this interface of any changes to your editors
buffer via the IVsTextLines interface.  In my custom editor (which also
permits the Xml editor), I call the IVsTextLines::ReplaceLines method
any time my buffer changes, so the Xml editor view is updated
accordingly and additionally, my SingleFileGenerator recieves update
notifications to regen the code.

Cheers,

Stu

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.