1 11 package org.eclipse.jdt.internal.ui.macbundler; 12 13 import java.io.IOException ; 14 import java.net.MalformedURLException ; 15 import java.net.URL ; 16 17 import org.eclipse.jdt.internal.launching.macosx.MacOSXLaunchingPlugin; 18 import org.eclipse.jface.resource.ImageDescriptor; 19 import org.eclipse.jface.viewers.IStructuredSelection; 20 import org.eclipse.jface.wizard.Wizard; 21 import org.eclipse.ui.*; 22 import org.eclipse.ui.IExportWizard; 23 24 25 public class MacBundleWizard extends Wizard implements IExportWizard, BundleAttributes { 26 27 IWorkbench fWorkbench; 28 IStructuredSelection fSelection; 29 BundleDescription fBundleDescription= new BundleDescription(); 30 31 public MacBundleWizard() { 32 setDefaultPageImageDescriptor(createWizardImageDescriptor("exportapp_wiz.gif")); setWindowTitle(Util.getString("MacBundleWizard.title")); } 35 36 39 public void init(IWorkbench workbench, IStructuredSelection selection) { 40 fWorkbench= workbench; 41 fSelection= selection; 42 } 43 44 IStructuredSelection getSelection() { 45 return fSelection; 46 } 47 48 52 public void addPages() { 53 super.addPages(); 54 addPage(new BundleWizardPage1(fBundleDescription)); 55 addPage(new BundleWizardPage2(fBundleDescription)); 56 addPage(new BundleWizardPage3(fBundleDescription)); 57 } 58 59 62 public boolean performFinish() { 63 try { 64 BundleBuilder bb= new BundleBuilder(); 65 bb.createBundle(fBundleDescription, null); 66 } catch (IOException e) { 67 e.printStackTrace(); 69 } 70 return true; 71 } 72 73 private static ImageDescriptor createWizardImageDescriptor(String name) { 74 try { 75 URL baseUrl= MacOSXLaunchingPlugin.getDefault().getBundle().getEntry("/icons/full/wizban/"); if (baseUrl != null) 77 return ImageDescriptor.createFromURL(new URL (baseUrl, name)); 78 } catch (MalformedURLException e) { 79 } 81 return ImageDescriptor.getMissingImageDescriptor(); 82 } 83 } 84 | Popular Tags |