Translate Import Options in NetBeans - Proposal

This is a proposal document about implementation of the feature of translating of user's settings/options in NetBeans during the first import.



There was an issue when css MIME type was changed Issue 218976. All settings attached to MIME type were lost after importing settings from previous release.

Current state

At the time there is no support for such a behaviour. The user should manually locate the affected folders in his userdir and rename the folder.


The owner of a module that needs to change the folder where the settings are to be copied should register it into the module's layer.

Implementation details

To support suggested solution we need some implementation background. The idea is to register patterns for translation into module's layer. This solution is necessary because of so called ergonomics IDE. On the first start only minimal subset of modules is enabled. So, we would not be able to collect import patterns from all modules. But we can prepare list of all patterns at the build time. Then the upgrader module can use this list and translate settings while importing them before IDE starts.

Module developers will make a registration in module's layer. Translation occurs according to given patterns. Patterns are relative to userdir root.

<folder name="OptionsExport">
    <!-- category -->
    <folder name="Arbitrary">
        <!-- category display name -->
        <attr name="displayName" bundlevalue="org.netbeans.modules.arbitrary.options.Bundle#Category_Display_Name"/>
        <!-- item -->
        <file name="arbOpt">
            <attr name="translate" stringvalue="config/Editors/text/x-css=>config/Editors/text/css"/>
            <attr name="displayName" bundlevalue="org.netbeans.modules.arbitrary.options.Bundle#Export_Display_Name"/>
By using this token

, more translations can be registered at once like this

<folder name="OptionsExport">
  <attr name="translate" stringvalue="config/Editors/text/x-css=>config/Editors/text/css|config/Editors/text/x-css2=>config/Editors/text/css2"/>

Use cases

1) Import Options after new installation

  • on the first start, before the Main window is up, detect previous userdir in ${home}/.netbeans
  • dialog asking whether to import options is opened
  • if confirmed, all files from previous userdir, which match list of all modules patterns, are copied from previous userdir to the current one while translation occurs where appropriate.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo