Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » serious help needed with EMF and JEt
serious help needed with EMF and JEt [message #760964] Mon, 05 December 2011 18:06 Go to next message
Eclipse UserFriend
Hi,

I wrote a plugin to generate additional java source needed for my
application. It worked well under Galileo. Now under Helios I'm seeing
almost random inexplicable behavior. For example, code being generated
even when the plugin has been removed...

<plugin>
<extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
<!-- Adapter Factory -->
<adapterFactory
class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
<!-- Single Adapter -->
<!--
<adapter modelClass="GenModel"
class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
<adapter modelClass="GenClass"
class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
-->
</extension>

I'm extending generatorAdapters

Originally my plugin had a Templated/model folder with my single
template. The target EMF project also had a Template/model folder
having modified templates: Class.javajet and FactoryClass.javajet.
These over-rode standard gen behavior. Now they are invisible...

Is there a tutorial or article about extending EMF code gen and
over-riding standard generation?


Thanks!!!!!!!!!!!!!!!!!!!

Roy
Re: serious help needed with EMF and JEt [message #760972 is a reply to message #760964] Mon, 05 December 2011 18:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26281
Registered: July 2009
Senior Member
Roy,

Please use eclipse.tools.emf for questions about EMF in the future.
More comments below...

On 05/12/2011 10:06 AM, Roy Benjamin wrote:
> Hi,
>
> I wrote a plugin to generate additional java source needed for my
> application. It worked well under Galileo. Now under Helios I'm
> seeing almost random inexplicable behavior. For example, code being
> generated even when the plugin has been removed...
>
> <plugin>
> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
> <!-- Adapter Factory -->
> <adapterFactory
> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
> <!-- Single Adapter -->
> <!--
> <adapter modelClass="GenModel"
> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
> <adapter modelClass="GenClass"
> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
> -->
> </extension>
>
> I'm extending generatorAdapters
>
> Originally my plugin had a Templated/model folder with my single
> template. The target EMF project also had a Template/model folder
> having modified templates: Class.javajet and FactoryClass.javajet.
And you have settings in your GenModel to set up the template path? (I
suppose you followed the FAQ for this.)
> These over-rode standard gen behavior. Now they are invisible...
What things are invisible? These folders with the templates?
>
> Is there a tutorial or article about extending EMF code gen and
> over-riding standard generation?
No. There an example for using the generator adapters, but I've not
seen that you've added new template but rather are just wanting dynamic
templates (as in the FAQ).
>
>
> Thanks!!!!!!!!!!!!!!!!!!!
When in doubt, be sure to unfilter .* resources and look at whether the
..JETEmitters project might be messed up. You can delete it completely,
including deleting it from the file system, and it will be regenerated
the next time you generate. You might want to close and reopen the
generator after such a cleanup...
>
> Roy
Re: serious help needed with EMF and JEt [message #760983 is a reply to message #760972] Mon, 05 December 2011 18:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ed,

I'll use eclipse.tools.emf next time.

It's been a year since I worked on this. More than anything I think I
forgot the recipe...

I have "templates" for Template Directory, in the genmodel (which is new).

The two templates located there (Class.javajet and factoryClass.javajet
seem "invisible", i.e. not being used during generation.

The real folder is templates/model, not just templates.

Thanks
Roy

On 12/5/2011 10:20 AM, Ed Merks wrote:
> Roy,
>
> Please use eclipse.tools.emf for questions about EMF in the future. More
> comments below...
>
> On 05/12/2011 10:06 AM, Roy Benjamin wrote:
>> Hi,
>>
>> I wrote a plugin to generate additional java source needed for my
>> application. It worked well under Galileo. Now under Helios I'm seeing
>> almost random inexplicable behavior. For example, code being generated
>> even when the plugin has been removed...
>>
>> <plugin>
>> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
>> <!-- Adapter Factory -->
>> <adapterFactory
>> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
>> <!-- Single Adapter -->
>> <!--
>> <adapter modelClass="GenModel"
>> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
>>
>> <adapter modelClass="GenClass"
>> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
>>
>> -->
>> </extension>
>>
>> I'm extending generatorAdapters
>>
>> Originally my plugin had a Templated/model folder with my single
>> template. The target EMF project also had a Template/model folder
>> having modified templates: Class.javajet and FactoryClass.javajet.
> And you have settings in your GenModel to set up the template path? (I
> suppose you followed the FAQ for this.)
>> These over-rode standard gen behavior. Now they are invisible...
> What things are invisible? These folders with the templates?
>>
>> Is there a tutorial or article about extending EMF code gen and
>> over-riding standard generation?
> No. There an example for using the generator adapters, but I've not seen
> that you've added new template but rather are just wanting dynamic
> templates (as in the FAQ).
>>
>>
>> Thanks!!!!!!!!!!!!!!!!!!!
> When in doubt, be sure to unfilter .* resources and look at whether the
> ..JETEmitters project might be messed up. You can delete it completely,
> including deleting it from the file system, and it will be regenerated
> the next time you generate. You might want to close and reopen the
> generator after such a cleanup...
>>
>> Roy
Re: serious help needed with EMF and JEt [message #760987 is a reply to message #760972] Mon, 05 December 2011 18:49 Go to previous messageGo to next message
Eclipse UserFriend
Also am seeing cast exception in the template:

<%final GenClass genClass = (GenClass)((Object[])argument)[0]; final
GenPackage genPackage = genClass.getGenPackage(); final GenModel
genModel=genPackage.getGenModel();%>

after changing template path to templates/model

Thanks

Roy



java.lang.ClassCastException:
org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl incompatible
with [Ljava.lang.Object;
at
org.eclipse.emf.codegen.ecore.templates.model.Class_.generate(Class_.java:1793)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:467)
at
org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:981)
at
com.ebay.eclipse.emf.generator.dal.GenClassDalGeneratorAdapter.generateModel(GenClassDalGeneratorAdapter.java:92)
at
org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
at
org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
at
org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:167)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)





On 12/5/2011 10:20 AM, Ed Merks wrote:
> Roy,
>
> Please use eclipse.tools.emf for questions about EMF in the future. More
> comments below...
>
> On 05/12/2011 10:06 AM, Roy Benjamin wrote:
>> Hi,
>>
>> I wrote a plugin to generate additional java source needed for my
>> application. It worked well under Galileo. Now under Helios I'm seeing
>> almost random inexplicable behavior. For example, code being generated
>> even when the plugin has been removed...
>>
>> <plugin>
>> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
>> <!-- Adapter Factory -->
>> <adapterFactory
>> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
>> <!-- Single Adapter -->
>> <!--
>> <adapter modelClass="GenModel"
>> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
>>
>> <adapter modelClass="GenClass"
>> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
>>
>> -->
>> </extension>
>>
>> I'm extending generatorAdapters
>>
>> Originally my plugin had a Templated/model folder with my single
>> template. The target EMF project also had a Template/model folder
>> having modified templates: Class.javajet and FactoryClass.javajet.
> And you have settings in your GenModel to set up the template path? (I
> suppose you followed the FAQ for this.)
>> These over-rode standard gen behavior. Now they are invisible...
> What things are invisible? These folders with the templates?
>>
>> Is there a tutorial or article about extending EMF code gen and
>> over-riding standard generation?
> No. There an example for using the generator adapters, but I've not seen
> that you've added new template but rather are just wanting dynamic
> templates (as in the FAQ).
>>
>>
>> Thanks!!!!!!!!!!!!!!!!!!!
> When in doubt, be sure to unfilter .* resources and look at whether the
> ..JETEmitters project might be messed up. You can delete it completely,
> including deleting it from the file system, and it will be regenerated
> the next time you generate. You might want to close and reopen the
> generator after such a cleanup...
>>
>> Roy
Re: serious help needed with EMF and JEt [message #761010 is a reply to message #760987] Mon, 05 December 2011 19:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26281
Registered: July 2009
Senior Member
Roy,

I think you'll need to revisit your copied template to make sure it
works with the latest code. I see the stack below is being initiated by
your own adapter GenClassDalGeneratorAdapter so I can't comment on what
it's doing.


On 05/12/2011 10:49 AM, Roy Benjamin wrote:
> Also am seeing cast exception in the template:
>
> <%final GenClass genClass = (GenClass)((Object[])argument)[0]; final
> GenPackage genPackage = genClass.getGenPackage(); final GenModel
> genModel=genPackage.getGenModel();%>
>
> after changing template path to templates/model
>
> Thanks
>
> Roy
>
>
>
> java.lang.ClassCastException:
> org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl incompatible
> with [Ljava.lang.Object;
> at
> org.eclipse.emf.codegen.ecore.templates.model.Class_.generate(Class_.java:1793)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> at java.lang.reflect.Method.invoke(Method.java:599)
> at
> org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:467)
> at
> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:981)
> at
> com.ebay.eclipse.emf.generator.dal.GenClassDalGeneratorAdapter.generateModel(GenClassDalGeneratorAdapter.java:92)
> at
> org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
> at
> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
> at
> org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
> at
> org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:167)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
> at
> org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>
>
>
>
>
> On 12/5/2011 10:20 AM, Ed Merks wrote:
>> Roy,
>>
>> Please use eclipse.tools.emf for questions about EMF in the future. More
>> comments below...
>>
>> On 05/12/2011 10:06 AM, Roy Benjamin wrote:
>>> Hi,
>>>
>>> I wrote a plugin to generate additional java source needed for my
>>> application. It worked well under Galileo. Now under Helios I'm seeing
>>> almost random inexplicable behavior. For example, code being generated
>>> even when the plugin has been removed...
>>>
>>> <plugin>
>>> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
>>> <!-- Adapter Factory -->
>>> <adapterFactory
>>> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
>>> <!-- Single Adapter -->
>>> <!--
>>> <adapter modelClass="GenModel"
>>> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
>>>
>>>
>>> <adapter modelClass="GenClass"
>>> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
>>>
>>>
>>> -->
>>> </extension>
>>>
>>> I'm extending generatorAdapters
>>>
>>> Originally my plugin had a Templated/model folder with my single
>>> template. The target EMF project also had a Template/model folder
>>> having modified templates: Class.javajet and FactoryClass.javajet.
>> And you have settings in your GenModel to set up the template path? (I
>> suppose you followed the FAQ for this.)
>>> These over-rode standard gen behavior. Now they are invisible...
>> What things are invisible? These folders with the templates?
>>>
>>> Is there a tutorial or article about extending EMF code gen and
>>> over-riding standard generation?
>> No. There an example for using the generator adapters, but I've not seen
>> that you've added new template but rather are just wanting dynamic
>> templates (as in the FAQ).
>>>
>>>
>>> Thanks!!!!!!!!!!!!!!!!!!!
>> When in doubt, be sure to unfilter .* resources and look at whether the
>> ..JETEmitters project might be messed up. You can delete it completely,
>> including deleting it from the file system, and it will be regenerated
>> the next time you generate. You might want to close and reopen the
>> generator after such a cleanup...
>>>
>>> Roy
>
Re: serious help needed with EMF and JEt [message #761052 is a reply to message #761010] Mon, 05 December 2011 20:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ed,

You are right. In my adapter I used to pass null for arguments in
generateModel(Object,Monitor).

generateJava(targetPath, packageName, className, jetEmitter, null,
monitor2);

Somehow a GenClass instance was passed as the argument anyway.

Even if I get the correct arguments passed for the genClass case I'm not
sure how I'll know to pass genPackage for FactoryClass.javajet since
there is no genPackage() function.

I have to get this working again so I'll keep working.

Thanks
Roy




On 12/5/2011 11:12 AM, Ed Merks wrote:
> Roy,
>
> I think you'll need to revisit your copied template to make sure it
> works with the latest code. I see the stack below is being initiated by
> your own adapter GenClassDalGeneratorAdapter so I can't comment on what
> it's doing.
>
>
> On 05/12/2011 10:49 AM, Roy Benjamin wrote:
>> Also am seeing cast exception in the template:
>>
>> <%final GenClass genClass = (GenClass)((Object[])argument)[0]; final
>> GenPackage genPackage = genClass.getGenPackage(); final GenModel
>> genModel=genPackage.getGenModel();%>
>>
>> after changing template path to templates/model
>>
>> Thanks
>>
>> Roy
>>
>>
>>
>> java.lang.ClassCastException:
>> org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl incompatible
>> with [Ljava.lang.Object;
>> at
>> org.eclipse.emf.codegen.ecore.templates.model.Class_.generate(Class_.java:1793)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>>
>> at java.lang.reflect.Method.invoke(Method.java:599)
>> at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:467)
>> at
>> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:981)
>>
>> at
>> com.ebay.eclipse.emf.generator.dal.GenClassDalGeneratorAdapter.generateModel(GenClassDalGeneratorAdapter.java:92)
>>
>> at
>> org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
>>
>> at
>> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
>>
>> at
>> org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
>>
>> at
>> org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:167)
>>
>> at
>> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
>>
>> at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
>> at
>> org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
>>
>> at
>> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>>
>>
>>
>>
>>
>>
>> On 12/5/2011 10:20 AM, Ed Merks wrote:
>>> Roy,
>>>
>>> Please use eclipse.tools.emf for questions about EMF in the future. More
>>> comments below...
>>>
>>> On 05/12/2011 10:06 AM, Roy Benjamin wrote:
>>>> Hi,
>>>>
>>>> I wrote a plugin to generate additional java source needed for my
>>>> application. It worked well under Galileo. Now under Helios I'm seeing
>>>> almost random inexplicable behavior. For example, code being generated
>>>> even when the plugin has been removed...
>>>>
>>>> <plugin>
>>>> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
>>>> <!-- Adapter Factory -->
>>>> <adapterFactory
>>>> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
>>>> <!-- Single Adapter -->
>>>> <!--
>>>> <adapter modelClass="GenModel"
>>>> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
>>>>
>>>>
>>>> <adapter modelClass="GenClass"
>>>> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
>>>>
>>>>
>>>> -->
>>>> </extension>
>>>>
>>>> I'm extending generatorAdapters
>>>>
>>>> Originally my plugin had a Templated/model folder with my single
>>>> template. The target EMF project also had a Template/model folder
>>>> having modified templates: Class.javajet and FactoryClass.javajet.
>>> And you have settings in your GenModel to set up the template path? (I
>>> suppose you followed the FAQ for this.)
>>>> These over-rode standard gen behavior. Now they are invisible...
>>> What things are invisible? These folders with the templates?
>>>>
>>>> Is there a tutorial or article about extending EMF code gen and
>>>> over-riding standard generation?
>>> No. There an example for using the generator adapters, but I've not seen
>>> that you've added new template but rather are just wanting dynamic
>>> templates (as in the FAQ).
>>>>
>>>>
>>>> Thanks!!!!!!!!!!!!!!!!!!!
>>> When in doubt, be sure to unfilter .* resources and look at whether the
>>> ..JETEmitters project might be messed up. You can delete it completely,
>>> including deleting it from the file system, and it will be regenerated
>>> the next time you generate. You might want to close and reopen the
>>> generator after such a cleanup...
>>>>
>>>> Roy
>>
Re: serious help needed with EMF and JEt [message #761062 is a reply to message #761010] Mon, 05 December 2011 20:45 Go to previous message
Eclipse UserFriend
in my generated Class_.java I have:
System.out.println("*******************************************************************\n"+argument);
System.out.println("*******************************************************************");

stringBuffer.append(TEXT_2);
final GenClass genClass = (GenClass)((Object[])argument)[0]; final
GenPackage genPackage = genClass.getGenPackage(); final GenModel
genModel=genPackage.getGenModel(); <--------------------------------
cast exception on this line

System.out.println("\n0----------------------------------------------------------------\n");

The runtime output is:


*******************************************************************
org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl@5b905b9
(provider: Singleton, image: true, dynamic: false)
*******************************************************************

!ENTRY org.eclipse.emf.codegen.ecore 2 0 2011-12-05 12:39:14.554
!MESSAGE org.eclipse.emf.codegen.jet.JETException: InvocationTargetException
!STACK 0
org.eclipse.emf.common.util.WrappedException:
org.eclipse.emf.codegen.jet.JETException: InvocationTargetException
at
org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1112)
at
com.ebay.eclipse.emf.generator.dal.GenClassDalGeneratorAdapter.generateModel(GenClassDalGeneratorAdapter.java:99)
at
org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
at
org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
at
org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:167)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)




