locked
Custom tool to offer code behind and generated code RRS feed

  • Question

  • Hello,
    I'm creating custom tool to process XML files. However, I would like, besides the generated code class, allow user to extend the generated code, just as you can with Windows Forms designer for example - you have on generated file and file which you can write your code into (using View Code button).

    Is there any easy way for the custom tool to allow this scenario too?

    Thanks,
    Jan
    Sunday, November 16, 2008 11:18 AM

Answers

  • I'm basically asking if a custom tool can add "view code"/"view designer" functionality to a file
    No, this is not possible. This is determined by the edtior associated with the file type.

    Return to the source, learn the way!
    • Proposed as answer by FengChen Sunday, November 16, 2008 2:42 PM
    • Marked as answer by Jan Kučera Sunday, November 16, 2008 2:53 PM
    Sunday, November 16, 2008 2:39 PM
  • A custom tool is a COM component that implements the IVsSingleFileGenerator interface. Using this interface, a custom tool transforms a single input file into a single output file.

    Thanks.

    Return to the source, learn the way!
    • Proposed as answer by FengChen Sunday, November 16, 2008 2:53 PM
    • Marked as answer by Jan Kučera Sunday, November 16, 2008 2:53 PM
    Sunday, November 16, 2008 2:53 PM

All replies

  • Do you mean a two-way sync? When the user change the generated code file, the xml file can then be updated?
    Return to the source, learn the way!
    Sunday, November 16, 2008 2:08 PM
  • Hi FengChen,
    actually no. The WPF designer is a better example - it shows XAML, generates (hidden) code behind which instantiates the elements described in XAML, and when you click "view code", you will be presented a different code file - actually separated from the XAML -, which you can edit - add event handlers etc., and nothing gets back to the XAML.

    I'm basically asking if a custom tool can add "view code"/"view designer" functionality to a file, besides generating the hidden one.

    Jan
    Sunday, November 16, 2008 2:37 PM
  • I'm basically asking if a custom tool can add "view code"/"view designer" functionality to a file
    No, this is not possible. This is determined by the edtior associated with the file type.

    Return to the source, learn the way!
    • Proposed as answer by FengChen Sunday, November 16, 2008 2:42 PM
    • Marked as answer by Jan Kučera Sunday, November 16, 2008 2:53 PM
    Sunday, November 16, 2008 2:39 PM
  •  Thanks, and last try - can it create two files instead of one to mimick this functionality? Or would you suggest creating rather editor instead of custom tool in this case?
    Sunday, November 16, 2008 2:42 PM
  • What exactly you want to achieve?
    Return to the source, learn the way!
    Sunday, November 16, 2008 2:44 PM
  • Well when I think about it... I really want to create something very like WPF designer, but I thought that by giving up the actual designer surface (and keeping standard XML editor) I could keep it as easy as custom tool...
    Sunday, November 16, 2008 2:49 PM
  • A custom tool is a COM component that implements the IVsSingleFileGenerator interface. Using this interface, a custom tool transforms a single input file into a single output file.

    Thanks.

    Return to the source, learn the way!
    • Proposed as answer by FengChen Sunday, November 16, 2008 2:53 PM
    • Marked as answer by Jan Kučera Sunday, November 16, 2008 2:53 PM
    Sunday, November 16, 2008 2:53 PM
  • Thank you for your thoughts.
    Jan
    Sunday, November 16, 2008 2:54 PM