Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 222309 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java (-102 / +89 lines)
Lines 39-44 Link Here
39
	/**
39
	/**
40
	 * A capability namespace representing the type of Eclipse resource (bundle, feature, source bundle, etc)
40
	 * A capability namespace representing the type of Eclipse resource (bundle, feature, source bundle, etc)
41
	 * @see RequiredCapability#getNamespace()
41
	 * @see RequiredCapability#getNamespace()
42
	 * @see ProvidedCapability#getNamespace()
42
	 */
43
	 */
43
	public static final String NAMESPACE_ECLIPSE_TYPE = "org.eclipse.equinox.p2.eclipse.type"; //$NON-NLS-1$
44
	public static final String NAMESPACE_ECLIPSE_TYPE = "org.eclipse.equinox.p2.eclipse.type"; //$NON-NLS-1$
44
45
Lines 46-51 Link Here
46
	 * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace 
47
	 * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace 
47
	 * representing and OSGi bundle resource
48
	 * representing and OSGi bundle resource
48
	 * @see RequiredCapability#getName()
49
	 * @see RequiredCapability#getName()
50
	 * @see ProvidedCapability#getName()
49
	 */
51
	 */
50
	public static final String TYPE_ECLIPSE_BUNDLE = "bundle"; //$NON-NLS-1$
52
	public static final String TYPE_ECLIPSE_BUNDLE = "bundle"; //$NON-NLS-1$
51
	/**
53
	/**
Lines 63-73 Link Here
63
	public static final String TYPE_ECLIPSE_SOURCE = "source"; //$NON-NLS-1$
65
	public static final String TYPE_ECLIPSE_SOURCE = "source"; //$NON-NLS-1$
64
66
65
	/**
67
	/**
66
	 * A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace 
68
	 * A capability namespace representing the localization (translation)
67
	 * representing localized manifest properties
69
	 * of strings from a specified IU in a specified locale
68
	 * @see RequiredCapability#getName()
70
	 * @see RequiredCapability#getNamespace()
71
	 * @see ProvidedCapability#getNamespace()
69
	 */
72
	 */
70
	public static final String TYPE_ECLIPSE_MANIFEST_LOCALIZATION = "manifest.localization"; //$NON-NLS-1$
73
	public static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$
71
74
72
	// Only certain properties in the bundle manifest are assumed to be localized.
75
	// Only certain properties in the bundle manifest are assumed to be localized.
73
	public static final String[] BUNDLE_LOCALIZED_PROPERTIES = {Constants.BUNDLE_NAME, Constants.BUNDLE_DESCRIPTION, Constants.BUNDLE_VENDOR, Constants.BUNDLE_CONTACTADDRESS, Constants.BUNDLE_DOCURL, Constants.BUNDLE_UPDATELOCATION};
76
	public static final String[] BUNDLE_LOCALIZED_PROPERTIES = {Constants.BUNDLE_NAME, Constants.BUNDLE_DESCRIPTION, Constants.BUNDLE_VENDOR, Constants.BUNDLE_CONTACTADDRESS, Constants.BUNDLE_DOCURL, Constants.BUNDLE_UPDATELOCATION};
Lines 106-112 Link Here
106
	public static final ProvidedCapability BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new Version(1, 0, 0));
109
	public static final ProvidedCapability BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new Version(1, 0, 0));
107
	public static final ProvidedCapability FEATURE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, new Version(1, 0, 0));
110
	public static final ProvidedCapability FEATURE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, new Version(1, 0, 0));
108
	public static final ProvidedCapability SOURCE_BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, new Version(1, 0, 0));
111
	public static final ProvidedCapability SOURCE_BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, new Version(1, 0, 0));
109
	public static final ProvidedCapability MANIFEST_LOCALIZATION_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_MANIFEST_LOCALIZATION, new Version(1, 0, 0));
110
112
111
	static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$	
113
	static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$	
112
	static final String PROPERTIES_FILE_EXTENSION = ".properties"; //$NON-NLS-1$
114
	static final String PROPERTIES_FILE_EXTENSION = ".properties"; //$NON-NLS-1$
Lines 173-195 Link Here
173
		return MetadataFactory.createInstallableUnit(cu);
175
		return MetadataFactory.createInstallableUnit(cu);
174
	}
176
	}
175
177
176
	public static IInstallableUnit createBundleIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key, Set localizationIUs) {
178
	public static IInstallableUnit createBundleIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key) {
177
		IInstallableUnit bundleIU = createBundleIU(bd, manifest, isFolderPlugin, key);
179
		Map manifestLocalizations = null;
178
179
		if (manifest != null && bd.getLocation() != null) {
180
		if (manifest != null && bd.getLocation() != null) {
180
			String bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION);
181
			manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation()));
