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.internal.core.feature.FeatureImport; 17 import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel; 18 import org.eclipse.pde.internal.core.ifeature.IFeature; 19 import org.eclipse.pde.internal.core.ifeature.IFeatureImport; 20 import org.eclipse.pde.internal.core.ifeature.IFeatureModel; 21 import org.eclipse.swt.widgets.Shell; 22 23 public class CreateFeaturePatchOperation extends AbstractCreateFeatureOperation { 24 25 private IFeatureModel fFeatureModel; 26 27 public CreateFeaturePatchOperation(IProject project, IPath location, 28 FeatureData featureData, IFeatureModel featureModel, Shell shell) { 29 super(project, location, featureData, shell); 30 fFeatureModel = featureModel; 31 } 32 33 protected void configureFeature(IFeature feature, WorkspaceFeatureModel model) throws CoreException { 34 FeatureImport featureImport = (FeatureImport) model.getFactory().createImport(); 35 if (fFeatureModel != null) { 36 featureImport.loadFrom(fFeatureModel.getFeature()); 37 featureImport.setPatch(true); 38 featureImport.setVersion(fFeatureModel.getFeature().getVersion()); 39 featureImport.setId(fFeatureModel.getFeature().getId()); 40 } else if (fFeatureData.isPatch) { 41 featureImport.setType(IFeatureImport.FEATURE); 42 featureImport.setPatch(true); 43 featureImport.setVersion(fFeatureData.featureToPatchVersion); 44 featureImport.setId(fFeatureData.featureToPatchId); 45 } 46 feature.addImports(new IFeatureImport[] { featureImport }); 47 } 48 49 } 50 | Popular Tags |