View | Details | Raw Unified | Return to bug 181210 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/PDECoreMessages.java (+1 lines)
Lines 187-192 Link Here
187
	public static String BundleErrorReporter_InvalidFormatInBundleVersion;
187
	public static String BundleErrorReporter_InvalidFormatInBundleVersion;
188
	public static String BundleErrorReporter_NotExistInProject;
188
	public static String BundleErrorReporter_NotExistInProject;
189
	public static String BundleErrorReporter_BundleRangeInvalidInBundleVersion;
189
	public static String BundleErrorReporter_BundleRangeInvalidInBundleVersion;
190
	public static String BundleErrorReporter_R4SyntaxInR3Bundle;
190
191
191
	public static String BundleErrorReporter_invalidVersionRangeFormat;
192
	public static String BundleErrorReporter_invalidVersionRangeFormat;
192
	public static String BundleErrorReporter_NotExistPDE;
193
	public static String BundleErrorReporter_NotExistPDE;
(-)src/org/eclipse/pde/internal/core/pderesources.properties (+1 lines)
Lines 176-181 Link Here
176
BundleErrorReporter_unsatisfiedConstraint=Unsatisfied constraint: ''{0}''
176
BundleErrorReporter_unsatisfiedConstraint=Unsatisfied constraint: ''{0}''
177
BundleErrorReporter_noExecutionEnvironmentSet=No required execution environment has been set
177
BundleErrorReporter_noExecutionEnvironmentSet=No required execution environment has been set
178
BundleErrorReporter_MissingVersion=''{0}'' is missing version constraint information
178
BundleErrorReporter_MissingVersion=''{0}'' is missing version constraint information
179
BundleErrorReporter_R4SyntaxInR3Bundle=OSGi Release 4 syntax in an OSGi Release 3 bundle
179
BundleTextChangeListener_editNames_newLine=Add a new line at the end of the file
180
BundleTextChangeListener_editNames_newLine=Add a new line at the end of the file
180
BundleTextChangeListener_editNames_remove=Remove "{0}" header
181
BundleTextChangeListener_editNames_remove=Remove "{0}" header
181
BundleTextChangeListener_editNames_insert=Insert "{0}" header
182
BundleTextChangeListener_editNames_insert=Insert "{0}" header
(-)src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java (+22 lines)
Lines 151-156 Link Here
151
		validatePluginId(header, id);
151
		validatePluginId(header, id);
152
		validateSingleton(header, elements[0]);
152
		validateSingleton(header, elements[0]);
153
153
154
		// Header introduced in OSGi R4 - warn if R3 manifest
155
		if (!fOsgiR4)
156
			report(PDECoreMessages.BundleErrorReporter_R4SyntaxInR3Bundle, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE, PDEMarkerFactory.CAT_OTHER);
157
154
		return true;
158
		return true;
155
	}
159
	}
156
160
Lines 230-235 Link Here
230
			return;
234
			return;
231
		}
235
		}
232
236
237
		// Header introduced in OSGi R4 - warn if R3 manifest
238
		if (!fOsgiR4)
239
			report(PDECoreMessages.BundleErrorReporter_R4SyntaxInR3Bundle, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE, PDEMarkerFactory.CAT_OTHER);
240
233
		if (!isCheckUnresolvedImports())
241
		if (!isCheckUnresolvedImports())
234
			return;
242
			return;
235
243
Lines 550-555 Link Here
550
				}
558
				}
551
			}
559
			}
552
		}
560
		}
561
562
		// Header introduced in OSGi R4 - warn if R3 manifest
563
		if (!fOsgiR4)
564
			report(PDECoreMessages.BundleErrorReporter_R4SyntaxInR3Bundle, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE, PDEMarkerFactory.CAT_OTHER);
565
553
	}
566
	}
554
567
555
	private void validateBundleVersionAttribute(IHeader header, ManifestElement element) {
568
	private void validateBundleVersionAttribute(IHeader header, ManifestElement element) {
Lines 966-971 Link Here
966
		int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_DEPRECATED);
979
		int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_DEPRECATED);
967
		if (header == null)
980
		if (header == null)
968
			return;
981
			return;
982
983
		// Header introduced in OSGi R4 - warn if R3 manifest
984
		if (!fOsgiR4)
985
			report(PDECoreMessages.BundleErrorReporter_R4SyntaxInR3Bundle, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE, PDEMarkerFactory.CAT_OTHER);
