Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 229795

Summary: Implement Code Completion in XML Files (beans.xml)
Product: javaee Reporter: abien <abien>
Component: CDIAssignee: Sergey Petrov <sj-nb>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: dkonecny, marfous, markiewb, pjiricka, sj-nb
Version: 7.4   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: ENHANCEMENT Exception Report:

Description abien 2013-05-15 14:26:59 UTC
In beans.xml code completion does not work e.g.:

<beans>
<alternatives>
<stereotype>CTRL+SPACE --> does not suggest packages + classes</stereotype>
</alternatives>
</beans>

Support for Java code completion would streamline the development of advanced JavaEE apps.

General support for Java code completion in XML files would be also nice (e.g. in pom.xml etc.)
Comment 1 Petr Jiricka 2013-05-15 14:36:40 UTC
David, do you know how easy/difficult this is to do?
Comment 2 David Konecny 2013-05-16 03:58:48 UTC
I have no idea as I never worked with editor code completion APIs before. Maybe Martin has a better idea?

Adam, do you expect it to be common for developers to customizer CDI via beans.xml? Or in which cases it is necessary? Thanks.
Comment 3 Martin Fousek 2013-05-16 07:12:37 UTC
(In reply to comment #2)
> I have no idea as I never worked with editor code completion APIs before. Maybe
> Martin has a better idea?

Sorry, no idea - I didn't wrote it from scratch yet. I think, that some base for the completion could be taken from Spring Beans module since it looks pretty nice written there and for beans.xml it should be much easier than for Spring configs. If we would agreed to write this I can be volunteer for this job since it could be useful for me (and i.e. faces-config for future).
Comment 4 Petr Jiricka 2013-05-16 07:27:17 UTC
Cc'ing also Sergey, as he may have some ideas. Sergey, don't we have something like this for persistence.xml?
Comment 5 Sergey Petrov 2013-05-16 08:20:20 UTC
yes, there is simple completion for classes in persistence.xml, see http://wiki.netbeans.org/NetBeans_72_NewAndNoteworthy#Persistence.xml
Comment 6 Sergey Petrov 2013-05-16 08:30:22 UTC
just a note, int persistence it's not for classes but for entities, usually there are much less entities then classes and it may affect some code/optimization/performance.
Comment 7 Sergey Petrov 2013-07-08 15:28:59 UTC
I need to collect some use-cases,

for <alternatives>:
 - <class> child node, should contain only possible "alternatives".
 - <stereotype> ..

I'm still evaluating tutorials/specification. 
more use-cases possible use cases?

The feature seams really useful for end to end development in a few clicks. One more option is to add "visual" panel(similar to persistence.xml or web.xml etc) as xml multiview editor (it's better to handle as separate enhancment if anybody is interested).
Comment 8 Sergey Petrov 2013-07-09 16:36:30 UTC
*** Bug 178989 has been marked as a duplicate of this bug. ***
Comment 9 Quality Engineering 2013-10-24 02:40:22 UTC
Integrated into 'main-silver', will be available in build *201310240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/a94aee22af9b
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #229795 need cc and some other in web.beans module
Comment 10 Sergey Petrov 2013-11-07 15:36:04 UTC
unfortunately there is no internal model foe alternative classes as I see, and cc may be as slow as cc in java files on second ctrl+space, i.e. with all possible classes on full accessible classpath
Comment 11 Sergey Petrov 2013-11-08 12:58:51 UTC
I have a question if it can be expected to have at least dozens of alternatives/stereotypes. Currently I see no reasons to have structured list, i.e. packages on top and then after package selection select class (as in case of usual java classes in java editor). If there are 10-20 classes in different packages it may have sense to use plain list with fully qualified names here (or with simple and package in '()' ). Any ideas?
Also for 8.0 I'll limit scope to current project only, later if may be done with second click to scan dependencies also (similar to java editor).
Comment 12 Sergey Petrov 2013-11-11 14:27:58 UTC
For 8.0 
<class>
<stereotype>
completion is implemented, but with some limitation, to cover some progress I'm closing the issue, future enhancements need to be filed as new ones.

what I see as items for future update:
current classes are completed from current project only, no validation if stereotype is used anywhere, no filter for cc list for already added classes/stereotypes and classes list is "plain"(but last one may be ok)
Comment 13 Quality Engineering 2013-11-11 21:30:07 UTC
Integrated into 'main-silver', will be available in build *201311111815* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2949a84dcabd
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #229795 <class> and <stereotype> in <alternatives> now show classes/annotations marked with @alternative
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo