| <!doctype html> | 
 | <html class="no-js" lang="en" dir="ltr"> | 
 |     <head> | 
 |     <meta charset="utf-8"> | 
 |     <meta http-equiv="x-ua-compatible" content="ie=edge"> | 
 |     <title>Code Generator Integration Tutorial</title> | 
 |     <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 
 |     <meta name="description" content="Code Generator Integration Tutorial - Apache NetBeans"> | 
 |     <meta name="author" content="Apache NetBeans"> | 
 |     <meta name="description" content="Code Generator Integration Tutorial - Apache NetBeans"> | 
 |     <meta name="keywords" content="Apache NetBeans Platform, Platform Tutorials, Code Generator Integration Tutorial"> | 
 |     <meta name="generator" content="Apache NetBeans"> | 
 |     <link rel="stylesheet" href="../../../../_/css/font-awesome.min.css"> | 
 |     <link rel="alternate" type="application/atom+xml" title="Apache NetBeans Blog" href="https://netbeans.apache.org/blogs/atom" /> | 
 |     <link rel="stylesheet" href="../../../../_/css/highlightjs/default.min.css"> | 
 |     <link rel="stylesheet" href="../../../../_/css/netbeans.css"> | 
 |     <link rel="apple-touch-icon" sizes="180x180" href="../../../../_/images/fav/apple-touch-icon.png"> | 
 |     <link rel="icon" type="image/png" sizes="32x32" href="../../../../_/images/fav/favicon-32x32.png"> | 
 |     <link rel="icon" type="image/png" sizes="16x16" href="../../../../_/images/fav/favicon-16x16.png"> | 
 |     <link rel="manifest" href="../../../../_/images/fav/site.webmanifest"> | 
 |     <link rel="mask-icon" href="../../../../_/images/fav/safari-pinned-tab.svg" color="#5bbad5"> | 
 |     <meta name="msapplication-TileColor" content="#ffc40d"> | 
 |     <meta name="theme-color" content="#ffffff"> | 
 |     <link href="../../../../_/css/font-open-sans.css" rel="stylesheet"> | 
 |     <!-- | 
 |         Licensed to the Apache Software Foundation (ASF) under one | 
 |         or more contributor license agreements.  See the NOTICE file | 
 |         distributed with this work for additional information | 
 |         regarding copyright ownership.  The ASF licenses this file | 
 |         to you under the Apache License, Version 2.0 (the | 
 |         "License"); you may not use this file except in compliance | 
 |         with the License.  You may obtain a copy of the License at | 
 |         http://www.apache.org/licenses/LICENSE-2.0 | 
 |         Unless required by applicable law or agreed to in writing, | 
 |         software distributed under the License is distributed on an | 
 |         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
 |         KIND, either express or implied.  See the License for the | 
 |         specific language governing permissions and limitations | 
 |         under the License. | 
 |     --> | 
 |   </head> | 
 |   <body> | 
 |     <div class="title-bar" data-responsive-toggle="responsive-menu" data-hide-for="medium"> | 
 |     <button type="button" data-toggle="responsive-menu"><i style='font-size: 32px; color: #fff; padding: 8px' class='fa fa-bars'></i></button> | 
 |     <div class="title-bar-title">Apache NetBeans</div> | 
 | </div> | 
 | <div class="top-bar" id="responsive-menu"> | 
 |     <div class='top-bar-left'> | 
 |         <a class='title' href="../../../../index.html"><img src='../../../../_/images/apache-netbeans.svg' style='padding: 8px; height: 48px;'> Apache NetBeans</a> | 
 |     </div> | 
 |     <div class="top-bar-right"> | 
 |         <ul class="vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown"> | 
 |             <li> <input id="search-input" type="text" placeholder="Search the docs"> </li> | 
 |             <li> <a href="../../../../front/main/community">Community</a> </li> | 
 |             <li> <a href="../../../../front/main/participate">Participate</a> </li> | 
 |             <li> <a href="../../../../front/main/blogs">Blog</a></li> | 
 |             <li> <a href="../../../../front/main/help">Get Help</a> </li> | 
 |             <li> <a href="https://plugins.netbeans.apache.org/">Plugins</a> </li> | 
 |             <li> <a href="../../../../front/main/download">Download</a> </li> | 
 |         </ul> | 
 |     </div> | 
 | </div> | 
 |  | 
 |     <!-- src/templates/news --> | 
 | <section class="hero news alternate"> | 
 |     <div class='grid-container'> | 
 |         <div class='cell'> | 
 |             <div class="annotation">Latest release</div> | 
 |             <h1>Apache NetBeans 27</h1> | 
 |             <p><a class="button success" href="../../../../front/main/download/nb27">Download</a></p> | 
 |         </div> | 
 |     </div> | 
 | </section> | 
 |     <div class='grid-container main-content tutorial'> | 
 |       <h1 class="sect0">Code Generator Integration Tutorial</h1> | 
 |             <div class="sectionbody"> | 
 |               <div class="admonitionblock note"> | 
 |                 <table> | 
 |                   <tbody><tr> | 
 |                   <td class="icon"><i class="fa icon-note" title="Note"></i></td> | 
 |                   <td class="content">This tutorial needs a review.  | 
 |                      You can <a href="https://github.com/apache/netbeans-antora-tutorials/edit/main/modules/ROOT/pages/tutorials/nbm-code-generator.adoc" title="Edit this tutorial in github">edit it in GitHub </a> | 
 |                      following these <a href="../../../../tutorial/main/kb/docs/contributing">contribution guidelines.</a></td> | 
 |                   </tr></tbody> | 
 |                 </table> | 
 |               </div> | 
 |             </div> | 
 |         <div id="toc" class="toc"> | 
 | <div id="toctitle"></div> | 
 | <ul class="sectlevel1"> | 
 | <li><a href="#_introduction_to_code_generator_integration">Introduction to Code Generator Integration</a></li> | 
 | <li><a href="#_creating_the_module_project">Creating the Module Project</a></li> | 
 | <li><a href="#_using_the_code_generator_provider_wizard">Using the Code Generator Provider Wizard</a></li> | 
 | <li><a href="#_coding_the_code_generator_integration">Coding the Code Generator Integration</a></li> | 
 | <li><a href="#_installing_and_trying_out_the_functionality">Installing and Trying Out the Functionality</a></li> | 
 | <li><a href="#_next_steps">Next Steps</a></li> | 
 | </ul> | 
 | </div> | 
 | <div id="preamble"> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>This tutorial shows you how to write a module that integrates new items into the NetBeans Code Generator feature, which appears when you click Alt-Insert in an editor.</p> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p>For troubleshooting purposes, you are welcome to download the  <a href="http://web.archive.org/web/20170409072842/http://java.net/projects/nb-api-samples/show/versions/8.0/tutorials/DemoCodeGenerator">completed tutorial source code</a>.</p> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_introduction_to_code_generator_integration"><a class="anchor" href="#_introduction_to_code_generator_integration"></a>Introduction to Code Generator Integration</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>The Code Generator feature, consisting of a user interface and an API, introduced in NetBeans IDE 6.5, consists of a list of items that appears when you press Alt-Insert. Each item generates code into the editor. In this tutorial, you will create a sample generator, as shown below, which will generate a method into a Java class:</p> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-4.png" alt="code generator 72 new filewizard 4"> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_creating_the_module_project"><a class="anchor" href="#_creating_the_module_project"></a>Creating the Module Project</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>In this section, we use a wizard to create the source structure that every NetBeans module requires. The source structure consists of certain folders in specific places and a set of files that are always needed for Ant-based NetBeans modules. For example, every Ant-based NetBeans module requires a  <code>nbproject</code>  folder, which holds the project’s metadata.</p> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="1"> | 
 | <li> | 
 | <p>Choose File > New Project (Ctrl-Shift-N). Under Categories, select NetBeans Modules. Under Projects, select Module. Click Next.</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="2"> | 
 | <li> | 
 | <p>In the Name and Location panel, type  <code>DemoCodeGenerator</code>  in Project Name. Change the Project Location to any directory on your computer. Click Next.</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="3"> | 
 | <li> | 
 | <p>In the Basic Module Configuration panel, type  <code>org.netbeans.modules.demo</code>  as the Code Name Base. Click Finish.</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p>The IDE creates the  <code>DemoCodeGenerator</code>  project. The project contains all of your sources and project metadata, such as the project’s Ant build script. The project opens in the IDE. You can view its logical structure in the Projects window (Ctrl-1) and its file structure in the Files window (Ctrl-2).</p> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_using_the_code_generator_provider_wizard"><a class="anchor" href="#_using_the_code_generator_provider_wizard"></a>Using the Code Generator Provider Wizard</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>In this section, we use a wizard to create the stub class and registration entries necessary for beginning our integration with the Code Generator feature.</p> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="1"> | 
 | <li> | 
 | <p>Right-click the project node and choose New > Other. In the New File dialog, choose Module Development > Code Generator, as shown below:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-1.png" alt="code generator 72 new filewizard 1"> | 
 | </div> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="2"> | 
 | <li> | 
 | <p>In the New Code Generator panel, set the following:</p> | 
 | <div class="ulist"> | 
 | <ul> | 
 | <li> | 
 | <p><strong>Class Name.</strong> Specifies the class name of the stub that the wizard will generate. Type "DemoCodeGenerator" in this field.</p> | 
 | </li> | 
 | <li> | 
 | <p><strong>Package.</strong> Specifies the package where the stub class will be generated. Select "org.netbeans.modules.demo" from the drop-down.</p> | 
 | </li> | 
 | <li> | 
 | <p><strong>MimeType.</strong> Specifies the MIME type to which the code generator integration will be applied. Type "text/x-java" in this field.</p> | 
 | </li> | 
 | <li> | 
 | <p><strong>Generate CodeGeneratorContextProvider.</strong> Adds additional objects to the code generator’s lookup. Leave this checkbox unselected.</p> | 
 | </li> | 
 | </ul> | 
 | </div> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p>You should see the following:</p> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-2.png" alt="code generator 72 new filewizard 2"> | 
 | </div> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="3"> | 
 | <li> | 
 | <p>Click Finish. The Projects window should now show the following:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-3.png" alt="code generator 72 new filewizard 3"> | 
 | </div> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p>The generated class should look like this:</p> | 
 | </div> | 
 | <div class="listingblock"> | 
 | <div class="content"> | 
 | <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">package org.netbeans.modules.demo; | 
 |  | 
 | import java.util.Collections; | 
 | import java.util.List; | 
 | import javax.swing.text.JTextComponent; | 
 | import org.netbeans.api.editor.mimelookup.MimeRegistration; | 
 | import org.netbeans.spi.editor.codegen.CodeGenerator; | 
 | import org.openide.util.Lookup; | 
 |  | 
 | public class DemoCodeGenerator implements CodeGenerator { | 
 |  | 
 |     JTextComponent textComp; | 
 |  | 
 |     /** | 
 |      * | 
 |      * @param context containing JTextComponent and possibly other items | 
 |      * registered by {@link CodeGeneratorContextProvider} | 
 |      */ | 
 |     // Good practice is not to save Lookup outside ctor | 
 |     private DemoCodeGenerator(Lookup context) { | 
 |         textComp = context.lookup(JTextComponent.class); | 
 |     } | 
 |  | 
 |     @MimeRegistration(mimeType = "text/x-java", service = CodeGenerator.Factory.class) | 
 |     public static class Factory implements CodeGenerator.Factory { | 
 |         public List<? extends CodeGenerator> create(Lookup context) { | 
 |             return Collections.singletonList(new DemoCodeGenerator(context)); | 
 |         } | 
 |     } | 
 |  | 
 |     /** | 
 |      * The name which will be inserted inside Insert Code dialog | 
 |      */ | 
 |     public String getDisplayName() { | 
 |         return "Sample Generator"; | 
 |     } | 
 |  | 
 |     /** | 
 |      * This will be invoked when user chooses this Generator from Insert Code | 
 |      * dialog | 
 |      */ | 
 |     public void invoke() { | 
 |     } | 
 |  | 
 | }</code></pre> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_coding_the_code_generator_integration"><a class="anchor" href="#_coding_the_code_generator_integration"></a>Coding the Code Generator Integration</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>Next, we will implement the NetBeans Java Editor APIs introduced in the  <a href="../nbm-copyfqn/" class="xref page">NetBeans Java Language Infrastructure Tutorial</a>.</p> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p>Below, we set dependencies on the required modules and then implement them in our own module.</p> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="1"> | 
 | <li> | 
 | <p>Right-click the project, choose Properties, and add the following dependencies in the Libraries panel:</p> | 
 | <div class="ulist"> | 
 | <ul> | 
 | <li> | 
 | <p>Javac API Wrapper</p> | 
 | </li> | 
 | <li> | 
 | <p>Java Source</p> | 
 | </li> | 
 | </ul> | 
 | </div> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="2"> | 
 | <li> | 
 | <p>Open the generated class and modify the  <code>invoke()</code>  method as follows:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="listingblock"> | 
 | <div class="content"> | 
 | <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">public void invoke() { | 
 |     try { | 
 |         Document doc = textComp.getDocument(); | 
 |         JavaSource javaSource = JavaSource.forDocument(doc); | 
 |         CancellableTask task = new CancellableTask<WorkingCopy>() { | 
 |             public void run(WorkingCopy workingCopy) throws IOException { | 
 |                 workingCopy.toPhase(Phase.RESOLVED); | 
 |                 CompilationUnitTree cut = workingCopy.getCompilationUnit(); | 
 |                 TreeMaker make = workingCopy.getTreeMaker(); | 
 |                 for (Tree typeDecl : cut.getTypeDecls()) { | 
 |                     if (Tree.Kind.CLASS == typeDecl.getKind()) { | 
 |                         ClassTree clazz = (ClassTree) typeDecl; | 
 |                         ModifiersTree methodModifiers = | 
 |                                 make.Modifiers(Collections.<Modifier>singleton(Modifier.PUBLIC), | 
 |                                 Collections.<AnnotationTree>emptyList()); | 
 |                         VariableTree parameter = | 
 |                                 make.Variable(make.Modifiers(Collections.<Modifier>singleton(Modifier.FINAL), | 
 |                                 Collections.<AnnotationTree>emptyList()), | 
 |                                 "arg0", | 
 |                                 make.Identifier("Object"), | 
 |                                 null); | 
 |                         TypeElement element = workingCopy.getElements().getTypeElement("java.io.IOException"); | 
 |                         ExpressionTree throwsClause = make.QualIdent(element); | 
 |                         MethodTree newMethod = | 
 |                                 make.Method(methodModifiers, | 
 |                                 "writeExternal", | 
 |                                 make.PrimitiveType(TypeKind.VOID), | 
 |                                 Collections.<TypeParameterTree>emptyList(), | 
 |                                 Collections.singletonList(parameter), | 
 |                                 Collections.<ExpressionTree>singletonList(throwsClause), | 
 |                                 "{ throw new UnsupportedOperationException(\"Not supported yet.\") }", | 
 |                                 null); | 
 |                         ClassTree modifiedClazz = make.addClassMember(clazz, newMethod); | 
 |                         workingCopy.rewrite(clazz, modifiedClazz); | 
 |                     } | 
 |                 } | 
 |             } | 
 |             public void cancel() { | 
 |             } | 
 |         }; | 
 |         ModificationResult result = javaSource.runModificationTask(task); | 
 |         result.commit(); | 
 |     } catch (Exception ex) { | 
 |         Exceptions.printStackTrace(ex); | 
 |     } | 
 | }</code></pre> | 
 | </div> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="3"> | 
 | <li> | 
 | <p>Make sure the following import statements are declared:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="listingblock"> | 
 | <div class="content"> | 
 | <pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java">import com.sun.source.tree.AnnotationTree; | 
 | import com.sun.source.tree.ClassTree; | 
 | import com.sun.source.tree.CompilationUnitTree; | 
 | import com.sun.source.tree.ExpressionTree; | 
 | import com.sun.source.tree.MethodTree; | 
 | import com.sun.source.tree.ModifiersTree; | 
 | import com.sun.source.tree.Tree; | 
 | import com.sun.source.tree.TypeParameterTree; | 
 | import com.sun.source.tree.VariableTree; | 
 | import java.io.IOException; | 
 | import java.util.Collections; | 
 | import java.util.List; | 
 | import javax.lang.model.element.Modifier; | 
 | import javax.lang.model.element.TypeElement; | 
 | import javax.lang.model.type.TypeKind; | 
 | import javax.swing.text.Document; | 
 | import javax.swing.text.JTextComponent; | 
 | import org.netbeans.api.editor.mimelookup.MimeRegistration; | 
 | import org.netbeans.api.java.source.CancellableTask; | 
 | import org.netbeans.api.java.source.JavaSource; | 
 | import org.netbeans.api.java.source.JavaSource.Phase; | 
 | import org.netbeans.api.java.source.ModificationResult; | 
 | import org.netbeans.api.java.source.TreeMaker; | 
 | import org.netbeans.api.java.source.WorkingCopy; | 
 | import org.netbeans.spi.editor.codegen.CodeGenerator; | 
 | import org.netbeans.spi.editor.codegen.CodeGeneratorContextProvider; | 
 | import org.openide.util.Lookup;</code></pre> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_installing_and_trying_out_the_functionality"><a class="anchor" href="#_installing_and_trying_out_the_functionality"></a>Installing and Trying Out the Functionality</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>Let’s now install the module and then use the code generator feature integration. The IDE uses an Ant build script to build and install your module. The build script was created for you when you created the project.</p> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="1"> | 
 | <li> | 
 | <p>In the Projects window, right-click the project and choose Run. A new instance of the IDE starts up and installs the Code Generator integration module.</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="2"> | 
 | <li> | 
 | <p>Create a new Java application and open a Java source file. Press Alt-Insert inside the editor and you will see your new item included:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-4.png" alt="code generator 72 new filewizard 4"> | 
 | </div> | 
 | </div> | 
 | <div class="olist arabic"> | 
 | <ol class="arabic" start="3"> | 
 | <li> | 
 | <p>Click an item and the code will be inserted:</p> | 
 | </li> | 
 | </ol> | 
 | </div> | 
 | <div class="imageblock"> | 
 | <div class="content"> | 
 | <img src="../../_images/tutorials/code-generator_72_new-filewizard-5.png" alt="code generator 72 new filewizard 5"> | 
 | </div> | 
 | </div> | 
 | <div class="paragraph"> | 
 | <p><a href="../../../../front/main/community/mailing-lists/" class="xref page">Send Us Your Feedback</a></p> | 
 | </div> | 
 | </div> | 
 | </div> | 
 | <div class="sect1"> | 
 | <h2 id="_next_steps"><a class="anchor" href="#_next_steps"></a>Next Steps</h2> | 
 | <div class="sectionbody"> | 
 | <div class="paragraph"> | 
 | <p>For more information about creating and developing NetBeans modules, see the following resources:</p> | 
 | </div> | 
 | <div class="ulist"> | 
 | <ul> | 
 | <li> | 
 | <p><a href="https://netbeans.apache.org/platform/index.html">NetBeans Platform Homepage</a></p> | 
 | </li> | 
 | <li> | 
 | <p><a href="https://bits.netbeans.org/dev/javadoc/">NetBeans API List (Current Development Version)</a></p> | 
 | </li> | 
 | <li> | 
 | <p><a href="../../kb/docs/platform/" class="xref page">Other Related Tutorials</a></p> | 
 | </li> | 
 | </ul> | 
 | </div> | 
 | </div> | 
 | </div> | 
 |         <section class='tools'> | 
 |     <ul class="menu align-center"> | 
 |         <li><a title="Facebook" href="https://www.facebook.com/NetBeans"><i class="fa fa-md fa-facebook"></i></a></li> | 
 |         <li><a title="Twitter" href="https://twitter.com/netbeans"><i class="fa fa-md fa-twitter"></i></a></li> | 
 |         <li><a title="Github" href="https://github.com/apache/netbeans"><i class="fa fa-md fa-github"></i></a></li> | 
 |         <li><a title="YouTube" href="https://www.youtube.com/user/netbeansvideos"><i class="fa fa-md fa-youtube"></i></a></li> | 
 |         <li><a title="Atom Feed" href="https://netbeans.apache.org/blogs/atom"><i class="fa fa-mf fa-rss"></i></a></li> | 
 |         <li><a title="Slack" href="https://tinyurl.com/netbeans-slack-signup/"><i class="fa fa-md fa-slack"></i></a></li> | 
 |         <li><a title="Issues" href="https://github.com/apache/netbeans/issues"><i class="fa fa-mf fa-bug"></i></a></li> | 
 |     </ul> | 
 |     <ul class="menu align-center"> | 
 |         <li><a href="https://github.com/apache/netbeans-antora-tutorials/edit/main/modules/ROOT/pages/tutorials/nbm-code-generator.adoc" title="See this page in github"><i class="fa fa-md fa-edit"></i> See this page in GitHub.</a></li> | 
 |     </ul> | 
 | </section> | 
 |     </div> | 
 |         <div class='grid-container incubator-area' style='margin-top: 64px'> | 
 |       <div class='grid-x grid-padding-x'> | 
 |         <div class='large-auto cell text-center'> | 
 |           <a href="https://www.apache.org/"> | 
 |             <img style="height: 60px" title="Apache Software Foundation" src="../../../../_/images/asf_logo_wide.svg" /> | 
 |           </a> | 
 |         </div> | 
 |         <div class='large-auto cell text-center'> | 
 |           <a href="https://www.apache.org/events/current-event.html"> | 
 |             <img style="width:234px; height: 60px;" title="Apache Software Foundation current event" src="https://www.apache.org/events/current-event-234x60.png"/> | 
 |           </a> | 
 |         </div> | 
 |       </div> | 
 |     </div> | 
 |     <footer> | 
 |       <div class="grid-container"> | 
 |         <div class="grid-x grid-padding-x"> | 
 |           <div class="large-auto cell"> | 
 |             <h1><a href="../../../../front/main/about">About</a></h1> | 
 |             <ul> | 
 |               <li><a href="../../../../front/main/community/who">Who's Who</a></li> | 
 |               <li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li> | 
 |               <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> | 
 |               <li><a href="https://www.apache.org/security/">Security</a></li> | 
 |             </ul> | 
 |           </div> | 
 |           <div class="large-auto cell"> | 
 |             <h1><a href="../../../../front/main/community">Community</a></h1> | 
 |             <ul> | 
 |               <li><a href="../../../../front/main/community/mailing-lists">Mailing lists</a></li> | 
 |               <li><a href="../../../../front/main/community/committer">Becoming a committer</a></li> | 
 |               <li><a href="../../../../front/main/community/events">NetBeans Events</a></li> | 
 |               <li><a href="https://www.apache.org/events/current-event.html">Apache Events</a></li> | 
 |             </ul> | 
 |           </div> | 
 |           <div class="large-auto cell"> | 
 |             <h1><a href="../../../../front/main/participate">Participate</a></h1> | 
 |             <ul> | 
 |               <li><a href="../../../../front/main/participate/submit-pr">Submitting Pull Requests</a></li> | 
 |               <li><a href="../../../../front/main/participate/report-issue">Reporting Issues</a></li> | 
 |               <li><a href="../../../../front/main/participate/#documentation">Improving the documentation</a></li> | 
 |             </ul> | 
 |           </div> | 
 |           <div class="large-auto cell"> | 
 |             <h1><a href="../../../../front/main/help">Get Help</a></h1> | 
 |             <ul> | 
 |               <li><a href="../../../../front/main/help/#documentation">Documentation</a></li> | 
 |               <li><a href="../../../../wiki/main/wiki">Wiki</a></li> | 
 |               <li><a href="../../../../front/main/help/#support">Community Support</a></li> | 
 |               <li><a href="../../../../front/main/help/commercial-support">Commercial Support</a></li> | 
 |             </ul> | 
 |           </div> | 
 |           <div class="large-auto cell"> | 
 |             <h1><a href="../../../../front/main/download">Download</a></h1> | 
 |             <ul> | 
 |               <li><a href="../../../../front/main/download">Releases</a></li>                     | 
 |               <li><a href="https://plugins.netbeans.apache.org/">Plugins</a></li> | 
 |               <li><a href="../../../../front/main/download/#_daily_builds_and_building_from_source">Building from source</a></li> | 
 |               <li><a href="../../../../front/main/download/#_older_releases">Previous releases</a></li> | 
 |             </ul> | 
 |           </div> | 
 |         </div> | 
 |       </div> | 
 |     </footer> | 
 |     <div class='footer-disclaimer'> | 
 |       <div class="footer-disclaimer-content"> | 
 |         <p>Copyright © 2017-2025 <a href="https://www.apache.org">The Apache Software Foundation</a>.</p> | 
 |         <p>Licensed under the Apache <a href="https://www.apache.org/licenses/">license</a>, version 2.0</p> | 
 |         <div style='max-width: 40em; margin: 0 auto'> | 
 |           <p>Apache, Apache NetBeans, NetBeans, the Apache feather logo and the Apache NetBeans logo are trademarks of <a href="https://www.apache.org">The Apache Software Foundation</a>.</p> | 
 |           <p>Oracle and Java are registered trademarks of Oracle and/or its affiliates.</p> | 
 |           <p>The Apache NetBeans website conforms to the <a href="https://privacy.apache.org/policies/privacy-policy-public.html">Apache Software Foundation Privacy Policy</a></p> | 
 |         </div> | 
 |       </div> | 
 |     </div> | 
 |  | 
 |      | 
 | <script src="../../../../_/js/vendor/lunr.js"></script> | 
 | <script src="../../../../_/js/search-ui.js" id="search-ui-script" data-site-root-path="../../../.." data-snippet-length="100" data-stylesheet="../../../../_/css/search.css"></script> | 
 | <script async src="../../../../search-index.js"></script> | 
 |     <script src="../../../../_/js/vendor/jquery.min.js"></script> | 
 |     <script src="../../../../_/js/vendor/what-input.min.js"></script> | 
 |     <script src="../../../../_/js/vendor/foundation.min.js"></script> | 
 |     <script src="../../../../_/js/vendor/jquery.colorbox-min.js"></script> | 
 |     <script src="../../../../_/js/netbeans.js"></script> | 
 |     <script> | 
 |        $(function(){ $(document).foundation(); }); | 
 |     </script> | 
 |     <script src="../../../../_/js/vendor/highlight.min.js"></script> | 
 |     <script> | 
 |       document.addEventListener('DOMContentLoaded', (event) => { | 
 |          document.querySelectorAll('pre code').forEach((el) => { | 
 |          hljs.highlightElement(el); | 
 |         }); | 
 |       }); | 
 |     </script> | 
 |   </body> | 
 | </html> |