1 11 12 package org.eclipse.pde.internal.ui.wizards.feature; 13 14 import org.eclipse.core.resources.IProject; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.core.runtime.IPath; 17 import org.eclipse.debug.core.ILaunchConfiguration; 18 import org.eclipse.debug.core.ILaunchConfigurationType; 19 import org.eclipse.pde.core.plugin.IPluginBase; 20 import org.eclipse.pde.core.plugin.IPluginModelBase; 21 import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel; 22 import org.eclipse.pde.internal.core.ifeature.IFeature; 23 import org.eclipse.pde.internal.ui.launcher.BundleLauncherHelper; 24 import org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator; 25 import org.eclipse.swt.widgets.Shell; 26 27 public class CreateFeatureProjectFromLaunchOperation extends 28 CreateFeatureProjectOperation { 29 30 private ILaunchConfiguration fLaunchConfig; 31 32 public CreateFeatureProjectFromLaunchOperation(IProject project, IPath location, 33 FeatureData featureData, ILaunchConfiguration launchConfig, Shell shell) { 34 super(project, location, featureData, null, shell); 35 fLaunchConfig = launchConfig; 36 } 37 38 protected void configureFeature(IFeature feature, 39 WorkspaceFeatureModel model) throws CoreException { 40 fPlugins = getPlugins(); 41 super.configureFeature(feature, model); 42 } 43 44 private IPluginBase[] getPlugins() { 45 IPluginModelBase[] models = null; 46 try { 47 ILaunchConfigurationType type =fLaunchConfig.getType(); 48 String id = type.getIdentifier(); 49 if (id.equals("org.eclipse.pde.ui.RuntimeWorkbench")) models = LaunchPluginValidator.getPluginList(fLaunchConfig); 52 else if (id.equals("org.eclipse.pde.ui.EquinoxLauncher")) models = BundleLauncherHelper.getMergedBundles(fLaunchConfig); 55 } catch (CoreException e) { 56 } 57 IPluginBase[] result = new IPluginBase[models == null ? 0 : models.length]; 58 for (int i = 0; i < result.length; i++) 59 result[i] = models[i].getPluginBase(true); 60 return result; 61 } 62 63 } 64 | Popular Tags |