Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358439 - Change GenTopic so that only Interface definitions from the model are generated
Summary: Change GenTopic so that only Interface definitions from the model are generated
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.2 M3   Edit
Assignee: Dean Roberts CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 358722
  Show dependency tree
 
Reported: 2011-09-21 11:03 EDT by Dean Roberts CLA
Modified: 2011-10-26 14:53 EDT (History)
3 users (show)

See Also:


Attachments
Change so GenTopic only generates model code (25.40 KB, text/plain)
2011-09-23 09:46 EDT, Dean Roberts CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Roberts CLA 2011-09-21 11:03:07 EDT
Eric pointed out that as we move forward with other kinds of life cycle events, there will be a need for several publish methods.  (One patch I submitted had the method in ModelServiceImpl where it was used by brintToTop).

There are also several "static" kinds of methods being "generated" in UIEvents ... the build methods, and the non lifecycle events themselves come to mind.

To make adding these methods easier than pasting in long strings of escaped Java text I suggest that we create a class E4Events.java and make UIEvents.java a subclass of it.  Then we can move everything that is not truly generated up from UIEvents into E4Events.
Comment 1 Dean Roberts CLA 2011-09-21 14:32:25 EDT
Meh ...

While mocking up the shape described above it leads to some unwanted behaviour/refactoring in calling code that revolve around having to access statics from a super class directly.

It's kind of wonky and not worth doing, especially since it seems that UIEvent is API now.
Comment 2 Dean Roberts CLA 2011-09-22 13:25:53 EDT
Eric had a simple suggestion that, after playing around with it I liked.

I propose that we modify GenTopic so that it only outputs the interface definitions for the items generated from the model.  It will NOT generate the import statements, copyrights, class definitions, life cycle events or static utility methods and fields.

All the non-generated code would just be hand written and left in the file with a comment saying essentially (Copy generated code here).

This should work just fine as long as we have no intentions of trying to create a fully automated tool ... which is just fine for us.
Comment 3 Eric Moffatt CLA 2011-09-22 20:40:54 EDT
We both noticed that when we were adding the 'life cycle' events (bug 357255) 
that adding 'printf' statements to generate code was 'less than optimal'. 

Since the current work flow is to run the 'GenTopic' application and manually Copy/Paste the result into the file we'd just need to add the comments to an existing UIEvents file and remove the part of the generator that emits code (adding comments on how to generate what goes between the comments...;-).

Dean, you want it, you got it...if you can get me a patch soonest, this has got to be a lob ball after the save perspective stuff...;-).
Comment 4 Dean Roberts CLA 2011-09-23 09:46:45 EDT
Created attachment 203900 [details]
Change so GenTopic only generates model code

Here is a patch so that GenTopic now only generates interface definitions from the model.  It does not try to generated class comments, headers, imports, static methods and the like.

This patch also includes the new UIEvents.java which has the hand crafted class comments, headers, static build methods etc.
Comment 5 Eric Moffatt CLA 2011-09-23 14:24:00 EDT
Pushed in >20110823.

commit 76e60e7106717654a87cab8926f9e960bcd1b8cd

This should make it easier to hand-modify the non-generated code...
Comment 6 Dean Roberts CLA 2011-10-26 14:53:45 EDT
Verified on I20111014-1625