986
969
		if (TargetPlatformHelper.getTargetVersion() >= 3.3) {
987
		if (TargetPlatformHelper.getTargetVersion() >= 3.3) {
970
			validateHeaderValue(header, new String[] {Constants.ACTIVATION_LAZY});
988
			validateHeaderValue(header, new String[] {Constants.ACTIVATION_LAZY});
971
		} else if (severity != CompilerFlags.IGNORE && !containsValidActivationHeader()) {
989
		} else if (severity != CompilerFlags.IGNORE && !containsValidActivationHeader()) {
Lines 1130-1135 Link Here
1130
			location = new String();
1148
			location = new String();
1131
		}
1149
		}
1132
1150
1151
		// Header introduced in OSGi R4 - warn if R3 manifest
1152
		if (!fOsgiR4)
1153
			report(PDECoreMessages.BundleErrorReporter_R4SyntaxInR3Bundle, header.getLineNumber() + 1, CompilerFlags.WARNING, PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE, PDEMarkerFactory.CAT_OTHER);
1154
1133
		IResource res = PDEProject.getBundleRoot(fProject).findMember(location);
1155
		IResource res = PDEProject.getBundleRoot(fProject).findMember(location);
1134
		if (res == null || !(res instanceof IContainer)) {
1156
		if (res == null || !(res instanceof IContainer)) {
1135
			report(PDECoreMessages.BundleErrorReporter_localization_folder_not_exist, header.getLineNumber() + 1, CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_RESOURCE), PDEMarkerFactory.CAT_OTHER);
1157
			report(PDECoreMessages.BundleErrorReporter_localization_folder_not_exist, header.getLineNumber() + 1, CompilerFlags.getFlag(fProject, CompilerFlags.P_UNKNOWN_RESOURCE), PDEMarkerFactory.CAT_OTHER);
(-)src/org/eclipse/pde/internal/core/builders/PDEMarkerFactory.java (+1 lines)
Lines 47-52 Link Here
47
	public static final int M_MISSING_BUNDLE_CLASSPATH_ENTRY = 0x1021; // fatal problem
47
	public static final int M_MISSING_BUNDLE_CLASSPATH_ENTRY = 0x1021; // fatal problem
48
	public static final int M_LAZYLOADING_HAS_NO_EFFECT = 0x1022; //other problem
48
	public static final int M_LAZYLOADING_HAS_NO_EFFECT = 0x1022; //other problem
49
	public static final int M_DISCOURAGED_CLASS = 0x1023; //other problem
49
	public static final int M_DISCOURAGED_CLASS = 0x1023; //other problem
50
	public static final int M_R4_SYNTAX_IN_R3_BUNDLE = 0x1025; // other problem
50
51
51
	// build properties fixes
52
	// build properties fixes
52
	public static final int B_APPEND_SLASH_FOLDER_ENTRY = 0x2001;
53
	public static final int B_APPEND_SLASH_FOLDER_ENTRY = 0x2001;
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+3 lines)
Lines 2936-2941 Link Here
2936
	public static String AddExportPackageResolution_Label;
2936
	public static String AddExportPackageResolution_Label;
2937
	public static String AddBundleClassPathResolution_add;
2937
	public static String AddBundleClassPathResolution_add;
2938
2938
2939
	public static String AddBundleManifestVersionResolution_description;
2940
	public static String AddBundleManifestVersionResolution_label;
2941
2939
	public static String AddToJavaSearchJob_0;
2942
	public static String AddToJavaSearchJob_0;
2940
2943
2941
	public static String AntGeneratingExportWizard_0;
2944
	public static String AntGeneratingExportWizard_0;
(-)src/org/eclipse/pde/internal/ui/correction/AddBundleManifestVersionResolution.java (+45 lines)
Added Link Here
1
package org.eclipse.pde.internal.ui.correction;
2
3
import java.util.HashMap;
4
import java.util.Map;
5
import org.eclipse.osgi.util.NLS;
6
import org.eclipse.pde.internal.core.text.bundle.BundleModel;
7
import org.eclipse.pde.internal.ui.PDEUIMessages;
8
import org.osgi.framework.Constants;
9
10
/**
11
 * Resolution to add the Bundle-ManifestVersion header to the manifest.
12
 */