181
			if (bundleLocalization == null) {
182
				bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION;
183
			}
184
			Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation()));
185
			if (manifestLocalizations != null) {
186
				localizationIUs.addAll(createLocalizationFragmentsForBundle(bd, manifestLocalizations));
187
			}
188
		}
182
		}
189
		return bundleIU;
183
184
		return createBundleIU(bd, manifest, isFolderPlugin, key, manifestLocalizations);
190
	}
185
	}
191
186
192
	public static IInstallableUnit createBundleIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key) {
187
	public static IInstallableUnit createBundleIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key, Map manifestLocalizations) {
193
		boolean isBinaryBundle = true;
188
		boolean isBinaryBundle = true;
194
		if (manifest != null && manifest.containsKey("Eclipse-SourceBundle")) { //$NON-NLS-1$
189
		if (manifest != null && manifest.containsKey("Eclipse-SourceBundle")) { //$NON-NLS-1$
195
			isBinaryBundle = false;
190
			isBinaryBundle = false;
Lines 250-255 Link Here
250
245
251
		if (isFragment)
246
		if (isFragment)
252
			providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_FRAGMENT, bd.getHost().getName(), bd.getVersion()));
247
			providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_FRAGMENT, bd.getHost().getName(), bd.getVersion()));
248
249
		if (manifestLocalizations != null) {
250
			for (Iterator iter = manifestLocalizations.keySet().iterator(); iter.hasNext();) {
251
				Locale locale = (Locale) iter.next();
252
				Properties translatedStrings = (Properties) manifestLocalizations.get(locale);
253
				Enumeration propertyKeys = translatedStrings.propertyNames();
254
				while (propertyKeys.hasMoreElements()) {
255
					String nextKey = (String) propertyKeys.nextElement();
256
					iu.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
257
				}
258
				providedCapabilities.add(makeTranslationCapability(bd.getSymbolicName(), locale));
259
			}
260
		}
261
253
		iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
262
		iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
254
263
255
		iu.setArtifacts(new IArtifactKey[] {key});
264
		iu.setArtifacts(new IArtifactKey[] {key});
Lines 284-340 Link Here
284
		return MetadataFactory.createInstallableUnit(iu);
293
		return MetadataFactory.createInstallableUnit(iu);
285
	}
294
	}
286
295
287
	private static List createLocalizationFragmentsForBundle(BundleDescription bd, Map manifestLocalizations) {
288
		List localizationFragments = new ArrayList(manifestLocalizations.size());
289
		for (Iterator iter = manifestLocalizations.keySet().iterator(); iter.hasNext();) {
290
			Locale locale = (Locale) iter.next();
291
			Properties localizedStrings = (Properties) manifestLocalizations.get(locale);
292
			IInstallableUnitFragment nextLocaleFragment = createLocalizationFragmentOfBundle(bd, locale, localizedStrings);
293
			localizationFragments.add(nextLocaleFragment);
294
		}
295
		return localizationFragments;
296
	}
297
298
	/*
296
	/*
299
	 * @param bd
297
	 * @param bd
300
	 * @param locale
298
	 * @param manifestLocalizations	map from locale to translated properties
301
	 * @param localizedStrings
302
	 * @return installableUnitFragment
299
	 * @return installableUnitFragment
303
	 */
300
	 */
304
	private static IInstallableUnitFragment createLocalizationFragmentOfBundle(BundleDescription bd, Locale locale, Properties localizedStrings) {
301
	//	private static IInstallableUnitFragment createLocalizationFragmentOfBundle(BundleDescription bd, Map manifestLocalizations) {
305
		InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription();
302
	//		InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription();
306
		String fragmentId = makeLocalizationFragmentId(bd.getSymbolicName(), locale);
303
	//		String fragmentId = makeBundleLocalizationFragmentId(bd.getSymbolicName());
307
		fragment.setId(fragmentId);
304
	//		fragment.setId(fragmentId);
308
		fragment.setVersion(bd.getVersion());
305
	//		fragment.setVersion(bd.getVersion());
309
306
	//
310
		RequiredCapability[] hostReqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, bd.getSymbolicName(), new VersionRange(bd.getVersion(), true, bd.getVersion(), true), null, false, false)};
307
	//		RequiredCapability[] hostReqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, bd.getSymbolicName(), new VersionRange(bd.getVersion(), true, bd.getVersion(), true), null, false, false, false)};
