sdedic commented on code in PR #7071:
URL: https://github.com/apache/netbeans/pull/7071#discussion_r1491094912
##########
enterprise/micronaut/src/org/netbeans/modules/micronaut/db/MicronautController.java:
##########
@@ -273,6 +206,86 @@ public void addChangeListener(ChangeListener l) {
public void removeChangeListener(ChangeListener l) {
}
+ @NbBundle.Messages({
+ "MSG_NoRepositories=No repository interface found in {0}",
+ "MSG_SelectRepository=Select Data Repository Interfaces",
+ "MSG_SelectRepository_Prompt=Repositories to be called from
Controllers",
+ "MSG_SelectControllerName=Controller Name"
+ })
+ private static CreateFromTemplateHandler handler(boolean fromRepository) {
+ return new CreateFromTemplateHandler() {
+ @Override
+ protected boolean accept(CreateDescriptor desc) {
+ return true;
+ }
+
+ @Override
+ protected List<FileObject> createFromTemplate(CreateDescriptor
desc) throws IOException {
+ try {
+ final FileObject folder = desc.getTarget();
+ final Project project = FileOwnerQuery.getOwner(folder);
+ if (project == null) {
+ DialogDisplayer.getDefault().notifyLater(new
NotifyDescriptor.Message(Bundle.MSG_NoProject(folder.getPath()),
NotifyDescriptor.ERROR_MESSAGE));
+ return Collections.emptyList();
+ }
+ if (fromRepository) {
+ final SourceGroup sourceGroup =
SourceGroups.getFolderSourceGroup(ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA),
folder);
+ if (sourceGroup == null) {
+ DialogDisplayer.getDefault().notifyLater(new
NotifyDescriptor.Message(Bundle.MSG_NoSourceGroup(folder.getPath()),
NotifyDescriptor.ERROR_MESSAGE));
+ return Collections.emptyList();
+ }
+ Set<ElementHandle<TypeElement>> repositoryClasses =
getRepositoryClasses(sourceGroup);
+ if (repositoryClasses.isEmpty()) {
+ DialogDisplayer.getDefault().notifyLater(new
NotifyDescriptor.Message(Bundle.MSG_NoRepositories(sourceGroup.getRootFolder().getPath()),
NotifyDescriptor.ERROR_MESSAGE));
+ return Collections.emptyList();
+ }
+ List<NotifyDescriptor.QuickPick.Item> items =
repositoryClasses.stream().map(handle -> {
+ String fqn = handle.getQualifiedName();
+ int idx = fqn.lastIndexOf('.');
Review Comment:
minor nicpick: will report inner classes as 'in fullPkgName.OuterClass'
--
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