1 /******************************************************************************* 2 * Copyright (c) 2015, 2019 Alex Blewitt 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 * Alex Blewitt <alex.blewitt@gmail.com> - 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.ibundle.IManifestHeader; 19 import org.eclipse.pde.internal.core.text.bundle.Bundle; 20 import org.eclipse.pde.internal.core.text.bundle.BundleModel; 21 import org.eclipse.pde.internal.ui.PDEUIMessages; 22 import org.osgi.framework.Constants; 23 24 public class AddActivationPolicyResolution extends AbstractManifestMarkerResolution { 25 AddActivationPolicyResolution(int type, IMarker marker)26 public AddActivationPolicyResolution(int type, IMarker marker) { 27 super(type, marker); 28 } 29 30 @Override createChange(BundleModel model)31 protected void createChange(BundleModel model) { 32 IBundle bundle = model.getBundle(); 33 if (bundle instanceof Bundle) { 34 Bundle bun = (Bundle) bundle; 35 IManifestHeader header = bun.getManifestHeader(Constants.BUNDLE_ACTIVATIONPOLICY); 36 if (header == null) { 37 bundle.setHeader(Constants.BUNDLE_ACTIVATIONPOLICY, Constants.ACTIVATION_LAZY); 38 } 39 } 40 } 41 42 @Override getDescription()43 public String getDescription() { 44 return PDEUIMessages.UpdateActivationResolution_bundleActivationPolicyAdd_desc; 45 } 46 47 @Override getLabel()48 public String getLabel() { 49 return PDEUIMessages.UpdateActivationResolution_bundleActivationPolicyAdd_label; 50 } 51 } 52