/*
 * Perfclispe
 * 
 * 
 * Copyright (c) 2013 Jakub Knetl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.perfclipse.ui.wizards;

import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.wizard.Wizard;

/**
 * @author Jakub Knetl
 *
 */
public class GeneratorEditWizard extends Wizard {

	private GeneratorPage generatorPage;
	private CompoundCommand command;

	public GeneratorEditWizard() {
	}

	@Override
	public boolean performFinish() {

		command = new CompoundCommand("Generator edit");

		return true;
	}

	@Override
	public void addPages() {
		generatorPage = new GeneratorPage();
		addPage(generatorPage);

		super.addPages();
	}
	
	public CompoundCommand getCommand(){
		return command;
	}
}

@@ -744,299 +744,1541 @@
 rd;%0A
-%0A/**%0A * @author Jakub Knetl%0A *%0A */%0Apublic class GeneratorEditWizard extends Wizard %7B%0A%0A%09private GeneratorPage generatorPage;%0A%09private CompoundCommand command;%0A%0A%09public GeneratorEditWizard() %7B%0A%09%7D%0A%0A%09@Override%0A%09public boolean performFinish() %7B%0A%0A%09%09command = new CompoundCommand(%22Generator edit%22);
+import org.perfcake.model.ObjectFactory;%0Aimport org.perfcake.model.Scenario.Generator;%0Aimport org.perfcake.model.Scenario.Generator.Run;%0Aimport org.perfclipse.model.GeneratorModel;%0Aimport org.perfclipse.ui.gef.commands.EditGeneratorRunCommand;%0Aimport org.perfclipse.ui.gef.commands.EditGeneratorThreadsCommand;%0Aimport org.perfclipse.ui.gef.commands.RenameGeneratorCommand;%0A%0A/**%0A * @author Jakub Knetl%0A *%0A */%0Apublic class GeneratorEditWizard extends Wizard %7B%0A%0A%09private GeneratorPage generatorPage;%0A%09private CompoundCommand command;%0A%09private GeneratorModel generator;%0A%0A%09public GeneratorEditWizard(GeneratorModel generator) %7B%0A%09%09this.generator = generator;%0A%09%7D%0A%0A%09@Override%0A%09public boolean performFinish() %7B%0A%0A%09%09command = new CompoundCommand(%22Generator edit%22);%0A%09%09%0A%09%09Generator gen = generator.getGenerator();%0A%09%09%0A%09%09if (!(gen.getClazz().equals(generatorPage.getGeneratorName())))%7B%0A%09%09%09command.add(new RenameGeneratorCommand(generator, generatorPage.getGeneratorName()));%0A%09%09%7D%0A%09%09if (!(gen.getRun().getType().equals(generatorPage.getRunType())) %0A%09%09%09%09%7C%7C !(gen.getRun().getValue().equals(generatorPage.getRunValue())))%7B%0A%09%09%09Run run = new ObjectFactory().createScenarioGeneratorRun();%0A%09%09%09run.setType(generatorPage.getRunType());%0A%09%09%09run.setValue(Integer.toString(generatorPage.getRunValue()));%0A%09%09%09command.add(new EditGeneratorRunCommand(generator, run));%0A%09%09%7D%0A%09%09%0A%09%09if (!(gen.getThreads().equals(Integer.toString(generatorPage.getThreads()))))%7B%0A%09%09%09command.add(new EditGeneratorThreadsCommand(generator, Integer.toString(generatorPage.getThreads())));%0A%09%09%7D
 %0A%0A%09%09

Create command on generator wizard close