Architecture Review Opinion

Issue: 35573
Submitter: Miloslav Metelka
Date: 2005/07/26
Reviewers: Jan Lahoda, Petr Pisl, Jaroslav Tulach, Dusan Balek

Contents

Summary

The Code Templates provide an infrastructure for pasting parameterized code snippets into the editor. On pasting a code template, all its parameters are assigned with default values and the editor switches to a special state in which all changes made to a parameter value are automatically replicated across all the parameter's occurrences.

Decision

Accepted with change requests.

It was decided that the final review is needed before committing the API into the trunk. The TCR has to be resolved before the final review.

Opinion

The following issues were discussed at the inception review:

Parameters' default values computation.

CodeTemplateProcessors should be enhanced with a possibility to listen to a user changes to the values of a template parameters and recompute parameters' defaults if necessary. The usecase is e.g. a "for each loop" template: for (${TYPE} ${ELEMENT} : ${ITERABLE}) Value of the "TYPE" parameter should be recomputed every time a user changes value of the "ITERABLE" parameter.

Enhancing the API with a support for creating temporary templates.

Since there is a usecase form the code completion (and possibly editor hints), a factory method for temporary templates creation should be added to the CodeTemplateManager.

Exposing the CodeTemplateDescription's constructor public in the SPI.

Since there is no usecase for it, it was concluded, that the CodeTemplateDescription's constructor should not be public in the SPI. This is a TCR (#61495).

Storing/reading code templates.

The new options infrastructure will be used to store/read both the pre-defined and user-defined code templates.

Code Templates' relation to the Palette.

It was decided that a support for adding code templates to the palette should be provided. This is a TCA (#61499).

Code Templates' relation to the Code Snippets.

Since the Code Snippets do not plan to use the Code Templates infrastructure, it was decided that a possibility to show e.g. a dialog during a template insertion processing in a CodeTemplateProcessor should not be advertised. However, it was decided to go with the current state and call the CodeTemplateProcessors synchronously from the AWT with a possibility to block the AWT while computing parameters' default values.

Minority Opinion

None.

Advisory Information

See above.

Appendices

Appendix A: Technical Changes Required

#61495: Do not expose the CodeTemplateDescription's constructor public in the Code Templates SPI.

Appendix B: Technical Changes Advised

#61499: Consider providing a support for adding code templates to the palette.

Appendix C: Reference Material

Attached to issue #35573

Project Features

About this Project

openide was started in November 2009, is owned by Antonin Nebuzelsky, and has 78 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close