{"id":501,"date":"2010-11-29T16:56:10","date_gmt":"2010-11-29T21:56:10","guid":{"rendered":"http:\/\/lukemiller.org\/?p=501"},"modified":"2011-02-12T12:04:46","modified_gmt":"2011-02-12T17:04:46","slug":"altering-eclipse-user-name","status":"publish","type":"post","link":"https:\/\/lukemiller.org\/index.php\/2010\/11\/altering-eclipse-user-name\/","title":{"rendered":"Altering Eclipse user name"},"content":{"rendered":"<p>Using StatET&#8217;s code generation templates is handy, but the standard Eclipse variable for ${user} just inserts the currently logged-in user&#8217;s account name. If you want a different name to appear when ${user} is called, one method is to alter the eclipse.ini file.<\/p>\n<p>Specifically, add the line<br \/>\n<code>-Duser.name = Your full name<\/code><br \/>\nat the end of the .ini file.<\/p>\n<p>For instance, my eclipse.ini file looks like this:<br \/>\n<code>-startup<br \/>\nplugins\/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar<br \/>\n--launcher.library<br \/>\nplugins\/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519<br \/>\n-product<br \/>\norg.eclipse.epp.package.jee.product<br \/>\n--launcher.XXMaxPermSize<br \/>\n256M<br \/>\n-showsplash<br \/>\norg.eclipse.platform<br \/>\n--launcher.XXMaxPermSize<br \/>\n256m<br \/>\n-vmargs<br \/>\n-Dosgi.requiredJavaVersion=1.5<br \/>\n-Xms40m<br \/>\n-Xmx512m<br \/>\n-Duser.name=Luke Miller<\/code><\/p>\n<p>When I open a new R-script file in Eclipse now, StatET automatically inserts that user name.<\/p>\n<p>You can further alter the generated code in the Eclipse Preferences window. Go to Window&gt;Preferences and you&#8217;ll get the following window.<\/p>\n<figure id=\"attachment_502\" aria-describedby=\"caption-attachment-502\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-502\" title=\"Preferences_1\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref1-300x270.png\" alt=\"\" width=\"300\" height=\"270\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref1-300x270.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref1.png 634w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-502\" class=\"wp-caption-text\">The StatET code generation options are accessed under the StatET item on the left menu tree.<\/figcaption><\/figure>\n<p>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&#8217;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.<\/p>\n<figure id=\"attachment_503\" aria-describedby=\"caption-attachment-503\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-503\" title=\"Preferences_2\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref2-300x168.png\" alt=\"\" width=\"300\" height=\"168\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref2-300x168.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/pref2.png 609w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-503\" class=\"wp-caption-text\">Modifying the code generation settings. New variables can be inserted and deleted at will. Eclipse will show you the available code snippets if you enter a $ in the window.<\/figcaption><\/figure>\n<p>In the Edit Template window, I&#8217;ve made a few changes. I inserted a line that says<br \/>\n<code># Filename: ${file_name}<\/code><br \/>\nThat will print out &#8220;Filename:&#8221; and follow it with the name of each newly created R script file I make.<br \/>\nI also modified the 3rd line as follows:<br \/>\n<code># Author: ${user}    ${date}<\/code><br \/>\nThat will print out &#8220;Author:&#8221; followed by the user name I specified in the eclipse.ini file, followed by the current date.<\/p>\n<p>To save the changes, hit OK, and then hit Apply in the Preferences Window.<\/p>\n<p>If I create a new R script, which I&#8217;ve called &#8220;junk.R&#8221; here, I get the following automatically generated code in the window:<\/p>\n<figure id=\"attachment_504\" aria-describedby=\"caption-attachment-504\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/junk.R.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-504\" title=\"junk.R\" src=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/junk.R-300x182.png\" alt=\"\" width=\"300\" height=\"182\" srcset=\"https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/junk.R-300x182.png 300w, https:\/\/lukemiller.org\/wp-content\/uploads\/2010\/11\/junk.R.png 725w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-504\" class=\"wp-caption-text\">The result of the automatic code generation. <\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Using StatET&#8217;s code generation templates is handy, but the standard Eclipse variable for ${user} just inserts the currently logged-in user&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[218],"tags":[14,7,58,15],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-r-project","tag-eclipse","tag-r","tag-r-project","tag-statet"],"_links":{"self":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/comments?post=501"}],"version-history":[{"count":9,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":744,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/posts\/501\/revisions\/744"}],"wp:attachment":[{"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lukemiller.org\/index.php\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}