Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[e4-dev] Improved handling of ID's - Suggestion for discussion

Hi,

one thing I like about Android programming, is that you can refer to static strings for ID's in a XML file (layout file) as well as in Java code. In the layout file you use @id/button1to point to a ID defined in a file.

In your Android coding you could reference the ID via a static string. This removes the issue that you may have typos either in your coding or in your layout and allows consistent refactoring of ID's.

One of the issues I believe still exists in todays Eclipse 4 plug-in development, is that you have to define a ID twice, once in your application model and at least once in your coding.

I really liked the change to bundleclass:// in M5. 

Perhaps we could introduce another URI for ID which could be referred to an ID defined in a file, e.g. 

modelid://Bundle-SymbolicName/path/filename.extension/id

And add another annotation, like @ID, which allows to annotate static strings and to mark them a ID's which could be used in the model as well in the coding.

@ID
public static final String part1 = "com.example.test.part1".

Would that be helpful? Is it worth to open a enhancement request for this?

Best regards, Lars
--
Lars
http://www.vogella.de - Eclipse, Android and Java Tutorials
http://www.twitter.com/vogella - Lars on Twitter

Back to the top