Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » @Translation @Inject: org.eclipse.e4.core.di.InjectionException(Eclipse 4 internationalization)
@Translation @Inject: org.eclipse.e4.core.di.InjectionException [message #1736444] Wed, 29 June 2016 12:36 Go to next message
Jim 20100 is currently offline Jim 20100Friend
Messages: 69
Registered: June 2016
Member
Hi,

I followed the basic tutorial to translate my application.

1) I created a Message class
package biz.company.i18n;

public class Messages {
public String label;
public String msg;
}

2) In my package biz.company.i18n I have my property file: Messages.properties
label= testTitle
msg= Mon message

3) In my custom classes I have for example:

public class Test {

@Inject
@Translation
Messages messages;

private void test(){

MessageBox messageBoxTest = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.YES | SWT.NO);
messageBoxTest.setMessage(messages.label);
messageBoxTest.setText(messages.msg);
int responseTest = messageBoxTest.open();

...

Result:
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:62)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:825)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:701)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$6(HandledContributionItem.java:685)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:613)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)

Thx for any help
Re: @Translation @Inject: org.eclipse.e4.core.di.InjectionException [message #1736471 is a reply to message #1736444] Wed, 29 June 2016 15:16 Go to previous messageGo to next message
Eclipse UserFriend
The InjectionException is wrapping a NullPointerException. There should be more in that stack trace to point to the root cause.
Re: @Translation @Inject: org.eclipse.e4.core.di.InjectionException [message #1736472 is a reply to message #1736471] Wed, 29 June 2016 15:26 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Is the org.eclipse.equinox.ds bundle automatically started in your run configuration?
Previous Topic:How can maven take unpack jars from repository
Next Topic:TERRIBLE update to Neon
Goto Forum:
  


Current Time: Sat Apr 20 00:44:35 GMT 2024

Powered by FUDForum. Page generated in 0.02909 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top