311
		fragment.setHost(hostReqs);
308
	//		fragment.setHost(hostReqs);
312
309
	//
313
		fragment.setSingleton(true);
310
	//		fragment.setSingleton(true);
314
311
	//
315
		Enumeration propertyKeys = localizedStrings.propertyNames();
312
	//		ArrayList providedCapabilities = new ArrayList(manifestLocalizations.size());
316
		while (propertyKeys.hasMoreElements()) {
313
	//		for (Iterator iter = manifestLocalizations.keySet().iterator(); iter.hasNext();) {
317
			String nextKey = (String) propertyKeys.nextElement();
314
	//			Locale locale = (Locale) iter.next();
318
			fragment.setProperty(nextKey, localizedStrings.getProperty(nextKey));
315
	//			Properties translatedStrings = (Properties) manifestLocalizations.get(locale);
319
		}
316
	//			Enumeration propertyKeys = translatedStrings.propertyNames();
320
		// TODO: do we need any capabilities?
317
	//			while (propertyKeys.hasMoreElements()) {
321
		// Create set of provided capabilities It's just a tag indicating a localization fragment.
318
	//				String nextKey = (String) propertyKeys.nextElement();
322
		ArrayList providedCapabilities = new ArrayList(1);
319
	//				fragment.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
323
		providedCapabilities.add(MANIFEST_LOCALIZATION_CAPABILITY);
320
	//			}
324
		fragment.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
321
	//			providedCapabilities.add(makeTranslationCapability(bd.getSymbolicName(), locale));
325
322
	//		}
326
		return MetadataFactory.createInstallableUnitFragment(fragment);
323
	//		fragment.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
327
	}
324
	//
328
325
	//		return MetadataFactory.createInstallableUnitFragment(fragment);
329
	public static void createHostLocalizationFragments(BundleDescription bd, String hostId, String[] hostBundleManifestValues, Set localizationIUs) {
326
	//	}
327
	public static void createHostLocalizationFragment(IInstallableUnit bundleIU, BundleDescription bd, String hostId, String[] hostBundleManifestValues, Set localizationIUs) {
330
		Map hostLocalizations = getHostLocalizations(new File(bd.getLocation()), hostBundleManifestValues);
328
		Map hostLocalizations = getHostLocalizations(new File(bd.getLocation()), hostBundleManifestValues);
331
		if (hostLocalizations != null) {
329
		if (hostLocalizations != null) {
332
			for (Iterator iter = hostLocalizations.keySet().iterator(); iter.hasNext();) {
330
			IInstallableUnitFragment localizationFragment = createLocalizationFragmentOfHost(bd, hostId, hostBundleManifestValues, hostLocalizations);
333
				Locale locale = (Locale) iter.next();
331
			localizationIUs.add(localizationFragment);
334
				Properties localizedStrings = (Properties) hostLocalizations.get(locale);
335
				IInstallableUnitFragment nextLocaleFragment = createLocalizationFragmentOfHost(hostId, hostBundleManifestValues, bd, locale, localizedStrings);
336
				localizationIUs.add(nextLocaleFragment);
337
			}
338
		}
332
		}
339
	}
333
	}
340
334
Lines 345-373 Link Here
345
	 * @param localizedStrings
339
	 * @param localizedStrings
346
	 * @return installableUnitFragment
340
	 * @return installableUnitFragment
347
	 */
341
	 */
348
	private static IInstallableUnitFragment createLocalizationFragmentOfHost(String hostId, String[] hostManifestValues, BundleDescription bd, Locale locale, Properties localizedStrings) {
342
	private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map hostLocalizations) {
349
		InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription();
343
		InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription();
350
		HostSpecification hostSpec = bd.getHost();
344
		String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName());
351
		String fragmentId = makeLocalizationFragmentId(hostId, locale);
352
		fragment.setId(fragmentId);
345
		fragment.setId(fragmentId);
353
		fragment.setVersion(bd.getVersion()); // TODO: is this a meaningful version?
346
		fragment.setVersion(bd.getVersion()); // TODO: is this a meaningful version?
354
347
355
		RequiredCapability[] hostReqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, hostSpec.getName(), hostSpec.getVersionRange(), null, false, false)};
348
		HostSpecification hostSpec = bd.getHost();
349
		RequiredCapability[] hostReqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), hostSpec.getVersionRange(), null, false, false, false)};
356
		fragment.setHost(hostReqs);
350
		fragment.setHost(hostReqs);
357
351
358
		fragment.setSingleton(true);
352
		fragment.setSingleton(true);
