package de.uka.ipd.sdq.beagle.gui;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Shell;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * The class setting up and controlling the wizard allowing the user to configure Beagle’s
 * behaviour during the analysis.
 * 
 * @author Christoph Michelbach
 */
public class BeagleAnalysisWizard extends Wizard {

	/**
	 * The constructor of this class.
	 */
	public BeagleAnalysisWizard() {
		super();
		setNeedsProgressMonitor(true);
	}

	@Override
	public String getWindowTitle() {
		return "Beagle Analysis";
	}

	@Override
	public void addPages() {
		final List<WizardPage> wizardPages = new LinkedList<WizardPage>();
		wizardPages.add(new SelectionOverviewWizardPage());
		wizardPages.add(new TimeoutWizardPage());
		final Iterator<WizardPage> iterator = wizardPages.iterator();

		while (iterator.hasNext()) {
			addPage(iterator.next());
		}
	}

	@Override
	public boolean performFinish() {
		// open dialog
		// TODO use timeout.getTimeout() when launching the analysis
		final String dialogTitle = "Beagle Analysis is Running";
		final String dialogMessage = "Beagle Analysis is running.";
		final String[] buttonLabels = {"Abort", "Pause"};
		final MessageDialog dialog = new MessageDialog(new Shell(), dialogTitle, null, dialogMessage,
			MessageDialog.INFORMATION, buttonLabels, 0);
		final int buttonClick = dialog.open();

		if (buttonClick == 0) {
			System.out.println("User clicked 'Abort'.");
		}

		if (buttonClick == 1) {
			System.out.println("User clicked 'Pause'.");
		}

		return true;
	}
}

@@ -33,56 +33,8 @@
 i;%0A%0A
-import org.eclipse.jface.dialogs.MessageDialog;%0A
 impo
@@ -117,46 +117,81 @@
 ge;%0A
+%0A
 import 
-org.eclipse.swt.widgets.Shell;%0A
+java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;
 %0Aimp
@@ -505,82 +505,480 @@
 The 
-constructor of this class.%0A%09 */%0A%09public BeagleAnalysisWizard() %7B%0A%09%09super()
+%7B@link ActionListener%7D which will be executed when the wizard finishes.%0A%09 */%0A%09private ActionListener wizardFinished;%0A%0A%09/**%0A%09 * Constructs a new %7B@link BeagleAnalysisWizard%7D which runs %7B@code wizardFinished%7D%0A%09 * when it finihes.%0A%09 * %0A%09 * @param wizardFinished The %7B@link ActionListener%7D which will be executed when the%0A%09 *            wizard finishes.%0A%09 */%0A%09public BeagleAnalysisWizard(final ActionListener wizardFinished) %7B%0A%09%09super();%0A%09%09this.wizardFinished = wizardFinished
 ;%0A%09%09
@@ -1477,602 +1477,89 @@
 %7B%0A%09%09
-// open dialog%0A%09%09// TODO use timeout.getTimeout() when launching the analysis%0A%09%09final String dialogTitle = %22Beagle Analysis is Running%22;%0A%09%09final String dialogMessage = %22Beagle Analysis is running.%22;%0A%09%09final String%5B%5D buttonLabels = %7B%22Abort%22, %22Pause%22%7D;%0A%09%09final MessageDialog dialog = new MessageDialog(new Shell(), dialogTitle, null, dialogMessage,%0A%09%09%09MessageDialog.INFORMATION, buttonLabels, 0);%0A%09%09final int buttonClick = dialog.open();%0A%0A%09%09if (buttonClick == 0) %7B%0A%09%09%09System.out.println(%22User clicked 'Abort'.%22);%0A%09%09%7D%0A%0A%09%09if (buttonClick == 1) %7B%0A%09%09%09System.out.println(%22User clicked 'Pause'.%22);%0A%09%09%7D%0A
+this.wizardFinished.actionPerformed(new ActionEvent(this, 0, %22wizard finished%22));
 %0A%09%09r

Put action behavior into `BeagleAnalysisWizard`.