Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Overriding $user in Java templates
Overriding $user in Java templates [message #11568] Sat, 22 January 2005 04:49 Go to next message
Eclipse UserFriend
Originally posted by: dmerrillq.usaq.netq

Eclipse's default java class template includes the template variable $user,
which it's resolving to my machine name, presumably since that's the name I
use to log into my laptop. Maybe it's not cool that I do that, but I'm the
only user of this machine, I've done it for a long time, and by now there's
*tons* of stuff attached to that "name", so I don't want to change that.

Given that, what's the most sensible thing to do so this gets
mapped onto some other string I can control. I could
change all templates to include that as literal text, but it seems like it'd
be better to be able to change it in one place and effect all templates.

I see in the help that "You can insert your own template variables, which
then evaluate to the name of the variable itself." If I'm reading that
right, it means I could define $DaveMerrill, and it would resolve to
'DaveMerrill'. Seems lame, since a) I'd rather a space between first and
last name, and b) the whole point is to change the *value* of that variable,
which isn't possible. I must not understand how this works. Does it mean
that I could use $author (say), and somewhere else, global to Eclipse and
permanent until I change it, set the string it resolves to? If that, how
would I set this up and manage it?

Clue, anyone? Other ideas?

Thanks, as always,

Dave Merrill
Re: Overriding $user in Java templates [message #13318 is a reply to message #11568] Mon, 24 January 2005 09:23 Go to previous messageGo to next message
Tom Hofmann is currently offline Tom HofmannFriend
Messages: 770
Registered: July 2009
Senior Member
The ${author} property is taken from the java property obtained by calling

System.getProperty("user.name");

So, you can either start eclipse with -vmargs -Duser.name="Dave Merril"
or modify the template directly to include your name verbatim.

HTH, tom

Dave Merrill wrote:
> Eclipse's default java class template includes the template variable $user,
> which it's resolving to my machine name, presumably since that's the name I
> use to log into my laptop. Maybe it's not cool that I do that, but I'm the
> only user of this machine, I've done it for a long time, and by now there's
> *tons* of stuff attached to that "name", so I don't want to change that.
>
> Given that, what's the most sensible thing to do so this gets
> mapped onto some other string I can control. I could
> change all templates to include that as literal text, but it seems like it'd
> be better to be able to change it in one place and effect all templates.
>
> I see in the help that "You can insert your own template variables, which
> then evaluate to the name of the variable itself." If I'm reading that
> right, it means I could define $DaveMerrill, and it would resolve to
> 'DaveMerrill'. Seems lame, since a) I'd rather a space between first and
> last name, and b) the whole point is to change the *value* of that variable,
> which isn't possible. I must not understand how this works. Does it mean
> that I could use $author (say), and somewhere else, global to Eclipse and
> permanent until I change it, set the string it resolves to? If that, how
> would I set this up and manage it?
>
> Clue, anyone? Other ideas?
>
> Thanks, as always,
>
> Dave Merrill
>
>
Re: Overriding $user in Java templates [message #13343 is a reply to message #11568] Mon, 24 January 2005 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Dave Merrill wrote:

>Eclipse's default java class template includes the template variable $user,
>which it's resolving to my machine name, presumably since that's the name I
>use to log into my laptop. Maybe it's not cool that I do that, but I'm the
>only user of this machine, I've done it for a long time, and by now there's
>*tons* of stuff attached to that "name", so I don't want to change that.
>
>Given that, what's the most sensible thing to do so this gets
>mapped onto some other string I can control. I could
>change all templates to include that as literal text, but it seems like it'd
>be better to be able to change it in one place and effect all templates.
>
>
Simply start Eclipse with VM argument -Duser.name="your name"

Dani

>I see in the help that "You can insert your own template variables, which
>then evaluate to the name of the variable itself." If I'm reading that
>right, it means I could define $DaveMerrill, and it would resolve to
>'DaveMerrill'. Seems lame, since a) I'd rather a space between first and
>last name, and b) the whole point is to change the *value* of that variable,
>which isn't possible. I must not understand how this works. Does it mean
>that I could use $author (say), and somewhere else, global to Eclipse and
>permanent until I change it, set the string it resolves to? If that, how
>would I set this up and manage it?
>
>Clue, anyone? Other ideas?
>
>Thanks, as always,
>
>Dave Merrill
>
>
>
>
Re: Overriding $user in Java templates [message #14767 is a reply to message #13318] Mon, 24 January 2005 17:33 Go to previous message
Eclipse UserFriend
Originally posted by: dmerrillq.usaq.netq

Thanks Tom, just modified my Eclipse shortcut to do that, good to go.

Dave

"Tom Eicher" wrote in message news:ct2eqb$79i$1@www.eclipse.org...
> The ${author} property is taken from the java property obtained by calling
>
> System.getProperty("user.name");
>
> So, you can either start eclipse with -vmargs -Duser.name="Dave Merril"
> or modify the template directly to include your name verbatim.
>
> HTH, tom
>
> Dave Merrill wrote:
> > Eclipse's default java class template includes the template variable
$user,
> > which it's resolving to my machine name, presumably since that's the
name I
> > use to log into my laptop. Maybe it's not cool that I do that, but I'm
the
> > only user of this machine, I've done it for a long time, and by now
there's
> > *tons* of stuff attached to that "name", so I don't want to change that.
> >
> > Given that, what's the most sensible thing to do so this gets
> > mapped onto some other string I can control. I could
> > change all templates to include that as literal text, but it seems like
it'd
> > be better to be able to change it in one place and effect all templates.
> >
> > I see in the help that "You can insert your own template variables,
which
> > then evaluate to the name of the variable itself." If I'm reading that
> > right, it means I could define $DaveMerrill, and it would resolve to
> > 'DaveMerrill'. Seems lame, since a) I'd rather a space between first and
> > last name, and b) the whole point is to change the *value* of that
variable,
> > which isn't possible. I must not understand how this works. Does it mean
> > that I could use $author (say), and somewhere else, global to Eclipse
and
> > permanent until I change it, set the string it resolves to? If that, how
> > would I set this up and manage it?
> >
> > Clue, anyone? Other ideas?
> >
> > Thanks, as always,
> >
> > Dave Merrill
Previous Topic:perspective
Next Topic:First Samle Plugin
Goto Forum:
  


Current Time: Wed Feb 05 03:48:13 GMT 2025

Powered by FUDForum. Page generated in 0.07194 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top