Bug 184095

Summary: [api][breaking] Replace String systemTypeName by IRSESystemType everywhere
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: RSEAssignee: Martin Oberhuber <mober.at+eclipse>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: enhancement    
Priority: P2 Keywords: api
Version: 1.0.1   
Target Milestone: 2.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 175262, 177128, 180688, 180690, 185750, 185752    
Bug Blocks: 170922    

Description Martin Oberhuber CLA 2007-04-25 15:28:01 EDT
The old systemType Name String, which is used a lot in RSE, is problematic because it is not translatable and awkward checking for properties.

It should be replaced by passing around real IRSESystemType instances everywhere instead. This allows showing getLabel() where needed, accessing getId() for a String instance, getProperty() for specific properties of getName() for backward compatibility.
Comment 1 Martin Oberhuber CLA 2007-04-25 16:36:16 EDT
Work completed, 104 files were affected:

[184095][api] Replace String systemTypeName by IRSESystemType everywhere.
- Migrate to using system type labels in all UI, and system type IDs when 
  storing Preferences.
- Combine NLS messages in rse.core.
- Add some API to SystemWidgetHelpers for dealing with system types.
- Update and beautify Javadoc.

Migration docs for Extenders:
-----------------------------

* All methods that used to deal with String systemTypeName, now deal with
  IRSESystemType instead. Where both variants existed, obsolete methods
  that dealt with the name only have been removed (e.g. in ISystemRegistry). 

* In order to get an IRSESystemType when needed, use
    RSECorePlugin.getDefault().getRegistry().getSystemTypeById("yourId");
  for well-known standard IDs, use
    IRSESystemType.SYSTEMTYPE_LOCAL_ID and similar.

* Using a listbox or combo of system types is a little bit more difficult
  when dealing with translated labels. In order to use the widgets associated
  with system types, an index needs to be used with those widgets. In order
  to make using this easier, some new API has been added to 
  SystemWidgetHelpers:
  
  IRSESystemType[] getValidSystemTypes(String[] restrictIds)
    Returns system types that are properly configured, restricted to a list
    of IDs if requested. The list is returned sorted by Label.

  void sortSystemTypesByLabel(IRSESystemType[] types)
    Sorts a list of system types ascending by label. May use an ICU4J collate
    algorithm for sorting translated names correctly in the future. Note that
    it sorts the array in place, so clients are responsible for creating a 
    copy of the array when needed.

  String[] getSystemTypeLabels(IRSESystemType[] types)
    Returns a list of labels for a list of system types.

* Preferences now store information that is indexed by system types, with
  the system type ID as index instead of the name. This allows translating
  system type names, but makes old Preferences unusable. Workspaces can not
  be migrated. Connection data, however, is still using the systemType name.
  This may be changed.

* All code that displays system type names should now use 
    IRSESystemType.getLabel()
  in order to display the translated name.

Going forward, all code that still refers to deprecated IRSESystemType#getName() should be changed to use an ID, Label or Properties of the system type instead.
Comment 2 Martin Oberhuber CLA 2007-04-25 16:40:25 EDT
Work completed.
Comment 3 Martin Oberhuber CLA 2008-08-13 13:18:28 EDT
[target cleanup] 2.0 M7 was the original target milestone for this bug