1 /*******************************************************************************
2  *  Copyright (c) 2019 IBM Corporation and others.
3  *
4  *  This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License 2.0
6  *  which accompanies this distribution, and is available at
7  *  https://www.eclipse.org/legal/epl-2.0/
8  *
9  *  SPDX-License-Identifier: EPL-2.0
10  *
11  *  Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.pde.internal.ui.correction;
15 
16 import org.eclipse.core.resources.IMarker;
17 import org.eclipse.pde.internal.core.ibundle.IBundle;
18 import org.eclipse.pde.internal.core.text.bundle.*;
19 import org.eclipse.pde.internal.ui.PDEUIMessages;
20 import org.osgi.framework.Constants;
21 
22 public class AddExportPackageInternalDirectiveMarkerResolution extends AddExportPackageMarkerResolution {
23 
AddExportPackageInternalDirectiveMarkerResolution(IMarker mark, int type, String values)24 	public AddExportPackageInternalDirectiveMarkerResolution(IMarker mark, int type, String values) {
25 		super(mark, type, values);
26 	}
27 
28 	@Override
getLabel()29 	public String getLabel() {
30 		return PDEUIMessages.AddExportPackageInternalDirectiveResolution_Label;
31 	}
32 
33 	@Override
createChange(BundleModel model)34 	protected void createChange(BundleModel model) {
35 		IBundle bundle = model.getBundle();
36 		if (bundle instanceof Bundle) {
37 			Bundle bun = (Bundle) bundle;
38 			ExportPackageHeader header = (ExportPackageHeader) bun.getManifestHeader(Constants.EXPORT_PACKAGE);
39 			if (header == null) {
40 				bundle.setHeader(Constants.EXPORT_PACKAGE, ""); //$NON-NLS-1$
41 				header = (ExportPackageHeader) bun.getManifestHeader(Constants.EXPORT_PACKAGE);
42 			}
43 			processPackages(header, true);
44 		}
45 	}
46 
47 }
48