359
353
360
		for (int i = 0; i < BUNDLE_LOCALIZED_PROPERTIES.length; i++) {
354
		// Create a provided capability for each locale and add the translated properties.
361
			String nextKey = hostManifestValues[i];
355
		ArrayList providedCapabilities = new ArrayList(hostLocalizations.keySet().size());
362
			String localizedValue = null;
356
		for (Iterator iter = hostLocalizations.keySet().iterator(); iter.hasNext();) {
363
			if (nextKey != null && (localizedValue = localizedStrings.getProperty(nextKey)) != null) {
357
			Locale locale = (Locale) iter.next();
364
				fragment.setProperty(nextKey, localizedValue);
358
			Properties translatedStrings = (Properties) hostLocalizations.get(locale);
359
360
			Enumeration propertyKeys = translatedStrings.propertyNames();
361
			while (propertyKeys.hasMoreElements()) {
362
				String nextKey = (String) propertyKeys.nextElement();
363
				fragment.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey));
365
			}
364
			}
365
			providedCapabilities.add(makeTranslationCapability(hostId, locale));
366
		}
366
		}
367
		// TODO: do we need any capabilities? It's just a tag indicating a localization fragment.
368
		// Create set of provided capabilities
369
		ArrayList providedCapabilities = new ArrayList(1);
370
		providedCapabilities.add(MANIFEST_LOCALIZATION_CAPABILITY);
371
		fragment.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
367
		fragment.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()]));
372
368
373
		return MetadataFactory.createInstallableUnitFragment(fragment);
369
		return MetadataFactory.createInstallableUnitFragment(fragment);
Lines 375-388 Link Here
375
371
376
	/**
372
	/**
377
	 * @param id
373
	 * @param id
378
	 * @param locale
374
	 * @return the id for the iu fragment containing the localized properties
379
	 * @return the id for the fragment contain the localized properties
375
	 * 		   for the bundle with the given id
380
	 * 		   for the manifest of the bundle with the given id
376
	 */
381
	 * 		   in the given locale.
377
	//	private static String makeBundleLocalizationFragmentId(String id) {
378
	//		return id + ".translated_properties"; //$NON-NLS-1$
379
	//	}
380
	/**
381
	 * @param id
382
	 * @return the id for the iu fragment containing localized properties
383
	 * 		   for the fragment with the given id.
382
	 */
384
	 */
383
	private static String makeLocalizationFragmentId(String id, Locale locale) {
385
	private static String makeHostLocalizationFragmentId(String id) {
384
		String localeString = (!DEFAULT_LOCALE.equals(locale) ? '_' + locale.toString() : ""); //$NON-NLS-1$
386
		return id + ".translated_host_properties"; //$NON-NLS-1$
385
		return id + "_manifest" + localeString + "_properties"; //$NON-NLS-1$ //$NON-NLS-2$
387
	}
388
389
	private static ProvidedCapability makeTranslationCapability(String hostId, Locale locale) {
390
		return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), new Version(1, 0, 0));
386
	}
391
	}
