The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
1.At 10:59 AM
on Jul 30, 2008,
Dave Steinberg
wrote:
Re: add copyright information in EMF generated Java
Hi Liangzhao,
Enter your copyright information as the value of the "Copyright Text"
property on the GenModel. Starting in EMF 2.3, this value will be used
to generate a comment in each generated file. If "Copyright Fields" is
true, it will also be used to generate a static field.
Cheers,
Dave
liangzhao zeng wrote:
> I would like to add copyright information at the beginning each EMF
> generated Java source code.
> any suggestions?
>
>
>
2.At 12:58 PM
on Jul 30, 2008,
liangzhao zeng
wrote:
Re: add copyright information in EMF generated Java
Hi, Dave
thanks a lot for the info. However, I use the EMF 2.2 that come with the
RSA 7.0. any suggestions? I notice that there are property about the
templates&merge, but not sure how to use them.
Cheers,
Liangzhao
Dave Steinberg wrote:
> Hi Liangzhao,
> Enter your copyright information as the value of the "Copyright Text"
> property on the GenModel. Starting in EMF 2.3, this value will be used
> to generate a comment in each generated file. If "Copyright Fields" is
> true, it will also be used to generate a static field.
> Cheers,
> Dave
> liangzhao zeng wrote:
>> I would like to add copyright information at the beginning each EMF
>> generated Java source code.
>> any suggestions?
>>
>>
>>
3.At 2:10 PM
on Jul 30, 2008,
Dave Steinberg
wrote:
Re: add copyright information in EMF generated Java
Hi Liangzhao,
There are no options in EMF 2.2 that will do this directly. You'll need
to use dynamic templates with a custom Header.javajetinc that includes
your copyright information.
You can do this by importing the templates/Header.javajetinc file from
the org.eclipse.emf.codegen.ecore plug-in into your own project. Then,
in your GenModel, under Templates & Merge, enable "Dynamic Templates"
and set "Template Directory" with a workspace path (for example,
"/MyProject/templates"). That should cause it to pick up the
Header.javajetinc file when you generate the code, compiling the
resulting templates on the fly. So, you can add whatever copyright
information you want to have there. You can also copy in and modify
Header.jetinc, Header.propertiesjetinc and Header.xmljetinc if you're
concerned about other, non-Java artifacts.
Note that none of these changes will be merged into existing artifacts,
so if you've already generated code, you'll need to delete it before
regenerating and, where you've made changes manually, merge in the new
headers.
Cheers,
Dave
liangzhao zeng wrote:
> Hi, Dave
>
> thanks a lot for the info. However, I use the EMF 2.2 that come with the
> RSA 7.0. any suggestions? I notice that there are property about the
> templates&merge, but not sure how to use them.
>
> Cheers,
>
> Liangzhao
>
Re: add copyright information in EMF generated Java
Dave Steinberg wrote:
> Hi Liangzhao,
> There are no options in EMF 2.2 that will do this directly. You'll need
> to use dynamic templates with a custom Header.javajetinc that includes
> your copyright information.
> You can do this by importing the templates/Header.javajetinc file from
> the org.eclipse.emf.codegen.ecore plug-in into your own project. Then,
> in your GenModel, under Templates & Merge, enable "Dynamic Templates"
> and set "Template Directory" with a workspace path (for example,
> "/MyProject/templates"). That should cause it to pick up the
> Header.javajetinc file when you generate the code, compiling the
> resulting templates on the fly. So, you can add whatever copyright
> information you want to have there. You can also copy in and modify
> Header.jetinc, Header.propertiesjetinc and Header.xmljetinc if you're
> concerned about other, non-Java artifacts.
> Note that none of these changes will be merged into existing artifacts,
> so if you've already generated code, you'll need to delete it before
> regenerating and, where you've made changes manually, merge in the new
> headers.
> Cheers,
> Dave
If this is any help i do this on a per class basis by using annotations on
my ecore. Here is a header template from
project-name/jet-templates/Header.javajetinc
where my dynamic template directory is set to /project-name/jet-templates
> liangzhao zeng wrote:
>> Hi, Dave
>>
>> thanks a lot for the info. However, I use the EMF 2.2 that come with the
>> RSA 7.0. any suggestions? I notice that there are property about the
>> templates&merge, but not sure how to use them.
>>
>> Cheers,
>>
>> Liangzhao
>>
Re: add copyright information in EMF generated Java
Liangzhao,
The GenModel has a "Copyright Text" property for this. You also have to
set CopyrightFields to true to get the field declarations.
liangzhao zeng wrote:
> thanks.
> Further, I also need to add another line of copyright after the
> package name and also a string right after class declaration, like
>
> package xxx.xxx.xxx.xxx.xx;
>
> /**
> * * @author liangzhaoversion 1. June 29, 2008
> */
> public class Foo {
>
> public static final String COPYRIGHT = "Copyright ABC Corporation
> 2008.";
> ---
>
>
> }
>
> and I notice that in Class.javajet, there are sth like
>
>
> /**
> *
<!-- begin-user-doc -->
> *
<!-- end-user-doc -->
> * @generated
> */
>
> copyright = "
>
>
>
> But I do not know how to set the CopyrightText in genModel, any
> suggestion will be greatly appreciate.
>
>
> Liangzhao
>
>
Re: add copyright information in EMF generated Java
Liangzhao,
Well yes, some of this is new. There's not much I can suggest about
such an old version of EMF. Of course you can add any of this by hand...
liangzhao zeng wrote:
> Well, it seems to me that there is not copyright attribute in EMF 2.2
> that come with RSA7.0. any suggestions?
>
>
> Cheers
>
> Liangzhao
>
10.At 6:12 PM
on Aug 7, 2008,
liangzhao zeng
wrote:
Re: add copyright information in EMF generated Java
My question this that in EMF framework, the Class.javajet already refer to
copyrigh information, it should have some way to set it. as you can see in
the Class.javajet, we have
Re: add copyright information in EMF generated Java
Liangzhao,
I don't have a 2.2 base installed on my new machine, but as far as I
know, there has been a copyright property on the GenModel for an
extremely long time, i.e., since at least 2004.
liangzhao zeng wrote:
> My question this that in EMF framework, the Class.javajet already
> refer to copyrigh information, it should have some way to set it. as
> you can see in the Class.javajet, we have
>
> /**
> *
<!-- begin-user-doc -->
> *
<!-- end-user-doc -->
> * @generated
> */
>
> copyright = "
>
>
>
>
> anyway, thanks a lot.
>
> Liangzhao
>
add copyright information in EMF generated Java
At 10:37 AM on Jul 30, 2008, liangzhao zeng wrote:
generated Java source code.
any suggestions?
12 replies so far (
Post your own)
Re: add copyright information in EMF generated Java
Hi Liangzhao,Enter your copyright information as the value of the "Copyright Text"
property on the GenModel. Starting in EMF 2.3, this value will be used
to generate a comment in each generated file. If "Copyright Fields" is
true, it will also be used to generate a static field.
Cheers,
Dave
liangzhao zeng wrote:
> I would like to add copyright information at the beginning each EMF
> generated Java source code.
> any suggestions?
>
>
>
Re: add copyright information in EMF generated Java
Hi, Davethanks a lot for the info. However, I use the EMF 2.2 that come with the
RSA 7.0. any suggestions? I notice that there are property about the
templates&merge, but not sure how to use them.
Cheers,
Liangzhao
Dave Steinberg wrote:
> Hi Liangzhao,
> Enter your copyright information as the value of the "Copyright Text"
> property on the GenModel. Starting in EMF 2.3, this value will be used
> to generate a comment in each generated file. If "Copyright Fields" is
> true, it will also be used to generate a static field.
> Cheers,
> Dave
> liangzhao zeng wrote:
>> I would like to add copyright information at the beginning each EMF
>> generated Java source code.
>> any suggestions?
>>
>>
>>
Re: add copyright information in EMF generated Java
Hi Liangzhao,There are no options in EMF 2.2 that will do this directly. You'll need
to use dynamic templates with a custom Header.javajetinc that includes
your copyright information.
You can do this by importing the templates/Header.javajetinc file from
the org.eclipse.emf.codegen.ecore plug-in into your own project. Then,
in your GenModel, under Templates & Merge, enable "Dynamic Templates"
and set "Template Directory" with a workspace path (for example,
"/MyProject/templates"). That should cause it to pick up the
Header.javajetinc file when you generate the code, compiling the
resulting templates on the fly. So, you can add whatever copyright
information you want to have there. You can also copy in and modify
Header.jetinc, Header.propertiesjetinc and Header.xmljetinc if you're
concerned about other, non-Java artifacts.
Note that none of these changes will be merged into existing artifacts,
so if you've already generated code, you'll need to delete it before
regenerating and, where you've made changes manually, merge in the new
headers.
Cheers,
Dave
liangzhao zeng wrote:
> Hi, Dave
>
> thanks a lot for the info. However, I use the EMF 2.2 that come with the
> RSA 7.0. any suggestions? I notice that there are property about the
> templates&merge, but not sure how to use them.
>
> Cheers,
>
> Liangzhao
>
Re: add copyright information in EMF generated Java
thanks, Dave. It works well!Cheers,
Liangzhao
Re: add copyright information in EMF generated Java
Dave Steinberg wrote:> Hi Liangzhao,
> There are no options in EMF 2.2 that will do this directly. You'll need
> to use dynamic templates with a custom Header.javajetinc that includes
> your copyright information.
> You can do this by importing the templates/Header.javajetinc file from
> the org.eclipse.emf.codegen.ecore plug-in into your own project. Then,
> in your GenModel, under Templates & Merge, enable "Dynamic Templates"
> and set "Template Directory" with a workspace path (for example,
> "/MyProject/templates"). That should cause it to pick up the
> Header.javajetinc file when you generate the code, compiling the
> resulting templates on the fly. So, you can add whatever copyright
> information you want to have there. You can also copy in and modify
> Header.jetinc, Header.propertiesjetinc and Header.xmljetinc if you're
> concerned about other, non-Java artifacts.
> Note that none of these changes will be merged into existing artifacts,
> so if you've already generated code, you'll need to delete it before
> regenerating and, where you've made changes manually, merge in the new
> headers.
> Cheers,
> Dave
If this is any help i do this on a per class basis by using annotations on
my ecore. Here is a header template from
project-name/jet-templates/Header.javajetinc
where my dynamic template directory is set to /project-name/jet-templates
------------8
String xxxx_fileComment = "comment missing!!";
final GenBase xxxx_genBase = argument instanceof GenBase ? (GenBase)
argument : (GenBase)((Object[])argument)[0];
org.eclipse.emf.ecore.EAnnotation xxxx_EcoreClassAnnotation =
xxxx_genBase.getEcoreModelElement().getEAnnotation("http://www.leeds.ac.uk/xxxx/yyyy");
if (xxxx_EcoreClassAnnotation != null) {
org.eclipse.emf.common.util.EMap xxxx_details =
xxxx_EcoreClassAnnotation.getDetails();
if (xxxx_details.containsKey("file comment")) {
xxxx_fileComment = (String)xxxx_details.get("file comment");
}
}
%>
*
*/
------------8
and here is a sample segment of ecore model
------------8
eSuperTypes="#//wobble/object">
source="http://www.leeds.ac.uk/xxxx-ecore-1.0/xxxx_genmodel">
------------8
hope this helps
regards
gary
> liangzhao zeng wrote:
>> Hi, Dave
>>
>> thanks a lot for the info. However, I use the EMF 2.2 that come with the
>> RSA 7.0. any suggestions? I notice that there are property about the
>> templates&merge, but not sure how to use them.
>>
>> Cheers,
>>
>> Liangzhao
>>
Re: add copyright information in EMF generated Java
thanks.Further, I also need to add another line of copyright after the package
name and also a string right after class declaration, like
package xxx.xxx.xxx.xxx.xx;
/**
*
* @author liangzhaoversion 1. June 29, 2008
*/
public class Foo {
public static final String COPYRIGHT = "Copyright ABC Corporation 2008.";
---
}
and I notice that in Class.javajet, there are sth like
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
copyright = " "
But I do not know how to set the CopyrightText in genModel, any
suggestion will be greatly appreciate.
Liangzhao
Re: add copyright information in EMF generated Java
Liangzhao,The GenModel has a "Copyright Text" property for this. You also have to
set CopyrightFields to true to get the field declarations.
liangzhao zeng wrote:
> thanks.
> Further, I also need to add another line of copyright after the
> package name and also a string right after class declaration, like
>
> package xxx.xxx.xxx.xxx.xx;
>
> /**
> * * @author liangzhaoversion 1. June 29, 2008
> */
> public class Foo {
>
> public static final String COPYRIGHT = "Copyright ABC Corporation
> 2008.";
> ---
>
>
> }
>
> and I notice that in Class.javajet, there are sth like
>
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> > copyright = " >
>
>
> But I do not know how to set the CopyrightText in genModel, any
> suggestion will be greatly appreciate.
>
>
> Liangzhao
>
>
Re: add copyright information in EMF generated Java
Well, it seems to me that there is not copyright attribute in EMF 2.2 thatcome with RSA7.0. any suggestions?
Cheers
Liangzhao
Re: add copyright information in EMF generated Java
Liangzhao,Well yes, some of this is new. There's not much I can suggest about
such an old version of EMF. Of course you can add any of this by hand...
liangzhao zeng wrote:
> Well, it seems to me that there is not copyright attribute in EMF 2.2
> that come with RSA7.0. any suggestions?
>
>
> Cheers
>
> Liangzhao
>
Re: add copyright information in EMF generated Java
My question this that in EMF framework, the Class.javajet already refer tocopyrigh information, it should have some way to set it. as you can see in
the Class.javajet, we have
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
copyright = " "
anyway, thanks a lot.
Liangzhao
Re: add copyright information in EMF generated Java
Liangzhao,I don't have a 2.2 base installed on my new machine, but as far as I
know, there has been a copyright property on the GenModel for an
extremely long time, i.e., since at least 2004.
liangzhao zeng wrote:
> My question this that in EMF framework, the Class.javajet already
> refer to copyrigh information, it should have some way to set it. as
> you can see in the Class.javajet, we have
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> > copyright = " >
>
>
>
> anyway, thanks a lot.
>
> Liangzhao
>
Re: add copyright information in EMF generated Java
Yes, you are right, it is there! Thanks. I was just too eager to find itCheers,
Liangzhao