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

Attachment: visualclasswithinterface.png
Description: PNG image

Reply via email to