protected int showWizard( TaskModel taskModel, final IGeneratorConfiguration generatorConfiguration) { String title = null; WizardFragment fragment = null; taskModel.putObject(TaskModel.TASK_JM2T_PROJECT, JM2TCore.create(getProject())); if (generatorConfiguration == null) { // Add New generator configuration title = Messages.wizNewGeneratorConfigurationWizardTitle; fragment = new WizardFragment() { protected void createChildFragments(List<WizardFragment> list) { list.add(new SelectGeneratorTypeWizardFragment()); list.add(new SelectModelConverterTypeWizardFragment()); list.add(WizardTaskUtil.SaveRuntimeFragment); } }; } else { // Edit selected generator configuration title = Messages.wizEditGeneratorConfigurationWizardTitle; final WizardFragment fragment2 = getEditGeneratorConfigurationWizardFragment(generatorConfiguration); taskModel.putObject(TaskModel.TASK_GENERATOR_CONFIGURATION, generatorConfiguration); fragment = new WizardFragment() { protected void createChildFragments(List<WizardFragment> list) { list.add(fragment2); list.add(WizardTaskUtil.SaveRuntimeFragment); } }; } TaskWizard wizard = new TaskWizard(title, fragment, taskModel); wizard.setForcePreviousAndNextButtons(true); WizardDialog dialog = new WizardDialog(getShell(), wizard); return dialog.open(); }
private void doAddButton() { TaskModel taskModel = new TaskModel(); if (showWizard(taskModel, null) == Window.OK) { IGeneratorConfiguration generatorConfiguration = (IGeneratorConfiguration) taskModel.getObject(TaskModel.TASK_GENERATOR_CONFIGURATION); generatorConfigurationComp.addElement(generatorConfiguration); } }
private void doEditButton() { List<IGeneratorConfiguration> selectedElements = generatorConfigurationComp.getSelectedElements(); if (selectedElements == null || selectedElements.size() < 1) { return; } IGeneratorConfiguration selectedGeneratorConfiguration = selectedElements.get(0); TaskModel taskModel = new TaskModel(); if (showWizard(taskModel, selectedGeneratorConfiguration) == Window.OK) { IGeneratorConfiguration generatorConfiguration = (IGeneratorConfiguration) taskModel.getObject(TaskModel.TASK_GENERATOR_CONFIGURATION); generatorConfigurationComp.replaceElement( selectedGeneratorConfiguration, generatorConfiguration); } }