Generated code - Websphere

This is a discussion on Generated code - Websphere ; Hi, How can I customize the Studio in order to generate code using short names? Ex: Generate : import javax.swing.JLabel; or import javax.swing.*; ..... JLabel l = new JLabel(); Instead of javax.swing.JLabel l = new javax.swing.JLabel(); Thanks, Lau...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Generated code

  1. Generated code

    Hi,
    How can I customize the Studio in order to generate code using short names?

    Ex: Generate :

    import javax.swing.JLabel; or import javax.swing.*;
    .....
    JLabel l = new JLabel();

    Instead of

    javax.swing.JLabel l = new javax.swing.JLabel();

    Thanks,
    Lau



  2. Re: Generated code

    > Hi,
    > How can I customize the Studio in order to generate code using short names?
    >
    > Ex: Generate :
    >
    > import javax.swing.JLabel; or import javax.swing.*;
    > ...
    > JLabel l = new JLabel();
    >
    > Instead of
    >
    > javax.swing.JLabel l = new javax.swing.JLabel();
    >
    > Thanks,
    > Lau


    define or modify the Java template (see "windows --> properties --> java --> template" submenu)
    call it "add_label" and it must works in java context
    define it in this manner :
    " JLabel l = new JLabel();${cursor}"
    if you want to use it while coding, just type "add_" + Ctrl - space and your "macro" will appear. Select if and save. You'll get errors if you don't import JLabel so do CtrL+O (--> organize imports) and it will be better
    Bruno

  3. Re: Generated code

    The problem is that's not what I meant.

    I'm interested in the code generated by the Studio for a complete class.

    For example, when it generates the code for a bean, it generates the bean
    class and 2 interfaces, and in that code I want this facility.

    Or when I create a GUI class with the Visual Editor.

    So I'm interested when I get the full class and then edit it, not when I
    write code by hand

    Thanks,

    Lau



    "Bruno" schrieb im Newsbeitrag
    news:bpcqdn$96pc$1@news.boulder.ibm.com...
    > > Hi,
    > > How can I customize the Studio in order to generate code using short

    names?
    > >
    > > Ex: Generate :
    > >
    > > import javax.swing.JLabel; or import javax.swing.*;
    > > ...
    > > JLabel l = new JLabel();
    > >
    > > Instead of
    > >
    > > javax.swing.JLabel l = new javax.swing.JLabel();
    > >
    > > Thanks,
    > > Lau

    >
    > define or modify the Java template (see "windows --> properties -->

    java --> template" submenu)
    > call it "add_label" and it must works in java context
    > define it in this manner :
    > " JLabel l = new JLabel();${cursor}"
    > if you want to use it while coding, just type "add_" + Ctrl - space and

    your "macro" will appear. Select if and save. You'll get errors if you don't
    import JLabel so do CtrL+O (--> organize imports) and it will be better
    > Bruno




+ Reply to Thread