[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: How does code generation and custom code co-exist in a normal project?

For the EMF model code, I follow the "@generated NOT" technique.

For the GMF editors, I use dynamic templates to implement my custom code.

I also have additional custom code in a separate plugin which uses the GMF extension points (e.g. org.eclipse.gmf.runtime.diagram.ui.editpartProviders, org.eclipse.ui.popupMenus) to add functionality.

In both cases, I test all of my custom code changes through test cases to make sure they continue to work throughout the development lifecycle.

Jevon

RefuX wrote:
I was looking into centering my text in a label and I was able to figure out that in the generated code I can change the code in my 'createContents' method to set the alignment on the WrappingLabel to center.

However I'm still in the early days of tweaking my gmfgraph etc.. and as soon as I regenerate I will lose my custom code in the 'createContents' method. I don't want to do a @generated not, since there is still plenty of tweaking to do, and I do want the 'createContents' method to continue to be generated :)

So what do people typically do in this situation?

My expectation was that code generation would continue throughout the life-cycle of a GMF project. Maybe later on I decide to add some more diagram elements or change the ones I currently have. I'd sure like to continue to generate GMF code. But how can I continue to use GMF if all my custom code gets removed? Sure I could "@generated not" on all the sections I want to keep, but once I stop generated code being placed in places like my createContents method, then what value is GMF providing me now?

Anyways, I'm sure people have an approach that they have come up with that works well. I'd sure like to know what it is! :)

p.s. If anyone can tell me how to define the center alignment on a label in the gmpgraph, that would be great