This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The current templating support allows to plug in a Create handler which takes over the file materialization from template, but does not allow to attach additional processing from participating modules. The proposed API change allows to attach decorators which can intercept file creation and perform pre- and post- creation tasks. Java support will attach decorator, which, in addition to creating a Java class, will declare required module dependncies based on the template source.
Created attachment 163917 [details] Proposed changes Proposed changes to file.templates. Implementation of java decorator is provided as example SPI client.
Created attachment 163931 [details] Additional change - library usages I've decided to extend this proposal: during followup work, a missing feature was discovered. Remove operation would happily remove a library from project, based on request to remove it from a specific part (e.g. module A) when other parts (e.g. module B, C) still use the library. The additional patch introduce "usage finder" into SPI and changes the API implementation so that it does not remove the shared entries. Please review.
Oops ;) wrong defect. Disregard comment #2 and the attachment ;)
No response so far; if no objections raised, I'll push the changes.
Committe as jet-main#9cf0562984a8
Integrated into 'main-silver', will be available in build *201704020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/9cf0562984a8 User: Svata Dedic <sdedic@netbeans.org> Log: #270167: template decorator API added