In JDeveloper, it can be helpful to set up code snippets to be of easy use later. Personally I use this mainly to set up code snippets for demo purposes and this is rather easy to set up.
First of all, if not already open, open your Components Window in JDeveloper:
Now open the file that you want to create the code snippet from, this can be any file in JDeveloper as example I opened a Java file with a main method in it. After you have opened the file, you should see a choice list in your Component Pane in JDeveloper.
In this choice list select the option ‘My Components’ and open the ‘Code Snippets’ area:
In the file you opened, select the part of the file that you want to save as a snippet and drag and drop this to the Code Snippets area:
After this a pop up should appear to enter a name for the snippet, enter a name and press OK:
The result should be a saved code snippet on the Code Snippets area when My Components is selected:
You can now drag and drop this code snippet into any other file to create the exact same code as you have saved.