Using StatET’s code generation templates is handy, but the standard Eclipse variable for ${user} just inserts the currently logged-in user’s account name. If you want a different name to appear when ${user} is called, one method is to alter the eclipse.ini file.
Specifically, add the line
-Duser.name = Your full name
at the end of the .ini file.
For instance, my eclipse.ini file looks like this:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-Duser.name=Luke Miller
When I open a new R-script file in Eclipse now, StatET automatically inserts that user name.
You can further alter the generated code in the Eclipse Preferences window. Go to Window>Preferences and you’ll get the following window.
Open the StatET section of the left menu tree, click on Code Generation. In the upper right window, open the R Code menu tree, and click on the New R Script File item. In the preview window, you’re shown an example of the automatically generated code that will be inserted at the head of every new R script file your create in Eclipse. You can edit this by hitting the Edit button.
In the Edit Template window, I’ve made a few changes. I inserted a line that says
# Filename: ${file_name}
That will print out “Filename:” and follow it with the name of each newly created R script file I make.
I also modified the 3rd line as follows:
# Author: ${user} ${date}
That will print out “Author:” followed by the user name I specified in the eclipse.ini file, followed by the current date.
To save the changes, hit OK, and then hit Apply in the Preferences Window.
If I create a new R script, which I’ve called “junk.R” here, I get the following automatically generated code in the window: