1 11 package org.eclipse.pde.internal.ui.correction; 12 13 import org.eclipse.osgi.util.NLS; 14 import org.eclipse.pde.internal.core.text.bundle.Bundle; 15 import org.eclipse.pde.internal.core.text.bundle.BundleModel; 16 import org.eclipse.pde.internal.core.text.bundle.ImportPackageHeader; 17 import org.eclipse.pde.internal.core.text.bundle.ImportPackageObject; 18 import org.eclipse.pde.internal.ui.PDEUIMessages; 19 import org.osgi.framework.Constants; 20 21 public class OptionalImportPackageResolution extends AbstractManifestMarkerResolution { 22 23 private String fPackageName; 24 25 public OptionalImportPackageResolution(int type, String packageName) { 26 super(type); 27 fPackageName = packageName; 28 } 29 30 protected void createChange(BundleModel model) { 31 Bundle bundle = (Bundle)model.getBundle(); 32 ImportPackageHeader header = (ImportPackageHeader)bundle.getManifestHeader(Constants.IMPORT_PACKAGE); 33 if (header != null) { 34 ImportPackageObject pkg = header.getPackage(fPackageName); 35 if (pkg != null) 36 pkg.setOptional(true); 37 } 38 } 39 40 public String getDescription() { 41 return NLS.bind(PDEUIMessages.OptionalImportPkgResolution_description, fPackageName); 42 } 43 44 public String getLabel() { 45 return NLS.bind(PDEUIMessages.OptionalImportPkgResolution_label, fPackageName); 46 } 47 48 } 49 | Popular Tags |