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;
	}

}

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 void dispose()
	{
		// Don't forget to uninject pages created with make ! 
		ContextInjectionFactory.uninject(firstPage, context);
		super.dispose();
	}

	@Override
	public boolean performFinish()
	{
		// Do your stuff here by asking the pages...
		// Use an AntRunner to create projects structures or to manipulate files !
		return true;
	}
}

Add an uninject in the wizard dispose
Add an uninject in the wizard dispose

(Fix https://opcoach.atlassian.net/browse/FOR-127)

Change-Id: I6494b5646a52bee20c12a2656aa9c7189a90b0ec
Signed-off-by: Olivier Prouvost <922fcad8957c9a47efb13ab034b8bf0240ed7092@opcoach.com>