387
392
388
	/**
393
	/**
Lines 531-560 Link Here
531
	}
536
	}
532
537
533
	public static IInstallableUnit[] createEclipseIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key, Properties extraProperties) {
538
	public static IInstallableUnit[] createEclipseIU(BundleDescription bd, Map manifest, boolean isFolderPlugin, IArtifactKey key, Properties extraProperties) {
534
		ArrayList iusCreated = new ArrayList(4);
539
		ArrayList iusCreated = new ArrayList(1);
535
540
536
		IInstallableUnit iu = createBundleIU(bd, manifest, isFolderPlugin, key);
541
		IInstallableUnit iu = createBundleIU(bd, manifest, isFolderPlugin, key);
537
		addExtraProperties(iu, extraProperties);
542
		addExtraProperties(iu, extraProperties);
538
		iusCreated.add(iu);
543
		iusCreated.add(iu);
539
544
540
		if (manifest != null) {
541
			String bundleLocalization = null;
542
			if (bd.getHost() == null) // not a fragment
543
				bundleLocalization = (String) manifest.get(Constants.BUNDLE_LOCALIZATION);
544
			if (bundleLocalization == null)
545
				bundleLocalization = DEFAULT_BUNDLE_LOCALIZATION;
546
547
			Map manifestLocalizations = getManifestLocalizations(manifest, new File(bd.getLocation()));
548
549
			if (manifestLocalizations != null) {
550
				List localizationFragments = createLocalizationFragmentsForBundle(bd, manifestLocalizations);
551
				for (Iterator iter = localizationFragments.iterator(); iter.hasNext();) {
552
					addExtraProperties((IInstallableUnit) iter.next(), extraProperties);
553
				}
554
				iusCreated.addAll(localizationFragments);
555
			}
556
		}
557
558
		return (IInstallableUnit[]) (iusCreated.toArray(new IInstallableUnit[iusCreated.size()]));
545
		return (IInstallableUnit[]) (iusCreated.toArray(new IInstallableUnit[iusCreated.size()]));
559
	}
546
	}
560
547
(-)src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java (-2 / +2 lines)
Lines 355-361 Link Here
355
							}
355
							}
356
						}
356
						}
357
357
358
						IInstallableUnit bundleIU = MetadataGeneratorHelper.createBundleIU(bd, bundleManifest, isDir, key, localizationIUs);
358
						IInstallableUnit bundleIU = MetadataGeneratorHelper.createBundleIU(bd, bundleManifest, isDir, key);
359
359
360
						if (isFragment(bd)) {
360
						if (isFragment(bd)) {
361
							// TODO: Can NL fragments be multi-host?  What special handling
361
							// TODO: Can NL fragments be multi-host?  What special handling
Lines 365-371 Link Here
365
							String[] cachedValues = (String[]) bundleLocalizationMap.get(hostKey);
365
							String[] cachedValues = (String[]) bundleLocalizationMap.get(hostKey);
366
366
367
							if (cachedValues != null) {
367
							if (cachedValues != null) {
368
								MetadataGeneratorHelper.createHostLocalizationFragments(bd, hostId, cachedValues, localizationIUs);
368
								MetadataGeneratorHelper.createHostLocalizationFragment(bundleIU, bd, hostId, cachedValues, localizationIUs);
369
							}
369
							}
370
						}
370
						}
371
371
(-)src/org/eclipse/equinox/internal/provisional/p2/ui/query/IUPropertyUtils.java (-5 / +11 lines)
Lines 20-25 Link Here
20
20
21
public class IUPropertyUtils {
21
public class IUPropertyUtils {
22
22
23
	static final Locale DEFAULT_LOCALE = new Locale("df", "LT"); //$NON-NLS-1$//$NON-NLS-2$
24
23
	public static String getIUProperty(IInstallableUnit iu, String propertyKey, Locale locale) {
25
	public static String getIUProperty(IInstallableUnit iu, String propertyKey, Locale locale) {
24
		String value = iu.getProperty(propertyKey);
26
		String value = iu.getProperty(propertyKey);
25
		if (value == null || value.length() <= 1 || value.charAt(0) != '%')
27
		if (value == null || value.length() <= 1 || value.charAt(0) != '%')
Lines 43-53 Link Here
43
			}
45
			}
44
		}
46
		}
45
47
48
		String defaultKey = DEFAULT_LOCALE.toString() + '.' + actualKey;
49
		String defaultValue = iu.getProperty(defaultKey);
50
		if (defaultValue != null)
51
			return defaultValue;
52
46
		return value;
53
		return value;
47
	}
54
	}
48
55
49
	private static final String MANIFEST_NAME = "_manifest"; //$NON-NLS-1$
56
	private static final String TRANSLATED_PROPERTIES_NAME = "_translated_properties"; //$NON-NLS-1$
50
	private static final String PROPERTIES_NAME = "_properties"; //$NON-NLS-1$
51
57
52
	/**
58
	/**
53
	 */
59
	 */
Lines 57-70 Link Here
57
		ArrayList result = new ArrayList(4);
63
		ArrayList result = new ArrayList(4);
58
		int lastSeparator;
64
		int lastSeparator;
59
		while (true) {
65
		while (true) {
60
			result.add(id + MANIFEST_NAME + '_' + nl + PROPERTIES_NAME);
66
			result.add(id + '_' + nl + TRANSLATED_PROPERTIES_NAME);
61
			lastSeparator = nl.lastIndexOf('_');
67
			lastSeparator = nl.lastIndexOf('_');
62
			if (lastSeparator == -1)
68
			if (lastSeparator == -1)
63
				break;
69
				break;
64
			nl = nl.substring(0, lastSeparator);
70
			nl = nl.substring(0, lastSeparator);
65
		}
71
		}
66
		//add the empty suffix last (most general)
72
		// Add the empty suffix last (most general)
67
		result.add(id + MANIFEST_NAME + PROPERTIES_NAME);
73
		result.add(id + TRANSLATED_PROPERTIES_NAME);
68
		return (String[]) result.toArray(new String[result.size()]);
74
		return (String[]) result.toArray(new String[result.size()]);
69
	}
75
	}
70
76

Return to bug 222309