13
public class AddBundleManifestVersionResolution extends AbstractManifestMarkerResolution {
14
15
	/** Bundle-ManifestVersion to use. */
16
	private String fManifestVersion;
17
18
	/** Map between Bundle-ManifestVersions and OSGi versions. */
19
	private static Map manifestVersionToOSGiVersion = new HashMap(2);
20
21
	static {
22
		manifestVersionToOSGiVersion.put("1", "3"); //$NON-NLS-1$//$NON-NLS-2$
23
		manifestVersionToOSGiVersion.put("2", "4"); //$NON-NLS-1$//$NON-NLS-2$
24
	}
25
26
	public AddBundleManifestVersionResolution(String manifestVersion) {
27
		super(AbstractPDEMarkerResolution.CREATE_TYPE);
28
		this.fManifestVersion = manifestVersion;
29
	}
30
31
	public String getLabel() {
32
		return NLS.bind(PDEUIMessages.AddBundleManifestVersionResolution_label, manifestVersionToOSGiVersion.get(fManifestVersion));
33
	}
34
35
	public String getDescription() {
36
		return NLS.bind(PDEUIMessages.AddBundleManifestVersionResolution_description, manifestVersionToOSGiVersion.get(fManifestVersion), fManifestVersion);
37
	}
38
39
	protected void createChange(BundleModel model) {
40
		
41
		// Add the Bundle-ManifestVersion header.
42
		model.getBundle().setHeader(Constants.BUNDLE_MANIFESTVERSION, fManifestVersion);
43
	}
44
45
}
(-)src/org/eclipse/pde/internal/ui/correction/ResolutionGenerator.java (+2 lines)
Lines 105-110 Link Here
105
				return new IMarkerResolution[] {new AddBundleClassPathMarkerResolution(AbstractPDEMarkerResolution.CREATE_TYPE, marker.getAttribute("entry", null))}; //$NON-NLS-1$
105
				return new IMarkerResolution[] {new AddBundleClassPathMarkerResolution(AbstractPDEMarkerResolution.CREATE_TYPE, marker.getAttribute("entry", null))}; //$NON-NLS-1$
106
			case PDEMarkerFactory.M_LAZYLOADING_HAS_NO_EFFECT :
106
			case PDEMarkerFactory.M_LAZYLOADING_HAS_NO_EFFECT :
107
				return new IMarkerResolution[] {new RemoveLazyLoadingDirectiveResolution(AbstractPDEMarkerResolution.REMOVE_TYPE, marker.getAttribute("header", ICoreConstants.ECLIPSE_LAZYSTART))}; //$NON-NLS-1$
107
				return new IMarkerResolution[] {new RemoveLazyLoadingDirectiveResolution(AbstractPDEMarkerResolution.REMOVE_TYPE, marker.getAttribute("header", ICoreConstants.ECLIPSE_LAZYSTART))}; //$NON-NLS-1$
108
			case PDEMarkerFactory.M_R4_SYNTAX_IN_R3_BUNDLE :
109
				return new IMarkerResolution[] {new AddBundleManifestVersionResolution("2")}; //$NON-NLS-1$
108
		}
110
		}
109
		return NO_RESOLUTIONS;
111
		return NO_RESOLUTIONS;
110
	}
112
	}
(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+2 lines)
Lines 2126-2131 Link Here
2126
OptionalImportPkgResolution_label=Mark package ''{0}'' as an optional imported package
2126
OptionalImportPkgResolution_label=Mark package ''{0}'' as an optional imported package
2127
OptionalRequireBundleResolution_description=Mark bundle ''{0}'' as optional
2127
OptionalRequireBundleResolution_description=Mark bundle ''{0}'' as optional
2128
OptionalRequireBundleResolution_label=Mark bundle ''{0}'' as optional
2128
OptionalRequireBundleResolution_label=Mark bundle ''{0}'' as optional
2129
AddBundleManifestVersionResolution_description=Mark the manifest for use by OSGi Release {0} by adding the ''Bundle-ManifestVersion: {1}'' header
2130
AddBundleManifestVersionResolution_label=Mark the manifest for use by OSGi Release {0}
2129
OrganizeManifestJob_taskName=Organizing Manifest Headers...
2131
OrganizeManifestJob_taskName=Organizing Manifest Headers...
2130
OrganizeManifestsWizard_title=Organize Manifests Wizard
2132
OrganizeManifestsWizard_title=Organize Manifests Wizard
2131
OrganizeManifestsWizardPage_title=Organize Manifests
2133
OrganizeManifestsWizardPage_title=Organize Manifests

Return to bug 181210