@Translation @Inject: org.eclipse.e4.core.di.InjectionException [message #1736444] |
Wed, 29 June 2016 08:36  |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04453 seconds