Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 128275 - Generic XML Editor hides the CC for element values
Generic XML Editor hides the CC for element values
Status: VERIFIED FIXED
Product: xml
Classification: Unclassified
Component: Text-Edit
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Samaresh Panda
issues@xml
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-25 07:31 UTC by Dongmei Cao
Modified: 2008-08-01 18:27 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dongmei Cao 2008-02-25 07:31:42 UTC
I encountered this problem when I was trying to provide code completion for the Hibernate Configuration XML files. I try
to provide code completion for element values, such as,
<property name="hibernate.show_sql">true</property>
if I have the cursor right after ">", the code completion pops up properly. But if I have the cursor, for example, after
the letter "t", then the code completion does not pop up. Basically, the code completion for the element value will pop
up ONLY if the cursor is RIGHT AFTER ">". I have debugged into the code and found it is caused by the following code in
XMLCompletionProvider.java (line 118) in the XML Text Editor module 

        protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
            boolean noResults = doQuery(resultSet, doc, caretOffset);
            if(doc != null && noResults) {
                checkHideCompletion((BaseDocument)doc, caretOffset);
            }
            resultSet.finish();
        }

When the cursor is not right after ">", the closing tag is not in the resultSet. So, the noResults is true and the
checkHideCompletion() gets invoked, which hides the code completion.

Now here is my question: can this code be commented out? Otherwise, the code completion from other CompletionProvider
can not work properly for element values
Comment 1 Dongmei Cao 2008-02-25 07:55:38 UTC
I have another question: is there a reason that the closing tag suggestion has to be right after the open tag ">"?
Comment 2 Dongmei Cao 2008-02-26 08:19:04 UTC
Dusan has done the following fix in editor.completion. Now, the xml editor does not need to do the specific hiding anymore.

"
FYI,
code completion should behave now in the way as Mila suggested - in case
of automatic invocation, if there are no suggestions, the popup would
stay hidden.

See changeset 6740db8e6988 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=6740db8e6988

Dusan
"
Comment 3 Samaresh Panda 2008-03-03 17:59:38 UTC
Can you tell me how I can see this issue? Do I have to install hibernate or spring modules?
Comment 4 Dongmei Cao 2008-03-03 21:43:21 UTC
You don't have to install the Hibernate modules (BTW, Spring does not this issue because it is schema-based). You can
see it in sun-web.xml file too in a little different way. Here is what you do:
- create a web project
- edit the sun-web.xml. After you finish the open tag with ">", you'll see the closing tag suggestion if the cursor is
right after ">". Now, don't close the tag. Instead, give a space after ">"; then hit Ctrl+space, the closing tag
suggestion will not popup. That's because the code in the XMLCompletionProvider is hiding the code completion.
Comment 5 Dongmei Cao 2008-03-03 21:50:10 UTC
But if you want to see it in Hibernate module, you can use the sample project I attached to issue
http://www.netbeans.org/issues/show_bug.cgi?id=128063 and following the steps to get the Hibernate support modules.

After you have the attached sample project open in NetBeans, look at the very first description of this bug. You should
see the problem.
Comment 6 Samaresh Panda 2008-03-05 17:23:50 UTC
I have no idea why the checkHideCompletion() is there. This code gets executed for xml based on DTDs and hope will not
break anything else.

Fix integrated, http://hg.netbeans.org/main?cmd=changeset;node=912d865745c7.

Comment 7 tonybeckham 2008-08-01 18:27:20 UTC
Verified

Product Version: NetBeans IDE Dev (Build 200808010201)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.4 running on i386; MacRoman; en_US (nb)


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