1 11 package org.eclipse.pde.internal.ui.wizards.feature; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IPath; 16 import org.eclipse.pde.core.plugin.IPluginBase; 17 import org.eclipse.pde.internal.core.feature.FeaturePlugin; 18 import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel; 19 import org.eclipse.pde.internal.core.ifeature.IFeature; 20 import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; 21 import org.eclipse.pde.internal.core.util.CoreUtility; 22 import org.eclipse.swt.widgets.Shell; 23 24 public class CreateFeatureProjectOperation extends AbstractCreateFeatureOperation { 25 26 protected IPluginBase[] fPlugins; 27 28 public CreateFeatureProjectOperation(IProject project, IPath location, 29 FeatureData featureData, IPluginBase[] plugins, Shell shell) { 30 super(project, location, featureData, shell); 31 fPlugins = plugins != null ? plugins : new IPluginBase[0]; 32 } 33 34 protected void configureFeature(IFeature feature, WorkspaceFeatureModel model) throws CoreException { 35 IFeaturePlugin[] added = new IFeaturePlugin[fPlugins.length]; 36 for (int i = 0; i < fPlugins.length; i++) { 37 IPluginBase plugin = fPlugins[i]; 38 FeaturePlugin fplugin = (FeaturePlugin) model.getFactory().createPlugin(); 39 fplugin.loadFrom(plugin); 40 fplugin.setVersion("0.0.0"); fplugin.setUnpack(CoreUtility.guessUnpack(plugin.getPluginModel().getBundleDescription())); 42 added[i] = fplugin; 43 } 44 feature.addPlugins(added); 45 } 46 47 } 48 | Popular Tags |