So, it looks like an instance of GenClassImpl cannot be cast to
interface GenClass. I've only seen something like this for classloader
problems.














On 12/5/2011 11:12 AM, Ed Merks wrote:
> Roy,
>
> I think you'll need to revisit your copied template to make sure it
> works with the latest code. I see the stack below is being initiated by
> your own adapter GenClassDalGeneratorAdapter so I can't comment on what
> it's doing.
>
>
> On 05/12/2011 10:49 AM, Roy Benjamin wrote:
>> Also am seeing cast exception in the template:
>>
>> <%final GenClass genClass = (GenClass)((Object[])argument)[0]; final
>> GenPackage genPackage = genClass.getGenPackage(); final GenModel
>> genModel=genPackage.getGenModel();%>
>>
>> after changing template path to templates/model
>>
>> Thanks
>>
>> Roy
>>
>>
>>
>> java.lang.ClassCastException:
>> org.eclipse.emf.codegen.ecore.genmodel.impl.GenClassImpl incompatible
>> with [Ljava.lang.Object;
>> at
>> org.eclipse.emf.codegen.ecore.templates.model.Class_.generate(Class_.java:1793)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
>>
>> at java.lang.reflect.Method.invoke(Method.java:599)
>> at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:467)
>> at
>> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:981)
>>
>> at
>> com.ebay.eclipse.emf.generator.dal.GenClassDalGeneratorAdapter.generateModel(GenClassDalGeneratorAdapter.java:92)
>>
>> at
>> org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
>>
>> at
>> org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
>>
>> at
>> org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
>>
>> at
>> org.eclipse.emf.codegen.ecore.genmodel.presentation.GeneratorUIUtil$GeneratorOperation.execute(GeneratorUIUtil.java:167)
>>
>> at
>> org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
>>
>> at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
>> at
>> org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
>>
>> at
>> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
>>
>>
>>
>>
>>
>>
>> On 12/5/2011 10:20 AM, Ed Merks wrote:
>>> Roy,
>>>
>>> Please use eclipse.tools.emf for questions about EMF in the future. More
>>> comments below...
>>>
>>> On 05/12/2011 10:06 AM, Roy Benjamin wrote:
>>>> Hi,
>>>>
>>>> I wrote a plugin to generate additional java source needed for my
>>>> application. It worked well under Galileo. Now under Helios I'm seeing
>>>> almost random inexplicable behavior. For example, code being generated
>>>> even when the plugin has been removed...
>>>>
>>>> <plugin>
>>>> <extension point="org.eclipse.emf.codegen.ecore.generatorAdapters">
>>>> <!-- Adapter Factory -->
>>>> <adapterFactory
>>>> class="com.sye.eclipse.emf.generator.dal.DalGeneratorAdapterFactory"/>
>>>> <!-- Single Adapter -->
>>>> <!--
>>>> <adapter modelClass="GenModel"
>>>> class="org.eclipse.emf.examples.generator.dal.GenModelDalGeneratorAdapter"/>
>>>>
>>>>
>>>> <adapter modelClass="GenClass"
>>>> class="org.eclipse.emf.examples.generator.dal.GenClassDalGeneratorAdapter"/>
>>>>
>>>>
>>>> -->
>>>> </extension>
>>>>
>>>> I'm extending generatorAdapters
>>>>
>>>> Originally my plugin had a Templated/model folder with my single
>>>> template. The target EMF project also had a Template/model folder
>>>> having modified templates: Class.javajet and FactoryClass.javajet.
>>> And you have settings in your GenModel to set up the template path? (I
>>> suppose you followed the FAQ for this.)
>>>> These over-rode standard gen behavior. Now they are invisible...
>>> What things are invisible? These folders with the templates?
>>>>
>>>> Is there a tutorial or article about extending EMF code gen and
>>>> over-riding standard generation?
>>> No. There an example for using the generator adapters, but I've not seen
>>> that you've added new template but rather are just wanting dynamic
>>> templates (as in the FAQ).
>>>>
>>>>
>>>> Thanks!!!!!!!!!!!!!!!!!!!
>>> When in doubt, be sure to unfilter .* resources and look at whether the
>>> ..JETEmitters project might be messed up. You can delete it completely,
>>> including deleting it from the file system, and it will be regenerated
>>> the next time you generate. You might want to close and reopen the
>>> generator after such a cleanup...
>>>>
>>>> Roy
>>
Previous Topic:Deferring Events of a Compound Command
Next Topic:Tagging model elements using toolbar
Goto Forum:
  


Current Time: Thu Dec 18 17:32:02 GMT 2014

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

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