package com.opcoach.training.e4.codesamples;

import javax.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.wizard.Wizard;

public class SampleWizard extends Wizard
{
	private SampleWizardPage firstPage = null;
		
	private IEclipseContext context; 
	
    @Inject 
	public SampleWizard(IEclipseContext ctx)
	{
		setWindowTitle("New Wizard");
		context = ctx;
	}

	@Override
	public void addPages()
	{
		firstPage = ContextInjectionFactory.make(SampleWizardPage.class, context);
		addPage(firstPage);
	}

	@Override
	public boolean performFinish()
	{
		// Do your stuff here by asking the pages...
		return true;
	}

}

@@ -314,11 +314,8 @@
 ll;%0A
-%09%09%0A
 %09pri
@@ -345,16 +345,16 @@
 ntext; %0A
+
 %09%0A    @I
@@ -593,24 +593,198 @@
 rstPage);%0A%09%7D
+%0A%09%0A%09@Override%0A%09public void dispose()%0A%09%7B%0A%09%09// Don't forget to uninject pages created with make ! %0A%09%09ContextInjectionFactory.uninject(firstPage, context);%0A%09%09super.dispose();%0A%09%7D
 %0A%0A%09@Override
@@ -866,16 +866,93 @@
 ages...%0A
+%09%09// Use an AntRunner to create projects structures or to manipulate files !%0A
 %09%09return
@@ -958,14 +958,13 @@
 n true;%0A
+
 %09%7D%0A
-%0A
 %7D%0A

Add an uninject in the wizard dispose