|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
テンプレートでの変数利用小山と申します。
NetBean 6.7 の [ツール]-[テンプレートマネージャ] について質問させて下さい。 エディタで編集する際に、 * @author ${user} public class ${name} { のように、 ${xxxxxx} の IDE環境変数? を利用したいのですが、この環境変数の一覧 を調べるには、どこを探せば良いのでしょうか? また、環境変数に追加するにはどうしたらよいでしょうか? 具体的にやりたい事) ${year} という、システム年を示す変数を利用したい ちなみに、${date} は利用できるみたいです。 ご存じの方がいらっしゃいましたら、よろしくお願いいたします。 --------------------------------------------------------------------- To unsubscribe, e-mail: nbdiscuss_ja-unsubscribe@... For additional commands, e-mail: nbdiscuss_ja-help@... |
|
|
Re: テンプレートでの変数利用こんにちは、小山さん、
私も詳しくないのですが、調べてみると以下の Wiki に まとめられているようです。 http://wiki.netbeans.org/FaqTemplateVariables 以下が使えるようです。 * ${date} inserts the current date, in this format: Feb 16, 2008 * ${encoding} inserts the default encoding, such as: UTF-8 * ${name} inserts the name of the file. * ${nameAndExt} inserts the name of the file, together with its extension. * ${package} inserts the name of the package where the file is created. * ${time} inserts the current time, in this format: 7:37:58 PM * ${user} inserts the user name. * ${project.license} based on the value (e.g., 'CDDL'), the license header is found and is inserted into the template. * ${project.name} inserts the project name * ${project.displayName} inserts the project displayname これを応用して「年」だけを取得する方法も載っていましたので、 試してみていただけますか。私の環境だと動きました。 テンプレートに ${date?date?string("yyyy")} と書けばよいようです。他にも string() を利用していろんな 書き方があるようですね。これは http://wiki.netbeans.org/FaqFreeMarker http://freemarker.org/docs/ref_builtins_date.html などに詳しく載っています。 また追加する方法ですが、この Wiki にもあるように、 テンプレートマネージャーの「ユーザー構成プロパティー」の User.properties に定義できるようです。 片貝 10/24/09 09:22, mlus wrote: > 小山と申します。 > > NetBean 6.7 の [ツール]-[テンプレートマネージャ] について質問させて下さい。 > > エディタで編集する際に、 > > * @author ${user} > public class ${name} { > > のように、 ${xxxxxx} の IDE環境変数? を利用したいのですが、この環境変数の一覧 > を調べるには、どこを探せば良いのでしょうか? > また、環境変数に追加するにはどうしたらよいでしょうか? > > 具体的にやりたい事) > > ${year} という、システム年を示す変数を利用したい > ちなみに、${date} は利用できるみたいです。 > > ご存じの方がいらっしゃいましたら、よろしくお願いいたします。 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: nbdiscuss_ja-unsubscribe@... > For additional commands, e-mail: nbdiscuss_ja-help@... > -- Masaki Katakai Sun Microsystems K.K. http://blogs.sun.com/katakai --------------------------------------------------------------------- To unsubscribe, e-mail: nbdiscuss_ja-unsubscribe@... For additional commands, e-mail: nbdiscuss_ja-help@... |
|
|
Re: テンプレートでの変数利用片貝さん、ご返答ありがとうございます。
> 私も詳しくないのですが、調べてみると以下の Wiki に > まとめられているようです。 > > http://wiki.netbeans.org/FaqTem追加する方法ですが、この WiplateVariables 大変助かりました。 なるほど、結構柔軟に設定できるようですね。 ヘルプばっかり探していたのですが、これからは wikiも探すようにします。 --------------------------------------------------------------------- To unsubscribe, e-mail: nbdiscuss_ja-unsubscribe@... For additional commands, e-mail: nbdiscuss_ja-help@... |
| Free embeddable forum powered by Nabble | Forum Help |