pepness commented on code in PR #5444:
URL: https://github.com/apache/netbeans/pull/5444#discussion_r1099538144
##########
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
Review Comment:
Done.
##########
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() );
+ }
+ // 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())) {
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