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(); }
@Override public boolean performOk() { // Save JM2T settings. IJM2TProject project = JM2TCore.create(getProject()); try { project.setRawGeneratorConfiguration(generatorConfigurationComp.getElements(), null); } catch (CoreException e) { EclipseUtil.openError(super.getShell(), Messages.savingSettingsError, JM2TUI.createStatus(e)); } return true; }
private IJM2TProject getJM2Project() { return JM2TCore.create(getProject()); }