Hi Kasper,

>Hello Janak
>
>thanks for your answer. Unfortunately, that's only partially of what I
>was looking for.
>
>In our application, we create panels with the ULC VE, e.g. a Panel based
>on BoxLayoutPane.
>However, we have different type aspects that a panel can possess, which
>are typically realized as interfaces and be it only a marker interface
>
>Now, while editing, we would like to offer the user the opportunity to
>add and remove such type aspects, i.e. AFTER creation of the class, by
>selecting them from a menu or dialog.

>Therefore, if the user chooses the type A for the visual class currently
>being edited, we would like to instantly add "implements A" and of
>course also a default implementation of A (and the reverse, if the user
>deselects the type A) to the source of "this".
>
>Is such a thing possible at all? I suppose so, by modifying the VE model
>of the visual class, but how?

As far as I know such dynamic addition and removal of source code via VE is
not possible.

However, you can ask the Eclipse VE team on their mailing list at
[EMAIL PROTECTED]

I guess such a thing should be possible with Eclipse's Java Development
Tool. Perhaps you can have a rt-clk pop-up menu on the class and then
manipulate its Java model.

>The hack would of course be to get the source file through the resource
>layer and modify it, passing by the VE completely - but I don't know if
>that will automatically refresh the VE model? Plus, it does not seem
>very elegant.

The VE constantly parses the source to update the model behind the view on
the canvas. Moreover, it understands specific code patterns only.


>Thanks for any further help,
>Kaspar
>
>> -----Original Message-----
>> From: "Janak Mulani" <[EMAIL PROTECTED]>
>> To: <[email protected]>
>> Subject: RE: [ULC-developer] Code generation with ULC VE
>> Date: Thu, 21 Sep 2006 17:24:18 +0530
>> Reply-To: [email protected]
>>
>> This is a multi-part message in MIME format.
>>
>> ------=_NextPart_000_0000_01C6DDA2.C4E43B50
>> Content-Type: text/plain;
>>      charset="us-ascii"
>> Content-Transfer-Encoding: 7bit
>>
>> Hi Kasper,
>>
>> As I understand, you want to create a ULC visual class that implements
>> certain interfaces. For example:
>>
>> public class MyPanel extends ULCBoxPane implements IActionListener,
>> IFocusListener {
>>
>>      public void actionPerformed(ActionEvent event) {
>>              // TODO Auto-generated method stub
>>
>>      }
>>
>>      public void focusGained(FocusEvent event) {
>>              // TODO Auto-generated method stub
>>
>>      }
>>
>>      public void focusLost(FocusEvent event) {
>>              // TODO Auto-generated method stub
>>
>>      }
>>
>>      public MyPanel() {
>>              super();
>>              initialize();
>>      }
>>
>>      /**
>>       * This method initializes AAAA
>>       *
>>       * @return void
>>       */
>>      public void initialize() {
>>
>>      }
>> }
>>
>> Is this what you want to do? If so, you can specify the
>> Interface at the
>> time of creating the class. When you say "New > Visual
>> Class", a dialog
>> comes up where you can specify the package, class name, base class,
>> interfaces, etc. See the attached figure.
>>
>> The VE will automatically generate stubs for methods of the
>> interfaces. Let
>> me know if this answers your question.
>>
>> In case you want to generate default implementation of
>> interface methods,
>> you will have to make use of templates using the extension point
>> "org.eclipse.ve.java.core.newStyleComponent":
>>
>>      <extension
>>              point="org.eclipse.ve.java.core.newStyleComponent">
>>              <category
>>                      name="ULC"
>>                      id="com.canoo.ulc.visualeditor.cat"
>>                      priority="300"
>>                      defaultExpand="false">
>>              </category>
>>              <visualElement
>>
>> type="com.ulcjava.base.application.AbstractApplication"
>>                      icon="icons/clcl16/frame_obj.gif"
>>                      category="com.canoo.ulc.visualeditor.cat"
>>
>> contributor="com.canoo.ulc.visualeditor.ULCApplicationSourceContr
>> ibutor"
>>                      name="ULC Application">
>>              </visualElement>
>>
>> You will have to create your own plugin. In the plugin.xml,
>> specify the
>> above extension, define a
>> IVisualClassCreationSourceContributor class and
>> corresponding template (a .javajet) file. Please refer to
>> ulc-ve-5.1.1\eclipse\plugins\com.canoo.ulc.visualeditor_5.1.1'
>> s plugin.xml
>> and templates directory.
>>
>> Thanks and regards,
>>
>> Janak
>>
>>
>> >-----Original Message-----
>> >From: [EMAIL PROTECTED]
>> >[mailto:[EMAIL PROTECTED] Behalf Of Kaspar von
>> >Gunten
>> >Sent: Thursday, September 21, 2006 12:34 PM
>> >To: [email protected]
>> >Subject: [ULC-developer] Code generation with ULC VE
>> >
>> >
>> >Hi
>> >
>> >I have two questions regarding code generation with the (ULC) VE.
>> >
>> >Q1)
>> >
>> >I would like to add one or more specific interfaces to the
>> visual class
>> >currently being edited (for example with a pop-up menu action).
>> >
>> >>From the EditPart which I retrieve from either the BeanTree
>> or the GEF
>> >Editor I can retrieve the JavaInstance object of the root
>> panel EditPart
>> >(i.e. "this") which typically corresponds to the class being edited
>> >(i.e. the model). But from there I do not know how to
>> proceed in order
>> >to add an Interface.
>> >
>> >Is the described approach of starting with the currently selected
>> >EditPart even correct?
>> >Can anybody help me with this issue?
>> >
>> >Q2)
>> >
>> >How do I add a piece of code (or a method implementation) to
>> a specific
>> >VisualClass, also programmatically (for example a default
>> implementation
>> >of the method that the above mentioned and added interface would
>> >require)?
>> >
>> >Thank you for any help.
>> >Kaspar von Gunten
>> >
>> >_______________________________________________
>> >ULC-developer mailing list
>> >[email protected]
>> >http://lists.canoo.com/mailman/listinfo/ulc-developer
>_______________________________________________
>ULC-developer mailing list
>[email protected]
>http://lists.canoo.com/mailman/listinfo/ulc-developer

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to