Changing the Java Studio Creator Backing Java File Template

Every time I delete my user directory in Java Studio Creator, I lose my "_USER_" setting tag for new classes that are created.  Creator uses the NetBeans template facility to create a new Java file and puts comments in the top of the file like this.  

/\*
\* Page1.java
\*
\* Created on June 20, 2006, 9:36 AM
\* Copyright david
\*/
The template for this page looks like this at the top.

/\*
\* __NAME__.java
\*
\* Created on __DATE__, __TIME__
\* Copyright __USER__
\*/
So where do you change the "_USER_" tag.  Basically this is defined in the "tools->options(advanced)".  The node is "Editing->Java Sources".  The dialog looks like this.


Changing _USER_ dialog

The "Strings Table" contains what's refered to as a MACRO.  In this case, the macro is "_USER_".  If you click on the elipse next to the value, you can change the value of "_USER_".  The next time you create a page, the new value will be inserted.

NetBeans

This will also work for NetBeans.  The Java class template for NetBeans looks like this.

/\*
\* NewClass.java
\*
\* Created on July 20, 2006, 2:23 PM
\*
\* To change this template, choose Tools | Template Manager
\* and open the template in the editor.
\*/

package com.sun;

/\*\*
\*
\* @author david
\*/
public class NewClass {

/\*\* Creates a new instance of NewClass \*/
public NewClass() {
}

}
So changing the "_USER_" macro in this case would change the "@author" tag value.

Changing the Creator Java Page Template

If you would rather have "@author" instead of "Copyright" in the comments for your Java Pages, you can change the template.

Caution! - Changing the template incorrectly will break the Java Studio Creator application model.   Only change the non-functional pieces like the comments.

Not that the warning is out of the way, open the "Tools->Options" dialog and make sure you are in advanced mode.  Go the the "Source Creation and Management->Templates->Web Pages node" and expand it.  Double-click on the "Backing Java File" node and you will see the template in the Java Editor.  You can then change "Copyright" to "@author".  You could even add your companies copyright information.

Enjoy!
-David
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

David Botterill

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today