KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > correction > RemoveInternalDirectiveEntryResolution


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.correction;
12
13 import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
14 import org.eclipse.pde.internal.core.text.bundle.BundleModel;
15 import org.eclipse.pde.internal.core.text.bundle.ExportPackageHeader;
16 import org.eclipse.pde.internal.core.text.bundle.ExportPackageObject;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18 import org.osgi.framework.Constants;
19
20 public class RemoveInternalDirectiveEntryResolution extends
21         AbstractManifestMarkerResolution {
22     
23     private String JavaDoc fPackageName;
24
25     public RemoveInternalDirectiveEntryResolution(int type, String JavaDoc packageName) {
26         super(type);
27         fPackageName = packageName;
28     }
29
30     protected void createChange(BundleModel model) {
31         IManifestHeader header = model.getBundle().getManifestHeader(Constants.EXPORT_PACKAGE);
32         if (header instanceof ExportPackageHeader) {
33             ExportPackageObject exportedPackage = ((ExportPackageHeader)header).getPackage(fPackageName);
34             if (exportedPackage != null)
35                 exportedPackage.removeInternalDirective();
36         }
37     }
38
39     public String JavaDoc getLabel() {
40         return PDEUIMessages.RemoveInternalDirective_label;
41     }
42
43     public String JavaDoc getDescription() {
44         return PDEUIMessages.RemoveInternalDirective_desc;
45     }
46
47 }
48
Popular Tags