Bug 208741 - NLS of WorkspacePluginModelBase only works if resource is called plugin.properties
Summary: NLS of WorkspacePluginModelBase only works if resource is called plugin.prope...
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2007-11-05 04:55 EST by Les Jones CLA
Modified: 2007-12-11 12:16 EST (History)
2 users (show)

See Also:


Attachments
org.eclipse.pde.core.patch (1.97 KB, patch)
2007-12-05 09:46 EST, Chris Aniszczyk CLA
no flags Details | Diff
mylyn/context/zip (862 bytes, application/octet-stream)
2007-12-05 09:46 EST, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Les Jones CLA 2007-11-05 04:55:25 EST
Build ID: I20071101-2000

Steps To Reproduce:
N/A


More information:
This problem exists in org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase. Specifically, see the createNLResourceHelper() method - it has the name of the localization resource hardcoded as "plugin". This is incorrect since the name of the resource is driven from the "Bundle-Localization" manifest header.

-----------------------------------------------------------------------------
protected NLResourceHelper createNLResourceHelper() {
    return new NLResourceHelper("plugin" , PDEManager.getNLLookupLocations(this)); //$NON-NLS-1$
}
-----------------------------------------------------------------------------

Compare this with other implementations of this method, for example createNLResourceHelper() in org.eclipse.pde.internal.core.bundle.BundlePluginModelBase:
-----------------------------------------------------------------------------
protected NLResourceHelper createNLResourceHelper() {
    String localization = getBundleLocalization();
    return localization == null
                         ? null
                         : new NLResourceHelper(localization, PDEManager.getNLLookupLocations(this)); 
}
-----------------------------------------------------------------------------
Comment 1 Les Jones CLA 2007-11-05 07:29:05 EST
Perhaps, just to clarify a little further - consider the scenario of creating a new plug-in project using a template. 

If the version of the plug-in project is 3.0, the model is an instance of org.eclipse.pde.internal.core.plugin.WorkspacePluginModel. In this case, the hardcoded value of "plugin" probably isn't so much of a problem.

If the version of the plug-in project is 3.3, the model is an instance of org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel. In this case, the  hardcoded value is wrong and the value should be obtained via the manifest.

Therefore, perhaps the error isn't so much with the fact that WorkspacePluginModelBase has the value hardcoded, more with the fact that it's defined too high up the inheritance tree and the bundle versions of the model haven't overridden createNLResourceHelper() appropriately.
Comment 2 Brian Bauman CLA 2007-11-09 11:17:43 EST
Les, thanks for your fine tooth review of PDE.  We appreciate you spending the time to find potential programming problems.

I think this should be a relatively easy fix, do you want to put another notch in your belt?
Comment 3 Les Jones CLA 2007-11-09 11:29:15 EST
Not problems picking it up; but it won't be for a week or so - off on vacation. Should be easy to solve so pleased you've marked it as a bugday candidate, in case someone stumbles across it in the next week or so and wants to give it a go.

Additionally, although not a dependency as such, this will be easier to test 
with the template scenario I've given once bug 185477 is applied.
Comment 4 Brian Bauman CLA 2007-11-09 11:46:48 EST
I hope you enjoy your vacation!  I have been trying to take mine here and there which is why we haven't gotten through our backlog of patches yet.  I will go ahead and look at bug 185477 and hopefully have it all committed by the time you get back.
Comment 5 Chris Aniszczyk CLA 2007-11-30 06:09:10 EST
patch :P?
Comment 6 Chris Aniszczyk CLA 2007-12-03 17:25:55 EST
Hey Brian, I think this is INVALID since WorkspacePluginModelBase is for 3.0 era plug-ins. Correct?
Comment 7 Les Jones CLA 2007-12-04 02:35:20 EST
Chris,

See comment 1 - specifically "If the version of the plug-in project is 3.3, the model is an instance of org.eclipse.pde.internal.core.bundle.WorkspaceBundlePluginModel. In this case,
the  hardcoded value is wrong and the value should be obtained via the
manifest.

Therefore, perhaps the error isn't so much with the fact that
WorkspacePluginModelBase has the value hardcoded, more with the fact that it's
defined too high up the inheritance tree and the bundle versions of the model
haven't overridden createNLResourceHelper() appropriately."
Comment 8 Brian Bauman CLA 2007-12-04 16:18:10 EST
> Therefore, perhaps the error isn't so much with the fact that
> WorkspacePluginModelBase has the value hardcoded, more with the fact that it's
> defined too high up the inheritance tree and the bundle versions of the model
> haven't overridden createNLResourceHelper() appropriately."

Les, you are right, this is the issue exactly.

Chris is right on saying WorkspacePluginModelBase is used for representing 3.0 plug-ins.  Our models make sense once you understand the way they are set up, but are a little confusing if you aren't familiar with them :)
Comment 9 Chris Aniszczyk CLA 2007-12-05 09:45:37 EST
Ok, I get it now :)
Comment 10 Chris Aniszczyk CLA 2007-12-05 09:46:26 EST
Created attachment 84534 [details]
org.eclipse.pde.core.patch

This makes WorkspaceBundlePluginModelBase properly implement the nls helper method.
Comment 11 Chris Aniszczyk CLA 2007-12-05 09:46:31 EST
Created attachment 84535 [details]
mylyn/context/zip
Comment 12 Chris Aniszczyk CLA 2007-12-05 09:46:44 EST
Fixed in HEAD.
Comment 13 Brian Bauman CLA 2007-12-11 12:16:11 EST
verified on I20071211-0010