Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 102779 Details for
Bug 234154
Names in .properties files are not used for site categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Updated patch v02
patch.txt (text/plain), 12.33 KB, created by
John Arthorne
on 2008-05-29 19:09:25 EDT
(
hide
)
Description:
Updated patch v02
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2008-05-29 19:09:25 EDT
Size:
12.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.metadata.generator >Index: src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteModel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteModel.java,v >retrieving revision 1.10 >diff -u -r1.10 SiteModel.java >--- src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteModel.java 24 Apr 2008 20:13:03 -0000 1.10 >+++ src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteModel.java 29 May 2008 23:07:48 -0000 >@@ -40,6 +40,8 @@ > private String type; > private URLEntry[] associateSites; > private String digestURLString; >+ private List messageKeys; >+ private Map localizations; > > /** > * Creates an uninitialized site model object. >@@ -72,8 +74,11 @@ > public void addCategory(SiteCategory category) { > if (categories == null) > categories = new HashMap(); >- if (!categories.containsKey(category.getName())) >+ if (!categories.containsKey(category.getName())) { > categories.put(category.getName(), category); >+ if (localizations != null && !localizations.isEmpty()) >+ category.setLocalizations(localizations); >+ } > } > > /** >@@ -167,6 +172,17 @@ > } > > /** >+ * Gets the localizations for the site as a map from locale >+ * to the set of translated properties for that locale. >+ * >+ * @return a map from locale to property set >+ * @since 3.4 >+ */ >+ public Map getLocalizations() { >+ return this.localizations; >+ } >+ >+ /** > * Returns the resolved URL for the site. > * > * @return url, or <code>null</code> >@@ -192,6 +208,16 @@ > } > > /** >+ * Return the keys for translatable strings >+ * >+ * @return the list of keys for translatable strings; may be null >+ * @since 3.4 >+ */ >+ public List getMessageKeys() { >+ return messageKeys; >+ } >+ >+ /** > * Return an array of update site mirrors > * > * @return an array of mirror entries, or an empty array. >@@ -278,6 +304,25 @@ > } > > /** >+ * Sets the localizations for the site as a map from locale >+ * to the set of translated properties for that locale. >+ * >+ * @param localizations as a map from locale to property set >+ * @since 3.4 >+ */ >+ public void setLocalizations(Map localizations) { >+ this.localizations = localizations; >+ if (localizations != null && !localizations.isEmpty() && // >+ categories != null && !categories.isEmpty()) { >+ for (Iterator catIter = categories.entrySet().iterator(); catIter.hasNext();) { >+ Map.Entry entry = (Map.Entry) catIter.next(); >+ SiteCategory category = (SiteCategory) entry.getValue(); >+ category.setLocalizations(localizations); >+ } >+ } >+ } >+ >+ /** > * Sets the unresolved URL for the site. > * > * @param locationURLString url for the site (as a string) >@@ -288,6 +333,16 @@ > } > > /** >+ * Sets keys for translatable strings >+ * >+ * @param keys for translatable strings >+ * @since 3.4 >+ */ >+ public void setMessageKeys(List keys) { >+ this.messageKeys = keys; >+ } >+ >+ /** > * Sets additional mirror sites > * > * @param mirrors additional update site mirrors >Index: src/org/eclipse/equinox/internal/p2/metadata/generator/features/DefaultSiteParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/DefaultSiteParser.java,v >retrieving revision 1.8 >diff -u -r1.8 DefaultSiteParser.java >--- src/org/eclipse/equinox/internal/p2/metadata/generator/features/DefaultSiteParser.java 21 Apr 2008 18:32:58 -0000 1.8 >+++ src/org/eclipse/equinox/internal/p2/metadata/generator/features/DefaultSiteParser.java 29 May 2008 23:07:48 -0000 >@@ -66,6 +66,9 @@ > // Current State Information > Stack stateStack = new Stack(); > >+ // List of string keys for translated strings >+ private final List messageKeys = new ArrayList(4); >+ > private MultiStatus status; > > /* >@@ -548,7 +551,9 @@ > if (objectStack.isEmpty()) > throw new SAXException(Messages.DefaultSiteParser_NoSiteTag); > if (objectStack.peek() instanceof SiteModel) { >- return (SiteModel) objectStack.pop(); >+ SiteModel site = (SiteModel) objectStack.pop(); >+ site.setMessageKeys(messageKeys); >+ return site; > } > String stack = ""; //$NON-NLS-1$ > Iterator iter = objectStack.iterator(); >@@ -603,6 +608,7 @@ > SiteCategory category = new SiteCategory(); > String name = attributes.getValue("name"); //$NON-NLS-1$ > String label = attributes.getValue("label"); //$NON-NLS-1$ >+ checkTranslated(label); > category.setName(name); > category.setLabel(label); > >@@ -658,6 +664,7 @@ > if (label != null) { > if ("".equals(label.trim())) //$NON-NLS-1$ > label = null; >+ checkTranslated(label); > } > feature.setLabel(label); > >@@ -753,7 +760,7 @@ > site.setSupportsPack200(true); > } > >- String digestURL = attributes.getValue("digestURL"); >+ String digestURL = attributes.getValue("digestURL"); //$NON-NLS-1$ > if (digestURL != null) > site.setDigestURLString(digestURL); > >@@ -844,4 +851,10 @@ > return Character.isWhitespace(str.charAt(str.length() - 1)); > } > >+ // Add translatable strings from the site.xml >+ // to the list of message keys. >+ private void checkTranslated(String value) { >+ if (value != null && value.length() > 1 && value.startsWith("%")) //$NON-NLS-1$ >+ messageKeys.add(value.substring(1)); >+ } > } >Index: src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteCategory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteCategory.java,v >retrieving revision 1.3 >diff -u -r1.3 SiteCategory.java >--- src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteCategory.java 4 Jan 2008 20:00:10 -0000 1.3 >+++ src/org/eclipse/equinox/internal/p2/metadata/generator/features/SiteCategory.java 29 May 2008 23:07:48 -0000 >@@ -13,6 +13,7 @@ > import java.net.MalformedURLException; > import java.net.URL; > import java.util.Comparator; >+import java.util.Map; > > /** > * A category in an update site. >@@ -25,6 +26,7 @@ > private String description; > private String label; > private String name; >+ private Map localizations; > > /** > * Returns a comparator for category models. >@@ -100,6 +102,17 @@ > } > > /** >+ * Gets the localizations for the site as a map from locale >+ * to the set of translated properties for that locale. >+ * >+ * @return a map from locale to property set >+ * @since 3.4 >+ */ >+ public Map getLocalizations() { >+ return this.localizations; >+ } >+ >+ /** > * Retrieve the name of the category. > * > * @return category name, or <code>null</code>. >@@ -162,6 +175,17 @@ > } > > /** >+ * Sets the localizations for the site as a map from locale >+ * to the set of translated properties for that locale. >+ * >+ * @param localizations as a map from locale to property set >+ * @since 3.4 >+ */ >+ public void setLocalizations(Map localizations) { >+ this.localizations = localizations; >+ } >+ >+ /** > * Sets the category name. > * Throws a runtime exception if this object is marked read-only. > * >Index: src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java,v >retrieving revision 1.58 >diff -u -r1.58 Generator.java >--- src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java 29 May 2008 21:54:26 -0000 1.58 >+++ src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java 29 May 2008 23:07:48 -0000 >@@ -106,6 +106,8 @@ > > static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$ > >+ private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$ >+ > protected final IGeneratorInfo info; > > private GeneratorResult incrementalResult = null; >@@ -1152,6 +1154,22 @@ > for (int i = 0; i < associatedSites.length; i++) > generateSiteReference(associatedSites[i].getURL(), null, true); > >+ if (PROTOCOL_FILE.equals(siteLocation.getProtocol())) { >+ File siteFile = new File(siteLocation.getFile()); >+ if (siteFile.exists()) { >+ File siteParent = siteFile.getParentFile(); >+ >+ List messageKeys = site.getMessageKeys(); >+ if (siteParent.isDirectory()) { >+ String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]); >+ site.setLocalizations(LocalizationHelper.getDirPropertyLocalizations(siteParent, "site", null, keyStrings)); //$NON-NLS-1$ >+ } else if (siteFile.getName().endsWith(".jar")) { //$NON-NLS-1$ >+ String[] keyStrings = (String[]) messageKeys.toArray(new String[messageKeys.size()]); >+ site.setLocalizations(LocalizationHelper.getJarPropertyLocalizations(siteParent, "feature", null, keyStrings)); //$NON-NLS-1$ >+ } >+ } >+ } >+ > SiteFeature[] features = site.getFeatures(); > for (int i = 0; i < features.length; i++) { > //add a mapping for each category this feature belongs to >Index: src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java,v >retrieving revision 1.51 >diff -u -r1.51 MetadataGeneratorHelper.java >--- src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java 29 May 2008 15:49:28 -0000 1.51 >+++ src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/MetadataGeneratorHelper.java 29 May 2008 23:07:48 -0000 >@@ -404,7 +404,8 @@ > public static IInstallableUnit createCategoryIU(SiteCategory category, Set featureIUs, IInstallableUnit parentCategory) { > InstallableUnitDescription cat = new MetadataFactory.InstallableUnitDescription(); > cat.setSingleton(true); >- cat.setId(category.getName()); >+ String categoryId = category.getName(); >+ cat.setId(categoryId); > cat.setVersion(Version.emptyVersion); > cat.setProperty(IInstallableUnit.PROP_NAME, category.getLabel()); > cat.setProperty(IInstallableUnit.PROP_DESCRIPTION, category.getDescription()); >@@ -420,7 +421,27 @@ > reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, parentCategory.getId(), VersionRange.emptyRange, parentCategory.getFilter(), false, false)); > } > cat.setRequiredCapabilities((RequiredCapability[]) reqsConfigurationUnits.toArray(new RequiredCapability[reqsConfigurationUnits.size()])); >- cat.setCapabilities(new ProvidedCapability[] {MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, category.getName(), Version.emptyVersion)}); >+ >+ // Create set of provided capabilities >+ ArrayList providedCapabilities = new ArrayList(); >+ providedCapabilities.add(createSelfCapability(categoryId, Version.emptyVersion)); >+ >+ Map localizations = category.getLocalizations(); >+ if (localizations != null) { >+ for (Iterator iter = localizations.keySet().iterator(); iter.hasNext();) { >+ Locale locale = (Locale) iter.next(); >+ Properties translatedStrings = (Properties) localizations.get(locale); >+ Enumeration propertyKeys = translatedStrings.propertyNames(); >+ while (propertyKeys.hasMoreElements()) { >+ String nextKey = (String) propertyKeys.nextElement(); >+ cat.setProperty(locale.toString() + '.' + nextKey, translatedStrings.getProperty(nextKey)); >+ } >+ providedCapabilities.add(makeTranslationCapability(categoryId, locale)); >+ } >+ } >+ >+ cat.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); >+ > cat.setArtifacts(new IArtifactKey[0]); > cat.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, "true"); //$NON-NLS-1$ > return MetadataFactory.createInstallableUnit(cat);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 234154
:
102161
|
102763
|
102778
|
102779
|
102793