Please disable your adblock and script blockers to view this page

Search this blog

Thursday, 20 October 2016

Using Code Template for Reusable codes in Jdeveloper IDE


Jdeveloper IDE comes with lots of features and one of them is Code Template, Code Template means some saved code that can be used using a shortcut key anywhere in editor.
There are many preconfigured templates for e.g.
Type sop in editor and press ctrl+enter and IDE will write

System.out.println();

Type main in editor and press ctrl+enter and IDE will write

    public static void main(String[] args) {
        ;
    }



In same way we can create our own code templates (Reusable code) ,To define custom Code Templates in Jdeveloper follow these steps

Click on Tools menu on top toolbar in Jdeveloper IDE, Select Preferences from drop down menu


Navigate to Code Editor--Code Templates


Click on green plus icon and Enter ShortCut, Context and Code, here I have added code to get Binding Container of current page as it is needed often in ADF Application


Now open your java class, type code template shortcut and press ctrl+enter, template code will be added in your java class. So this is a great utility and saves extra efforts


and yes you can export code templates and share with your team members and they can import it to use


Exported Code Template (XML Format) looks like this 


Cheers :) Happy Learning

3 comments :

  1. Ashish how are you ?
    I wish to know how to update the view instance on certain page if you insert rows in ViewObjectImpl

    Example
    i use employee table in page and there is a button that insert 5 rows once i have been wrote the method that insert those rows in EmployeeImpl and EmployeeRowImpl row inserted but i want to update the view instance and iterator to get those new rows that inserted

    ReplyDelete
    Replies
    1. You can simply call createRow and insertRow method to insert and update row in view instance

      ViewObjectImpl demo1 = am.getEmployeesDemo1();
      Row r2 = demo1.createRow(); // Creates a row in ViewObject

      r2.setAttribute("EmployeeId", 001); // you can set all values
      demo1.insertRow(r2); //Insert that row in ViewObject

      Ashish

      Delete
  2. It's really for oracle ADF learns. Good work...

    ReplyDelete