1 /*******************************************************************************
2  * Copyright (c) 2011, 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.text.bundle.BundleModel;
18 import org.eclipse.pde.internal.ui.PDEUIMessages;
19 import org.osgi.framework.Constants;
20 
21 /**
22  * Resolution to add the Bundle-ManifestVersion header to the manifest.  Will set the manifest
23  * version to 2 to support OSGi R4 headers.
24  */
25 public class AddBundleManifestVersionResolution extends AbstractManifestMarkerResolution {
26 
AddBundleManifestVersionResolution(IMarker marker)27 	public AddBundleManifestVersionResolution(IMarker marker) {
28 		super(AbstractPDEMarkerResolution.CREATE_TYPE, marker);
29 	}
30 
31 	@Override
getLabel()32 	public String getLabel() {
33 		return PDEUIMessages.AddBundleManifestVersionResolution_label;
34 	}
35 
36 	@Override
getDescription()37 	public String getDescription() {
38 		return PDEUIMessages.AddBundleManifestVersionResolution_description;
39 	}
40 
41 	@Override
createChange(BundleModel model)42 	protected void createChange(BundleModel model) {
43 		// Add the Bundle-ManifestVersion header.
44 		model.getBundle().setHeader(Constants.BUNDLE_MANIFESTVERSION, String.valueOf(2));
45 	}
46 
47 }
48