1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.jface.resource.ImageDescriptor; 14 import org.eclipse.jface.viewers.IStructuredSelection; 15 import org.eclipse.jface.wizard.Wizard; 16 import org.eclipse.ui.IWorkbench; 17 import org.eclipse.ui.internal.IWorkbenchGraphicConstants; 18 import org.eclipse.ui.internal.WorkbenchImages; 19 import org.eclipse.ui.internal.WorkbenchMessages; 20 21 28 public class ImportExportWizard extends Wizard { 29 33 public static final String IMPORT = "import"; 38 public static final String EXPORT = "export"; 40 private IWorkbench workbench; 41 private IStructuredSelection selection; 42 private ImportExportPage importExportPage; 43 private String page = null; 44 45 51 public ImportExportWizard(String pageId){ 52 page = pageId; 53 } 54 55 59 public boolean performFinish() { 60 importExportPage.saveWidgetValues(); 61 return true; 62 } 63 64 67 public void addPages() { 68 if (page.equals(IMPORT)) { 69 importExportPage = new ImportPage(this.workbench, this.selection); 70 } else if (page.equals(EXPORT)) { 71 importExportPage = new ExportPage(this.workbench, this.selection); 72 } 73 if (importExportPage != null) { 74 addPage(importExportPage); 75 } 76 } 77 78 84 public void init(IWorkbench aWorkbench, 85 IStructuredSelection currentSelection) { 86 this.workbench = aWorkbench; 87 this.selection = currentSelection; 88 89 ImageDescriptor wizardBannerImage = null; 90 if (IMPORT.equals(page)){ 91 wizardBannerImage = WorkbenchImages 92 .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ); 93 setWindowTitle(WorkbenchMessages.ImportWizard_title); 94 } 95 else if (EXPORT.equals(page)){ 96 wizardBannerImage = WorkbenchImages 97 .getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ); 98 setWindowTitle(WorkbenchMessages.ExportWizard_title); 99 } 100 if (wizardBannerImage != null) { 101 setDefaultPageImageDescriptor(wizardBannerImage); 102 } 103 setNeedsProgressMonitor(true); 104 } 105 } 106 | Popular Tags |