[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.emf] Re: Refresh model / Dynamic Template Questions

Thanks, Ed, I have got it working now. It turns out that the generation
process doesn't work if my workspace directory is in a Windows network
drive. Once I moved the workspace directory back to my local drive,
everything works.

Charles

For your information, here's the stack trace (in the log file) when my
workspace directory is in a network drive (there are tons of them for
different classes):

java.lang.ClassNotFoundException:
org.eclipse.emf.codegen.ecore.templates.model.PluginProperties_
	at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
	at org.eclipse.emf.codegen.jet.JETEmitter.initialize(JETEmitter.java:407)
	at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:464)
	at
org.eclipse.emf.codegen.ecore.genmodel.impl.GenBaseImpl.generate(GenBaseImpl.java:264)
	at
org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelImpl.generate(GenModelImpl.java:1190)
	at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelActionBarContributor$1.generate(GenModelActionBarContributor.java:133)
	at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelActionBarContributor$2.execute(GenModelActionBarContributor.java:233)
	at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:71)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1595)
	at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:85)
	at
org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:302)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:252)
	at
org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:357)
	at
org.eclipse.emf.codegen.ecore.genmodel.presentation.GenModelActionBarContributor$GenerateAction.run(GenModelActionBarContributor.java:249)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:456)
	at
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:403)
	at
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:397)
	at
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:72)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1838)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1545)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385)
	at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:858)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:291)
	at org.eclipse.core.launcher.Main.run(Main.java:747)
	at org.eclipse.core.launcher.Main.main(Main.java:583)


Ed Merks wrote:

> Charles,

> The converted templates will appear in the project .JETEmitters.  This
project
> will likely be filtered from the view by default, so you must change the
> "Filter...->.* files" in the navigator dropdown menu.  (Sometimes the
converted
> files under src will be missing the very first time and you'll need to exit
the
> workbench and start up again.)  If your templates contain errors, they will
show
> up as errors in the resulting .java files.  If it gets past this and is able
to
> load them, there may be runtime errors in your customizations.  These will be
> logged so you should check the workspace/.metadata/.log for errors. 
Checking the
> log is always a good idea when reporting problems...


> Charles Chan wrote:

> > Hi, Dave, thanks for the answer. I am able to refresh the model now. :)
> > However, I still cannot customize the template. Basically, files are not
> > generated if I use my customized template.
> >
> > Thanks,
> > Charles
> >
> > Dave Steinberg wrote:
> >
> > > Charles Chan wrote:
> > > > 1. How do I refresh the EMF model with an updated Rose model? What I
would
> > > > like to do is to drive our development process with the Rose model. The
> > > > EMF editor plugin is not as intuitive (graphical) as the Rose one.
> >
> > > Hi Charles,
> >
> > > Right-click on your .genmodel file in the Navigator or Package Explorer
> > > view, and select Reload... from the pop-up menu.  The EMF wizard will run
> > > again, but with all of your previous settings filled in by default.  Just
> > > hit the Finish button to update the core and generator models.
> >
> > > > 2. I would like to make some changes to the templates. So what I have
done
> > > > is:
> > > >    a. Copy the templates directory from the emf.ecore directory to my
> > > > directory, say: C:temptemplates
> > > >    b. Change the genmodel properties: Dynamic Templates to True, and
> > > > Template Directory to C:temptemplates
> > > >
> > > >    When I regenerate the code, the running dialog shows the EMF is
> > > > compiling some JET templates but then it stops without any error
(there's
> > > > a warning about unused import on Properties.java) and NO files are
> > > > generated.
> >
> > > You'll need to keep the structure of the template sub-directories intact.
> > > So, for instance, if you're copying Class.javajet, you'll need to copy it
> > > into C:temptemplatesmodelClass.javajet.  You only need to copy the
> > > templates you wish to change; the others will be picked up from their
usual
> > > place.
> >
> > > As an aside, it often makes sense to put your templates in a
subdirectory of
> > > a project, making them accessible to you in Eclipse.  You can use a
> > > workspace-relative path as the value for Template Directory.  For
example,
> > > if you put them in a sub-directory of "MyProject" called "templates", you
> > > can enter "/MyProject/templates".
> >
> > > Hope this helps.
> >
> > > Cheers,
> > > Dave