Re: How to make template with license

Brett Ryan <[email protected]> Wed, 13 May 2009 11:45:08 +1000
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
--000e0cd487ba804c870469c15c63
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi Vaclav, what's the name you used to replace TYPE? It needs to appear in
the project properties file instead of TYPE, also is your license file-name
in the form of license-TYPE.txt?

Just a test, try setting your project.license in the project properties to
one of the existing templates (like apache20).

-Brett

2009/5/13 Vaclav Trojan <[email protected]>

>  Dear Brett,
>
> thank you for resepone. However, I tried exactly what you recommended and=
 I
> received response of NetBeans:
>
> Error reading included file Templates/Classes/../Licenses/license-TYPE.tx=
t
>
> Have you an idea awhat is my mistake?
>
> Yours
>
> Vaclav
>
>
> ----- Original Message -----
> *From:* Brett Ryan <[email protected]>
> *To:* [email protected]
> *Sent:* Tuesday, May 12, 2009 9:07 PM
> *Subject:* Re: [nbui] How to make template with license
>
> Hi Vaclav, there's a few steps you need to undertake
>
> Setup the License Text
> 1. Create a new text file with form "license-TYPE.txt" where TYPE is the
> license type you wish to refer to.
> 2. Go to Tools > Templates
> 3. Click add and browse to your license file.
>
> Alter your project license
> 1. Go to the "Files" tab.
> 2. Navigate to "nbproject" and open "project.properties".
> 3. Add a new line containing the following text (replacing TYPE with your
> license type):
> project.license=3DTYPE
>
> Now, your license will be used with templates that refer to it.
>
> Hope this helps,
> -Brett
>
> 2009/5/13 Trojan V=E1clav <[email protected]>
>
>>  Dear all,
>>
>>
>>
>> I have problem to create the license text in java templates in NetBeans
>> ver 6.5.
>>
>>
>>
>> In the template editor I get the following source text:
>>
>>
>>
>> <#assign licenseFirst =3D "/*">
>>
>> <#assign licensePrefix =3D " * ">
>>
>> <#assign licenseLast =3D " */">
>>
>> <#include "../Licenses/license-${project.license}.txt">
>>
>>
>>
>> <#if package?? && package !=3D "">
>>
>> package ${package};
>>
>>
>>
>> </#if>
>>
>> /**
>>
>>  *
>>
>>  * @author ${user}
>>
>>  */
>>
>> public class ${name} {
>>
>>
>>
>> }
>>
>>
>>
>> How should I modify the command:
>>
>>
>>
>> <#include "../Licenses/license-${project.license}.txt">
>>
>>
>>
>> And where should I create the text file? If I put there an absolute
>> pathname or a relative path it dosn=92t work properly.
>>
>>
>>
>> Thanx for help
>>
>>
>>
>> Vaclav Trojan
>>
>
>

--000e0cd487ba804c870469c15c63
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Hi Vaclav, what&#39;s the name you used to replace TYPE? It needs to appear=
 in the project properties file instead of TYPE, also is your license file-=
name in the form of license-TYPE.txt?<br><br>Just a test, try setting your =
project.license in the project properties to one of the existing templates =
(like apache20).<br>
<br>-Brett<br><br><div class=3D"gmail_quote">2009/5/13 Vaclav Trojan <span =
dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">trojan.vaclav@gm=
ail.com</a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"border=
-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-lef=
t: 1ex;">






<div bgcolor=3D"#ffffff">
<div><font face=3D"Arial" size=3D"2">Dear Brett,</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">thank you for resepone. However, I tri=
ed exactly=20
what you recommended and I received response of NetBeans:</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">Error reading included file=20
Templates/Classes/../Licenses/license-TYPE.txt</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">Have you an idea awhat is my mistake?<=
/font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">Yours</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div><font color=3D"#888888=
">
<div><font face=3D"Arial" size=3D"2">Vaclav</font></div></font><div><div></=
div><div class=3D"h5">
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<blockquote style=3D"border-left: 2px solid rgb(0, 0, 0); padding-right: 0p=
x; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;">----- Original Message ----- </div>
  <div style=3D"background: rgb(228, 228, 228) none repeat scroll 0% 0%; -m=
