[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[e4-dev] NLS-System and Eclipse 4.0
|
Hi,
Now that we have a fundamental translation stuff for our EMF-Model in
place the next problem I'd like to approach is the useage of the static
NLS-Translation loading which in fact contratics the e4 paradigm of NO
SINGLETONS AND STATICS.
This is the only place left in our code which prohibits multi-instance
scenarios like e.g. RAP run our workbench code as is.
As part of the translation story I've developed an idea of how I think
we should deal with it in an e4 like way.
a) Instead of using static-Fields I think we'll have to use instance-
fields
Messages.My_Message => messages.my_message
b) To load translations we provide a factory which creates an instance
of the field
NLS.initialize() =>
IMessageFactory.createInstance(String lang, Class<M> clazz);
=> Configuration through an @Message-Annotation (e.g. to
overload the default Class-Name => Properties-File name mapping)
=> Built-In cache of Message-Instances so that we don't waste memory
loading the same translations multiple times into multiple
instances (including memory management if Message-Instance get
unused its memory can be freed)
c) Easy usage with DI by adding an annotation @Translation similar to
@Preference
@Inject
@Translation
private Messages messages;
I've implemented a primary version of this in my
org.eclipse.e4.tools.services bundle (you find it in the post_m5 branch)
and I'm going to port my ModelEditor to use it in the next few days.
Afterwards I'll try to measure this approach so that I can you some
figures. As always with new things the current tooling provided the
Eclipse is not available (like it is for the current NLS-stuff) but I
still think we should find not use NLS in our e4 code base because it
contratics the most central programming pattern we've built Eclipse 4
around.
Tom
--
B e s t S o l u t i o n . a t EDV Systemhaus GmbH
------------------------------------------------------------------------
tom schindl geschaeftsfuehrer/CEO
------------------------------------------------------------------------
eduard-bodem-gasse 5/1 A-6020 innsbruck phone ++43 512 935834