Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 127278

Summary: Convert plugins to Eclipse 3.1 message bundle format
Product: z_Archived Reporter: Valentina Popescu <popescu>
Component: TPTPAssignee: Christophe Telep <christophe.telep>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 127273    

Description Valentina Popescu CLA 2006-02-10 11:03:22 EST
This defect is opened to deal with all Trace plugins; please open point defects if required for the Trace project plugin owners

The defect that groups together all defects on this subject is 127273

Standard Java ResourceBundles have quite inefficient space characteristics.
Since a running Eclipse tends to have many externalized messages, the eclipse
team has implemented a new message bundle to be used starting with Eclipse 3.1.

For more information go to
http://dev.eclipse.org/viewcvs/index.cgi/platform-core-home/documents/3.1/message_bundles.html?rev=1.9

Note that Eclipse provides an automated tool that generates the new message
bundle from the existing one. The steps are defined in the above page link,
under the Tools Conversion section.

These are the steps for moving to the new bundle ( the conversion tool would
cover steps 1-3 ):

1.Identify the strings in plugin.properties that are not used in the plugin.xml
file

2. Create one or more message.properties files per plugin, to store these
strings

3. For each message.properties file, you should define a peer Message java
class that will be used to retrieve the string

4. Optionally- but a great improvement if this is done- update the string key
to a short string
Example:

Old key:
LOG_COMPONENT_IDENTIFICATION_INVALID_LOCATION_TYPE_EXC_ = IWAT0212E The
component identification with component named [{0}] has an invalid location
type: [{1}] 
New key:
_1 = IWAT0212E The component identification with component named [{0}] has an
invalid location type: [{1}]

Code sample:

package org.eclipse.hyades.logging.adapter.ui.internal.util;
import org.eclipse.osgi.util.NLS;

public final class AdapterUIMessages extends NLS {

 private static final String BUNDLE_NAME =
"org.eclipse.hyades.logging.adapter.ui.internal.util.messages";//$NON-NLS-1$

 private UIMessages() {
  // Do not instantiate
 }

 public static String _1;
 public static String _2;

 static {
  NLS.initializeMessages(BUNDLE_NAME, UIMessages.class);
 }
}

messages.properties:
_1   = &Timezone GMT offset:
_2   = &Log file creation date for file {0}:


Old code:
public class MyClass {
   public void myMethod() {
      String message;
      ...
Comment 1 Christophe Telep CLA 2006-02-20 11:08:17 EST
Already fixed in 4.1 by Valentina
Comment 2 Christophe Telep CLA 2006-02-20 11:10:07 EST
Closing