| //------------------------------------------------------------------------------ |
| // Copyright (c) 2005, 2006 IBM Corporation and others. |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // IBM Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| package org.eclipse.epf.export.xml.wizards; |
| |
| import org.eclipse.epf.export.ExportPlugin; |
| import org.eclipse.epf.export.ExportResources; |
| import org.eclipse.epf.export.xml.XmlExportResources; |
| import org.eclipse.epf.export.xml.services.XmlExportData; |
| import org.eclipse.epf.library.ui.wizards.BaseWizardPage; |
| import org.eclipse.jface.wizard.IWizardPage; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.GridLayout; |
| import org.eclipse.swt.widgets.Button; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Event; |
| import org.eclipse.swt.widgets.Listener; |
| |
| |
| /** |
| * A wizard page to select the export mode |
| * |
| * @author Jinhua Xi |
| * @since 1.0 |
| */ |
| public class ExportXmlModelSelectionPage extends BaseWizardPage implements Listener { |
| |
| |
| public static final String PAGE_NAME = ExportXmlModelSelectionPage.class |
| .getName(); |
| |
| private Button radio_lib; |
| private Button radio_plugins; |
| private Button radio_configs; |
| |
| |
| /** |
| * Creates a new instance. |
| */ |
| public ExportXmlModelSelectionPage() { |
| super(PAGE_NAME); |
| setTitle(ExportResources.selectExportTypePage_title); |
| setDescription(ExportResources.selectExportTypePage_desc); //$NON-NLS-1$ |
| setImageDescriptor(ExportPlugin.getDefault().getImageDescriptor( |
| "full/wizban/ExportLibraryConfiguration.gif")); //$NON-NLS-1$ |
| } |
| |
| /** |
| * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) |
| */ |
| public void createControl(Composite parent) { |
| Composite container = new Composite(parent, SWT.NONE); |
| container.setLayout(new GridLayout()); |
| |
| radio_lib = createRadioButton( |
| container, XmlExportResources.ExportXmlModelSelectionPage_export_library, 1, true); |
| |
| radio_plugins = createRadioButton( |
| container, XmlExportResources.ExportXmlModelSelectionPage_export_plugin, 1, false); |
| |
| radio_configs = createRadioButton( |
| container, XmlExportResources.ExportXmlModelSelectionPage_export_config, 1, false); |
| |
| addListeners(); |
| |
| setControl(container); |
| setPageComplete(true); |
| } |
| |
| private void addListeners() { |
| radio_lib.addListener(SWT.Selection, this); |
| radio_plugins.addListener(SWT.Selection, this); |
| radio_configs.addListener(SWT.Selection, this); |
| } |
| |
| public void handleEvent(Event event) { |
| setPageComplete(isPageComplete()); |
| getWizard().getContainer().updateButtons(); |
| } |
| |
| |
| public IWizardPage getNextPage() { |
| ExportXmlWizard wizard = (ExportXmlWizard) getWizard(); |
| |
| if (radio_lib.getSelection()) { |
| wizard.data.export_model = XmlExportData.EXPORT_MODEL_LIB; |
| return wizard.filePage; |
| } else if (radio_plugins.getSelection()) { |
| wizard.data.export_model = XmlExportData.EXPORT_MODEL_PLUGINS; |
| return wizard.selPluginPage; |
| } else if (radio_configs.getSelection()) { |
| wizard.data.export_model = XmlExportData.EXPORT_MODEL_SPECS; |
| return wizard.filePage; |
| } |
| return null; |
| } |
| |
| } |