Eclipse E4 RCP Interface Implementation

cojack20

Mitglied
Hallo,

ich bin gerade neu beim Einarbeiten in das Thema Eclipse E4. Jetzt habe ich folgendes Problem:


Ich habe eine @PostConstruct Methode (siehe erster Code), die ein Interface bekommt. Dieses Interface beschreibt, wie eine "View" Factory aussieht. Siehe zweiter Code Schnipsel. Und die Implementierung im dritten Code.

JETZT mein Problem. Ich möchte die Implementierung der Factory gerne in ein eigenes Plugin legen, sodass je nach dem welches Plugin eingebunden ist, die aktuelle Factory geladen wird und damit der View beim Startup sich ändert.
Das Problem ist, dass E4 offensichtlich nicht diese Abhängigkeit auflösen kann (DataExplorerFactoryImpl --> implements IDataExplorerFactory --> kann damit injected werden)

Ich habe testweise die Klassen alle ins selbe Plugin gelegt, als auch in zwei verschiedene Plugins. Das Interface soll vom Hauptplugin bereitgestellt werden.
Jemand eine Idee warum der folgende Fehler auftritt?!
org.eclipse.e4.core.di.InjectionException: Unable to process "DataExplorerPart#createControls()": no actual value was found for the argument "IDataExplorerFactory"


Code:
public class DataExplorerPart {
	private IDataExplorer dataExplorer;
	
	@Inject
	private Model model;
	
	@Inject
	private ESelectionService selectionService;
	
	@PostConstruct
	public void createControls(Composite parent, IDataExplorerFactory explorerFactory) {
		dataExplorer = explorerFactory.createDataExplorer(parent);
		dataExplorer.setModel(model);
		dataExplorer.setSelectionService(selectionService);
	} 
[...]


Interface
Code:
public interface IDataExplorerFactory {

	IDataExplorer createDataExplorer(Composite parent);

}


Interface Implementation
Code:
@Creatable
public class DataExplorerFactoryImpl implements IDataExplorerFactory {

	@Override
	public IDataExplorer createDataExplorer(Composite parent) {
		return new DataExplorerTable(parent, SWT.NONE);
	}

}
 
Zurück