oz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -mo=
z-background-inline-policy: -moz-initial; font-family: arial; font-style: n=
ormal; font-variant: normal; font-weight: normal; font-size: 10pt; line-hei=
ght: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>=20
  <a title=3D"[email protected]" href=3D"mailto:[email protected]" ta=
rget=3D"_blank">Brett=20
  Ryan</a> </div>
  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>To:</b> <a title=3D"[email protected]"=
 href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a> =
</div>

  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>Sent:</b> Tuesday, May 12, 2009 9:07 P=
M</div>

  <div style=3D"font-family: arial; font-style: normal; font-variant: norma=
l; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adj=
ust: none; font-stretch: normal;"><b>Subject:</b> Re: [nbui] How to make te=
mplate=20
  with license</div>
  <div><br></div>Hi Vaclav, there&#39;s a few steps you need to=20
  undertake<br><br>Setup the License Text<br>1. Create a new text file with=
 form=20
  &quot;license-TYPE.txt&quot; where TYPE is the license type you wish to r=
efer to.<br>2.=20
  Go to Tools &gt; Templates<br>3. Click add and browse to your license=20
  file.<br><br>Alter your project license<br>1. Go to the &quot;Files&quot;=
 tab.<br>2.=20
  Navigate to &quot;nbproject&quot; and open &quot;project.properties&quot;=
.<br>3. Add a new line=20
  containing the following text (replacing TYPE with your license=20
  type):<br>project.license=3DTYPE<br><br>Now, your license will be used wi=
th=20
  templates that refer to it.<br><br>Hope this helps,<br>-Brett<br><br>
  <div class=3D"gmail_quote">2009/5/13 Trojan V=E1clav <span dir=3D"ltr">&l=
t;<a href=3D"mailto:[email protected]" target=3D"_blank">Vaclav.Troja=
[email protected]</a>&gt;</span><br>
  <blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204=
, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div vlink=3D"purple" link=3D"blue" lang=3D"CS">
    <div>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">Dear all,</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">I have problem to create the=20
    license text in java templates in NetBeans ver 6.5. </span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">In the template editor I get the=20
    following source text:</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#assign licenseFi=
rst=20
    =3D &quot;/*&quot;&gt;</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#assign=20
    licensePrefix =3D &quot; * &quot;&gt;</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#assign licenseLa=
st=20
    =3D &quot; */&quot;&gt;</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#include=20
    &quot;../Licenses/license-${project.license}.txt&quot;&gt;</span></font=
></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#if package??=20
    &amp;&amp; package !=3D &quot;&quot;&gt;</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">package=20
    ${package};</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;/#if&gt;</span></=
font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">/**</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">=A0*</span></font></p=
>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">=A0* @author=20
    ${user}</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">=A0*/</span></font></=
p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">public class ${name}=
=20
    {</span></font></p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">}</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">How should I modify the=20
    command:</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Courier New" size=3D"2"><span style=3D"font-size: 10pt=
; font-family: &#39;Courier New&#39;;" lang=3D"EN-US">&lt;#include=20
    &quot;../Licenses/license-${project.license}.txt&quot;&gt;</span></font=
></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">And where should I create the=20
    text file? If I put there an absolute pathname or a relative path it do=
sn=92t=20
    work properly.</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">Thanx for help</span></font></p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US"></span></font>=A0</p>
    <p><font face=3D"Arial" size=3D"2"><span style=3D"font-size: 10pt; font=
-family: Arial;" lang=3D"EN-US">Vaclav=20
    Trojan</span></font></p></div></div></blockquote></div><br></blockquote=
></div></div></div>
</blockquote></div><br>

--000e0cd487ba804c870469c15c63--