Bug 224370 - Support for hooking into the import process
Support for hooking into the import process
Status: RESOLVED FIXED
Product: ide
Classification: Unclassified
Component: Import Settings
7.3
All All
: P1 (vote)
: 7.4
Assigned To: Theofanis Oikonomou
issues@platform
http://wiki.netbeans.org/TranslateImp...
: API, API_REVIEW_FAST, PLAN
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-02 09:26 UTC by Marek Fukala
Modified: 2013-02-14 02:20 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
a patch (5.42 KB, patch)
2013-01-22 14:17 UTC, Theofanis Oikonomou
Details | Diff
a patch (11.60 KB, patch)
2013-02-12 16:03 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2013-01-02 09:26:39 UTC
It would be useful if it was possible to plug-in some custom code which would be able to adjust/process the settings import.

For more information please read issue 218976#c7 which is about renaming some folders during the import.

As for the concrete issue it would be enough to extend the syntax of the imports file so you could add a rule like:

config/Editors/text/x-css=>config/Editors/text/css
Comment 1 Theofanis Oikonomou 2013-01-22 14:17:39 UTC
Created attachment 130488 [details]
a patch

Created a patch that introduces a new way to hook into the import process to rename some folders. It shows how the new "translate" attribute can be used. Something like: 

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

would be enough. Of course you can register more translations at once by using the "|" operator 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"/>
</folder>

I am not sure if this is a common case though. Any first comments before I move this to api review? Thank you
Comment 2 Theofanis Oikonomou 2013-02-05 16:20:25 UTC
Created a wiki page with more info. The patch introduces a new way to hook into the import process to rename some folders. It shows how the new "translate" attribute can be used. Please review. Thank you
Comment 3 Marek Fukala 2013-02-06 11:41:06 UTC
The proposal looks good to me. I assume that if the source file/folder doesn't exist the process will just ignore it silently. This is required as the rename process is not bound to any particular ide version.
Comment 4 Theofanis Oikonomou 2013-02-06 12:50:41 UTC
(In reply to comment #3)
> The proposal looks good to me. I assume that if the source file/folder doesn't
> exist the process will just ignore it silently. This is required as the rename
> process is not bound to any particular ide version.

Thank you for the comments. Currently every file in the userdir is copied or not if it matches the import/export patterns. 

After the patch gets integrated, if a user tries to import settings from older version into dev build or next final release the translation will happen. I am not sure if that is what you meant though.
Comment 5 Marek Fukala 2013-02-06 14:26:05 UTC
The point was that since the translation doesn't specify what IDE version it is meant to import from then it can happen that the source file specified in the translation simply won't exist. In such case the "rule" simply need to do nothing.
Comment 6 Theofanis Oikonomou 2013-02-07 10:32:33 UTC
(In reply to comment #5)
> The point was that since the translation doesn't specify what IDE version it is
> meant to import from then it can happen that the source file specified in the
> translation simply won't exist. In such case the "rule" simply need to do
> nothing.

I think that this is how it is implemented in the CopyFiles file. Thanks
Comment 7 Theofanis Oikonomou 2013-02-11 11:29:59 UTC
If there are no objections, I plan to integrate the change tomorrow. Thank you
Comment 8 Jaroslav Tulach 2013-02-11 19:33:23 UTC
Y01 No test.
Y02 The new 'translate' attribute should be documented in o.n.upgrader/arch.xml
Comment 9 Theofanis Oikonomou 2013-02-12 16:03:55 UTC
Created attachment 131303 [details]
a patch

Updated the patch based on comments Y01 and Y02. Planning to integrate tomorrow. Thank you
Comment 10 Theofanis Oikonomou 2013-02-13 11:13:01 UTC
Changeset: f11aa5279062
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2013-02-13 12:09
Message:   
Issue #224370 - Support for hooking into the import process
Comment 11 Quality Engineering 2013-02-14 02:20:09 UTC
Integrated into 'main-golden', will be available in build *201302132300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f11aa5279062
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #224370 - Support for hooking into the import process


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