This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 98563 - Dev-rev for schema aware code completion (xml/schema/completion)
Summary: Dev-rev for schema aware code completion (xml/schema/completion)
Status: RESOLVED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords:
Depends on:
Blocks: 98410
  Show dependency tree
 
Reported: 2007-03-21 20:49 UTC by Samaresh Panda
Modified: 2007-07-23 16:26 UTC (History)
3 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samaresh Panda 2007-03-21 20:49:21 UTC
In an effort to move a new set of XML/Schema related tools to base NB build
infrastructure, we need to undergo dev-rev for Schema aware code completion module.

Source for this module can be found here
http://www.netbeans.org/source/browse/xml/schema/completion/.

This module is currently a part of Netbeans Enterprise Pack and helps in code
completion in an instance documents based on schema. The modules implements
"Editor Code Completion APIs". There are two use-cases it caters to:

a) Documents that explicitly declare the conformance to a schema.
Reads the schema, creates an AXIOM model and uses that model to find completion
items at a given context.

b) Documents that do not explicitly declare the conformance to a schema.
Documents like WSDL, build.xml do not declare the conformance to a schema. For
such cases, the module provides a spi package. The consumers need to implement a
CompletionModelProvider and pass in Schemas that can be queried for completion.

The second use-case can be used to replace existing CC on XML documents based on
DTDs.

Feel free to add yourself to the CC list.
Comment 1 Milos Kleint 2007-03-27 19:10:40 UTC
MK1: what is the time schedule for making the existing CC in xml/core obsolete?

MK2: the current xml/core API allows me to do completion on xml docs that are
not strictly based on schema, and are at least partly dynamic.
a. I can do element completion based on schema or some other arbitrary source
for a given subtree. (in maven's pom.xml, the configuration of a plugin is
free-form basically)
b. I can query the existing document for values up in the doc and adjust the
completion appropriately (when doing completion for a given plugin, I can crawl
up the document and find out it's IDs to give completions) 
c. I can recognize the document as mine based just on filename or location
within the document, even if the user doesn't specify schema.
d. I can do completion on element text value or parts of it (well, this one is
currently broken in 5.5 and 6.0, but was working before)
Are these usecases to be supported when the old code gets removed? 
Comment 2 Jesse Glick 2007-03-27 19:34:32 UTC
I would also like to know the plans for deprecating CC from xml/core (used in
ant/grammar which I sort of maintain), as well as deprecation of xml/tax (used
in apisupport/project).
Comment 3 Samaresh Panda 2007-03-27 22:46:37 UTC
The plan is NOT to make anything obsolete, nor deprecated at this point. If I
understand correctly, the CC APIs in xml/core can be used for xml based on DTD. 

Netbeans do not provide CC on XML documents that conform to a schema. The plan
is to provide a core module (SACC) that provides CC wrt schema that can be used
across the IDE. If the document declares the conformance to a schema, by
default, the IDE will use the SACC. If you do not want this, you can hide this
in your module's layer file.

If the document doesn't declare the conformance to a schema (e.g. WSDL), you
have two choices to provide CC:
1. Take advantage of SACC and get CC for free. In this case, all you need to do
is, implement a CompletionModelProvider (see spi package) and pass in your
schema(s). The idea is to do this for something like wsdl or build.xml.
2. Not use SACC. Implement your own completion provider and SACC doesn't come in
the picture.

Answer to a and b) Sounds like some special use-case. Closest thing SACC have,
is, schema wildcard substitution.
Answer to c) You can get a lot of imformation from CompletionContext. See spi
package in xml/schema/completion.
Answer to d) Not available but is possible.
Comment 4 Milos Kleint 2007-03-28 09:28:01 UTC
> The plan is NOT to make anything obsolete, nor deprecated at this point. If I
> understand correctly, the CC APIs in xml/core can be used for xml based on DTD. 

That's a wrong assumption. The API in xml/core has nothing to do with DTDs, it
is reasonably general and it's only missing an implementation of CC that is
based on schema (because noone wrote it).
In my code I've written a simple schema walking provider for the schemas I knew
and cared about. 






Comment 5 Milos Kleint 2007-03-28 09:29:53 UTC
anyway, here is the link to what i'm doing:
http://fisheye.codehaus.org/browse/mevenide/trunk/mevenide2/netbeans/grammar/src/main/java/org/codehaus/mevenide/grammar
but that's irrelevant to this issue.
Comment 6 Samaresh Panda 2007-07-23 16:26:19 UTC
Fixed, integrated.