Injecting selected project into view [message #1332832] |
Sun, 04 May 2014 21:16 |
Grzegorz Abramczyk Messages: 10 Registered: April 2011 |
Junior Member |
|
|
Hi I'm trying to get my view injected with reference to project selected in project explorer and I'm always getting null injected.
My code is
@Inject
public void setProject(@Optional @Active @Named(IServiceConstants.ACTIVE_SELECTION) final IProject project)throws CoreException {
if (project != null) {
this.viewer.setInput(this.projectStoreService.getConnection(project));
}
}
I traced problem to part of org.eclipse.e4.core.internal.di.InjectorImpl
if (!descriptorsClass.isAssignableFrom(actualArgs[i].getClass()))
actualArgs[i] = IInjector.NOT_A_VALUE;
Where selection is TreeSelection containing only one element, but even if it is project the check fails and I get null.
Is there an elegant way to get type safe injection like I'm trying to get or should I simply inject IStructuredSelection and decide if it is project in my code?
I'm using Eclipse PDE 4.3.2 with e4 tools bridge (my part is wrapped with DIViewPart).
[Updated on: Sun, 04 May 2014 21:16] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04182 seconds