/** Constructor to create a new wizard */ public NewPluginProjectFromTemplateWizard() { setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWPPRJ_WIZ); setDialogSettings(PDEPlugin.getDefault().getDialogSettings()); setWindowTitle(PDEUIMessages.NewProjectWizard_title); setNeedsProgressMonitor(true); fPluginData = new PluginFieldData(); }
/* * (non-Javadoc) * * @see org.eclipse.pde.internal.ui.wizards.NewWizard#performFinish() */ public boolean performFinish() { try { fProjectPage.updateData(); fContentPage.updateData(); IDialogSettings settings = getDialogSettings(); if (settings != null) { fProjectPage.saveSettings(settings); fContentPage.saveSettings(settings); } BasicNewProjectResourceWizard.updatePerspective(fConfig); getContainer() .run( false, true, new NewProjectCreationOperation(fPluginData, fProjectProvider, fTemplateWizard)); IWorkingSet[] workingSets = fProjectPage.getSelectedWorkingSets(); if (workingSets.length > 0) getWorkbench() .getWorkingSetManager() .addToWorkingSets(fProjectProvider.getProject(), workingSets); return true; } catch (InvocationTargetException e) { PDEPlugin.logException(e); } catch (InterruptedException e) { } return false; }
/** * Creates a WizardElement representing the template extension to be used by this wizard. * * @return element representing the template or <code>null</code> if the extension could not be * loaded */ private WizardElement getTemplateWizard() { String templateID = getTemplateID(); if (templateID == null) { return null; } IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PDEPlugin.getPluginId(), PLUGIN_POINT); if (point == null) { return null; } IExtension[] extensions = point.getExtensions(); for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] elements = extensions[i].getConfigurationElements(); for (int j = 0; j < elements.length; j++) { if (elements[j].getName().equals(TAG_WIZARD)) { if (templateID.equals(elements[j].getAttribute(WizardElement.ATT_ID))) { return WizardElement.create(elements[j]); } } } } return null; }