Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dali-dev] Listening for Entity Generation operations

Hi Karen,

We could probably copy a bunch of code, but this seems like a big reaction to a change for a Dali maintenance release, and is going to cause us to rewrite a bunch of our code. I think this change may have actually been spurred by one of our bug reports requesting an IProgressMonitor to be added to the EntityGeneration operation, but I'd rather have had this change deferred to the 2.0 release since it is a behavioral change of some significance.

In any case, what we really want to do is basically in a black box have the user launch the Dali wizard and generate entities and then we want to display those generated entities. We really don't need to do any specialized wizard or entity generation, so the API you mentioned would probably be more than what we need in our case. Really, we just need some sort of event notification that the entity generation is finished which we could listen for. This is why we had requested the ability to pass in our own ProgressMonitor. I imagine the Dali model is listening for new entities being created. Is some way we could listen for these changes as well to update our display? I think for now as you mentioned it might be easiest if we just overwrite some of the Dali code. We currently are just calling GenerateEntitesAction.execute(). Instead, it sounds like we could call: new EntitiesGenerator( project, selection).generate() and overwrite the generate() method to call WorkspaceJob.runInWorkspace(IProgressMonitor) instead of WorkspaceJob.schedule(). I think that would give us exactly what we are looking for; it would allow us to run the operations in the foreground (as it used to) and allow us to pass our own progress monitor that we could then listen on. Does this sound like it should work for what we need for the present?

Thanks
Tom

Message: 2
Date: Wed, 05 Sep 2007 12:57:01 -0400
From: Karen Moore <karen.moore@xxxxxxxxxx>
Subject: Re: [dali-dev] Listening for Entity Generation operations
To: "General Dali EJB ORM developer discussion."
	<dali-dev@xxxxxxxxxxx>
Message-ID: <46DEDFDD.4000305@xxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Tom,

It seems that what you (and probably Chris as well) really want to do is to run the wizard and the entity generation operation yourself. In the generic platform we call org.eclipse.jpt.ui.internal.generic.EntitiesGenerator.generate(IJpaProject, IStructuredSelection). In here we run the GenerateEntitiesWizard and then schedule the WorkspaceJob that generates the entities and synchronizes the persistence.xml classes. You should probably be using PackageGenerator.generateEntities() which takes an IProgressMonitor. I would assume that you would copy a lot of the code in EntitiesGenerator and change how the Job is run. Then you would be able to hook in at the right moment to do your post-processing, probably before the persistence.xml SynchronizeClassesJob is run. Look at the code in EntitiesGenerator.GenerateEntitiesRunnable.runInWorkspace(IProgressMonitor). I would expect your code to come after the call to PackageGenerator.generatesEntities().

The most likely candidate for public API here is PackageGenerator.generateEntities(Config, EntityGenerator.Config, Collection<Table>, OverwriteConfirmer, IProgressMonitor). Does this sound reasonable?

Karen




Back to the top