1 11 package org.eclipse.ui.wizards.datatransfer; 12 13 import java.util.List ; 14 15 import org.eclipse.jface.dialogs.IDialogSettings; 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.jface.viewers.StructuredSelection; 18 import org.eclipse.jface.wizard.Wizard; 19 import org.eclipse.ui.IImportWizard; 20 import org.eclipse.ui.IWorkbench; 21 import org.eclipse.ui.ide.IDE; 22 import org.eclipse.ui.internal.WorkbenchPlugin; 23 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; 24 import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; 25 import org.eclipse.ui.internal.wizards.datatransfer.WizardArchiveFileResourceImportPage1; 26 import org.eclipse.ui.plugin.AbstractUIPlugin; 27 28 49 public class ZipFileImportWizard extends Wizard implements IImportWizard { 50 private IWorkbench workbench; 51 52 private IStructuredSelection selection; 53 54 private WizardArchiveFileResourceImportPage1 mainPage; 55 56 60 public ZipFileImportWizard() { 61 AbstractUIPlugin plugin = WorkbenchPlugin.getDefault(); 62 IDialogSettings workbenchSettings = plugin.getDialogSettings(); 63 IDialogSettings section = workbenchSettings 64 .getSection("ZipFileImportWizard"); if (section == null) { 66 section = workbenchSettings.addNewSection("ZipFileImportWizard"); } 68 setDialogSettings(section); 69 } 70 71 74 public void addPages() { 75 super.addPages(); 76 mainPage = new WizardArchiveFileResourceImportPage1(workbench, selection); 77 addPage(mainPage); 78 } 79 80 81 84 public void init(IWorkbench workbench, IStructuredSelection currentSelection) { 85 this.workbench = workbench; 86 this.selection = currentSelection; 87 List selectedResources = IDE.computeSelectedResources(currentSelection); 88 if (!selectedResources.isEmpty()) { 89 this.selection = new StructuredSelection(selectedResources); 90 } 91 92 setWindowTitle(DataTransferMessages.DataTransfer_importTitle); 93 setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importzip_wiz.png")); setNeedsProgressMonitor(true); 95 } 96 97 100 public boolean performCancel() { 101 return mainPage.cancel(); 102 } 103 104 107 public boolean performFinish() { 108 return mainPage.finish(); 109 } 110 } 111 | Popular Tags |