none
SDK Package - DSL: Open DSL diagram from custom form designer

    Question

  • Hello, 

    I've developed a custom form designer which at this point generates couple of files among which is a .cs file we use for code behind.
    So when you double click a button an event handler is created and you are positioned in the method's body - like in a standard Windows Forms Designer.

    The idea now is to use a diagram instead, for instance, double click on a button should open up a diagram and select a specific item on it.
    This is a behavior similar to the way C# code editor context menu option "View Class Diagram" opens up the class diagram and selects the method you were in. 

    Any pointers on the right approach to accomplish this would be appreciated.

    Oh, yes, I'm using VS 2008.

    Thanks,
    best regards,
    Vladimir Ilic

    Thursday, November 26, 2009 5:55 PM

Answers

All replies

  • Hi Vladimir Ilic,

    I'm investigating this problem currently, because I'm not sure whether the WinForm designer has provided some events/interfaces to let's capturing its double-click event(seems the IDesignerHost doesn't), and how to locate the specific shape in the DSL diagram.
    After some hours work, I'm still have no clue to achieve this, now I'm checking the code in System.Windows.Forms.Design.ControlDesigner by Reflector, and I also posted it to our product team to ensure whether it's possible.  It may be some time before I get response from the product team, I will let you know the result once I get it.

    Sorry for the inconvenience.

    Sincerely,
    Wesley


    Please mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, December 02, 2009 10:04 AM
  • Thanks for the reply Wesley,

    just to clarify what i have done so far ...

    I have developed VS Package with the custom form designer through a class that inherits from BasicDesignerLoader (based on the sample provided by Microsoft) which serializes the form into xml and generates couple of files :
    .Designer.cs (overwritten on every flush)
    .cs  (user code, created with a new form and edited only to add an event handler for a form event)
    .xmi (overwritten on every flush - contains UML elements such as triggers and behaviors)
    .js (overwritten on every flush - contains javascript form equivalent to the windows form)

    Among other interfaces I implemented IEventBindingService interface to display the Events page in the Property Grid and handle double click on any element of the form being designed. So then in the 

    IEventBindingService ::ShowCode(System.ComponentModel.IComponent component, System.ComponentModel.EventDescriptor e, string methodName)

    method I find the event handler in the .cs file or create a new one (and create a trigger in my UML definition) and position caret on that line.

    At this point I would like to open a diagram and create and/or select certain shape instead of positioning in the .cs file like now.

    Best Regards,
    Vladimir.

    Wednesday, December 02, 2009 11:19 AM
  • Hello

    This all depends on the kind of diagram you want to open. You are using VS2008, so this are not the UML diagrams from VS2010 :-), would that be DSLs?

    In order to open any kind of file in VS, you can always use EnvDTE.DTE.ElementOperations.OpenFile(filename). Selecting an item is really another story that we implement in VS2010 with the ModelBus (see the StateMachineOverModelbus sample in http://code.msdn.microsoft.com/DslTools/Release/ProjectReleases.aspx?ReleaseId=3334)

    Hoping this helps
    best regards




    Jean-Marc
    Wednesday, December 09, 2009 2:56 PM
    Moderator
  • Thanks for the reply Jean-Marc,

    and yes, I want to open DSL diagram as I stated in the title.

    I don't have VS 2010 on my machine so I'll pass these links onto my coworker who's developing DSL diagram to check it out, but I guess will have to wait for VS 2010 in order to implement this functionality.

    Best Regards,
    Vladimir.
    Saturday, December 26, 2009 12:07 AM