Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Dependency Injection
Dependency Injection [message #1080097] Mon, 05 August 2013 13:12
Patrick Sowada is currently offline Patrick SowadaFriend
Messages: 7
Registered: July 2009
Junior Member
Hi,

i want to use DI with my own classes and variables but unfortunately it doesn't work.

I use eclipse 4.2.2.

I want to use the variable "table" from the ListView class in the CreateFeatureHanlder but i get always this error message:
Quote:
org.eclipse.e4.core.di.InjectionException: Unable to process "ListView.table": no actual value was f
ound for the argument "javafx.scene.control.TableView<Feature>".


@SuppressWarnings("restriction")
public class ListView {
 
    @Inject 
    private TableView<Feature> table;
    
    
    @SuppressWarnings("unchecked")
    @Inject
    public ListView(BorderPane parent, final MApplication application, IEclipseContext context) {
    table = new TableView<Feature>();
       
        ... (content of the table)
   
    context.modify("table", table);
    }
    
}


public class CreateFeatureHandler {
 
 
    private Stage stage;
 
    @Execute
    @Inject
    void execute(@Optional final Feature feature, @Named("table") final TableView<Feature> table) {
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));
    final TextField name = new TextField();
    name.setPromptText("name");
    final TextField number = new TextField();
    number.setPromptText("number");
    Button b = new Button("Create");
    b.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent e) {
        Feature feat = TeamFactory.eINSTANCE.createFeature();
        feat.setName(name.getText());
        feat.setNumber(number.getText());
        LocalFileTest.addFeatureAndSaveIt(feat);
 
        System.out.println("TABLE:\t"+table);
        stage.close();
        }
    });
 
    grid.add(new Label("name:"), 0, 0);
    grid.add(name, 1, 0);
    grid.add(new Label("number:"), 0, 1);
    grid.add(number, 1, 1);
    grid.add(b, 1, 2);
 
    stage = new Stage(StageStyle.DECORATED);
    stage.initModality(Modality.WINDOW_MODAL);
 
    Scene s1 = new Scene(grid);
    stage.setScene(s1);
    stage.show();
 
    }
Previous Topic:Why my audio file .wav are shown in eclipse like a .txt file?
Next Topic:Line Breaks Between Methods
Goto Forum:
  


Current Time: Thu Apr 25 03:39:06 GMT 2024

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

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

Back to the top