1 11 package org.eclipse.ui.wizards.datatransfer; 12 13 import java.util.List ; 14 15 import org.eclipse.core.runtime.Platform; 16 import org.eclipse.jface.dialogs.IDialogSettings; 17 import org.eclipse.jface.viewers.IStructuredSelection; 18 import org.eclipse.jface.viewers.StructuredSelection; 19 import org.eclipse.jface.wizard.Wizard; 20 import org.eclipse.ui.IImportWizard; 21 import org.eclipse.ui.IWorkbench; 22 import org.eclipse.ui.PlatformUI; 23 import org.eclipse.ui.ide.IDE; 24 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; 25 import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; 26 import org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceImportPage1; 27 import org.eclipse.ui.plugin.AbstractUIPlugin; 28 29 50 public class FileSystemImportWizard extends Wizard implements IImportWizard { 51 private IWorkbench workbench; 52 53 private IStructuredSelection selection; 54 55 private WizardFileSystemResourceImportPage1 mainPage; 56 57 61 public FileSystemImportWizard() { 62 AbstractUIPlugin plugin = (AbstractUIPlugin) Platform 63 .getPlugin(PlatformUI.PLUGIN_ID); 64 IDialogSettings workbenchSettings = plugin.getDialogSettings(); 65 IDialogSettings section = workbenchSettings 66 .getSection("FileSystemImportWizard"); if (section == null) { 68 section = workbenchSettings.addNewSection("FileSystemImportWizard"); } 70 setDialogSettings(section); 71 } 72 73 76 public void addPages() { 77 super.addPages(); 78 mainPage = new WizardFileSystemResourceImportPage1(workbench, selection); 79 addPage(mainPage); 80 } 81 82 83 86 public void init(IWorkbench workbench, IStructuredSelection currentSelection) { 87 this.workbench = workbench; 88 this.selection = currentSelection; 89 90 List selectedResources = IDE.computeSelectedResources(currentSelection); 91 if (!selectedResources.isEmpty()) { 92 this.selection = new StructuredSelection(selectedResources); 93 } 94 95 setWindowTitle(DataTransferMessages.DataTransfer_importTitle); 96 setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png")); setNeedsProgressMonitor(true); 98 } 99 100 103 public boolean performFinish() { 104 return mainPage.finish(); 105 } 106 } 107 | Popular Tags |