1 11 package org.eclipse.pde.internal.ui.wizards.product; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.jface.dialogs.MessageDialog; 16 import org.eclipse.jface.wizard.Wizard; 17 import org.eclipse.pde.internal.core.iproduct.IProduct; 18 import org.eclipse.pde.internal.ui.PDEPluginImages; 19 import org.eclipse.pde.internal.ui.PDEUIMessages; 20 21 public class ProductDefinitionWizard extends Wizard { 22 23 private ProductDefinitonWizardPage fMainPage; 24 private String fProductId; 25 private String fPluginId; 26 private String fApplication; 27 private IProduct fProduct; 28 29 public ProductDefinitionWizard(IProduct product) { 30 fProduct = product; 31 setDefaultPageImageDescriptor(PDEPluginImages.DESC_DEFCON_WIZ); 32 setNeedsProgressMonitor(true); 33 setWindowTitle(PDEUIMessages.ProductDefinitionWizard_title); 34 } 35 36 public void addPages() { 37 fMainPage = new ProductDefinitonWizardPage("product", fProduct); addPage(fMainPage); 39 } 40 41 public boolean performFinish() { 42 try { 43 fProductId = fMainPage.getProductId(); 44 fPluginId = fMainPage.getDefiningPlugin(); 45 fApplication = fMainPage.getApplication(); 46 String newProductName = fMainPage.getProductName(); 47 if (newProductName != null) 48 fProduct.setName(newProductName); 49 getContainer().run( 50 false, 51 true, 52 new ProductDefinitionOperation(fProduct, 53 fPluginId, fProductId, fApplication, 54 getContainer().getShell())); 55 } catch (InvocationTargetException e) { 56 MessageDialog.openError(getContainer().getShell(), PDEUIMessages.ProductDefinitionWizard_error, e.getTargetException().getMessage()); 57 return false; 58 } catch (InterruptedException e) { 59 return false; 60 } 61 return true; 62 } 63 64 public String getProductId() { 65 return fPluginId + "." + fProductId; } 67 68 public String getApplication() { 69 return fApplication; 70 } 71 72 } 73 | Popular Tags |