pepness commented on code in PR #5444:
URL: https://github.com/apache/netbeans/pull/5444#discussion_r1099537906


##########
java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/completion/PUCompletor.java:
##########
@@ -208,34 +206,24 @@ public List<JPACompletionItem> doCompletion(final 
CompletionContext context) {
 
         private void doJavaCompletion(final FileObject fo, final JavaSource 
js, final List<JPACompletionItem> results,
                 final String typedPrefix, final int substitutionOffset) throws 
IOException {
-            js.runUserActionTask(new Task<CompilationController>() {
-
-                @Override
-                public void run(CompilationController cc) throws Exception {
-                    cc.toPhase(Phase.ELEMENTS_RESOLVED);
-                    Project project = FileOwnerQuery.getOwner(fo);
-                    EntityClassScopeProvider provider = 
project.getLookup().lookup(EntityClassScopeProvider.class);
-                    EntityClassScope ecs = null;
-                    Entity[] entities = null;
-                    if (provider != null) {
-                        ecs = provider.findEntityClassScope(fo);
-                    }
-                    if (ecs != null) {
-                        entities = 
ecs.getEntityMappingsModel(false).runReadAction(new 
MetadataModelAction<EntityMappingsMetadata, Entity[]>() {
-
-                            @Override
-                            public Entity[] run(EntityMappingsMetadata 
metadata) throws Exception {
-                                return metadata.getRoot().getEntity();
-                            }
-                        });
-                    }
-                    // add classes 
-                    if(entities != null) {
-                        for (Entity entity : entities) {
-                            if (typedPrefix.length() == 0 || 
entity.getClass2().toLowerCase().startsWith(typedPrefix.toLowerCase()) || 
entity.getName().toLowerCase().startsWith(typedPrefix.toLowerCase())) {
-                                JPACompletionItem item = 
JPACompletionItem.createAttribValueItem(substitutionOffset, entity.getClass2());
-                                results.add(item);
-                            }
+            js.runUserActionTask( (CompilationController cc) -> {
+                cc.toPhase(Phase.ELEMENTS_RESOLVED);
+                Project project = FileOwnerQuery.getOwner(fo);
+                EntityClassScopeProvider provider = 
project.getLookup().lookup(EntityClassScopeProvider.class);
+                EntityClassScope ecs = null;
+                Entity[] entities = null;
+                if (provider != null) {
+                    ecs = provider.findEntityClassScope(fo);
+                }
+                if (ecs != null) {
+                    entities = 
ecs.getEntityMappingsModel(false).runReadAction( (EntityMappingsMetadata 
metadata) -> metadata.getRoot().getEntity() );

Review Comment:
   Done.



##########
java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/DocumentContext.java:
##########
@@ -214,10 +209,7 @@ public boolean equals(Object obj) {
             return false;
         }
         final DocumentContext other = (DocumentContext) obj;
-        if (this.document != other.document && (this.document == null || 
!this.document.equals(other.document))) {
-            return false;
-        }
-        return true;
+        return !(this.document != other.document && (this.document == null || 
!this.document.equals(other.document)));

Review Comment:
   Done.



##########
java/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/editor/ContextUtilities.java:
##########
@@ -116,18 +116,22 @@ public static String 
getAttributeTokenImage(DocumentContext context) {
      * Returns the prefix from the element's tag.
      */
     public static String getPrefixFromTag(String tagName) {
-        if(tagName == null) return null;
-        return (tagName.indexOf(":") == -1) ? null : // NOI18N
-            tagName.substring(0, tagName.indexOf(":")); // NOI18N
+        if(tagName == null) {
+            return null;
+        }
+        return (tagName.indexOf(':') == -1) ? null : // NOI18N
+            tagName.substring(0, tagName.indexOf(':')); // NOI18N
     }
     
     /**
      * Returns the local name from the element's tag.
      */
     public static String getLocalNameFromTag(String tagName) {
-        if(tagName == null) return null;
-        return (tagName.indexOf(":") == -1) ? tagName : // NOI18N
-            tagName.substring(tagName.indexOf(":")+1, tagName.length()); // 
NOI18N
+        if(tagName == null) {
+            return null;
+        }
+        return (tagName.indexOf(':') == -1) ? tagName : // NOI18N
+            tagName.substring(tagName.indexOf(':')+1, tagName.length()); // 
NOI18N

Review Comment:
   Done.



-- 
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