mbien commented on code in PR #3458:
URL: https://github.com/apache/netbeans/pull/3458#discussion_r918188633


##########
java/java.source/src/org/netbeans/modules/java/source/package-info.java:
##########
@@ -20,10 +20,11 @@
 @TemplateRegistrations({
     @TemplateRegistration(folder = "Classes/Code", position = 100, content = 
"resources/GeneratedMethodBody.template", scriptEngine = "freemarker", 
displayName = "#GeneratedMethodBody", category = "java-code-snippet"),
     @TemplateRegistration(folder = "Classes/Code", position = 200, content = 
"resources/OverriddenMethodBody.template", scriptEngine = "freemarker", 
displayName = "#OverriddenMethodBody", category = "java-code-snippet"),
-    @TemplateRegistration(folder = "Classes/Code", position = 300, content = 
"resources/LambdaBody.template", scriptEngine = "freemarker", displayName = 
"#LambdaBody", category = "java-code-snippet")
+    @TemplateRegistration(folder = "Classes/Code", position = 300, content = 
"resources/LambdaBody.template", scriptEngine = "freemarker", displayName = 
"#LambdaBody", category = "java-code-snippet"),
+    @TemplateRegistration(folder = "Classes/Code", position = 400, content = 
"resources/LambdaExpression.template", scriptEngine = "freemarker", displayName 
= "#LambdaExpression", category = "java-code-snippet")
 })
 @NbBundle.Messages({
-    "GeneratedMethodBody=Generated Method Body", 
"OverriddenMethodBody=Overridden Method Body", "LambdaBody=Generated Lambda 
Body" //NOI18N
+    "GeneratedMethodBody=Generated Method Body", 
"OverriddenMethodBody=Overridden Method Body", "LambdaBody=Generated Lambda 
Body", "LambdaExpression=Generated Lambda Expression" //NOI18N
 })

Review Comment:
   yeah that would be the easiest way. However, everything expects it being a 
FileObject with certain attributes set. So essentially I would have to 
replicate the template registration logic just to pass a two line String to the 
completion code.
   
   I think I found a way how to hide it. Templates can be registered while 
setting template=false, so they won't show up anywhere unless you know the path 
to them. The annotations can't set this, but the layer can. Result: completion 
works, but the two templates won't show up in the Template Manager.
   
https://github.com/apache/netbeans/blob/285a60deebf831424852d26469f1062ef75cdd46/java/java.source/src/org/netbeans/modules/java/source/resources/layer.xml#L33-L51



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to