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.

Bug 270167 - Support to hook in / decorate file creation
Summary: Support to hook in / decorate file creation
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Templates (show other bugs)
Version: Dev
Hardware: PC Linux
: P1 normal (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks: 270179
  Show dependency tree
 
Reported: 2017-03-22 13:10 UTC by Svata Dedic
Modified: 2017-04-02 02:36 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed changes (34.62 KB, patch)
2017-03-22 13:16 UTC, Svata Dedic
Details | Diff
Additional change - library usages (14.89 KB, patch)
2017-03-24 10:54 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2017-03-22 13:10:13 UTC
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.
Comment 1 Svata Dedic 2017-03-22 13:16:28 UTC
Created attachment 163917 [details]
Proposed changes

Proposed changes to file.templates. Implementation of java decorator is provided as example SPI client.
Comment 2 Svata Dedic 2017-03-24 10:54:31 UTC
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.
Comment 3 Svata Dedic 2017-03-24 10:55:18 UTC
Oops ;) wrong defect. Disregard comment #2 and the attachment ;)
Comment 4 Svata Dedic 2017-03-29 09:35:06 UTC
No response so far; if no objections raised, I'll push the changes.
Comment 5 Svata Dedic 2017-03-31 10:36:00 UTC
Committe as jet-main#9cf0562984a8
Comment 6 Quality Engineering 2017-04-02 02:36:25 UTC
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