angelozerr / eclipse-wtp-xml-search

Eclipse WTP/XML Search
Other
12 stars 6 forks source link

missing completion proposal #17

Closed CrystalMethod closed 10 years ago

CrystalMethod commented 10 years ago

I've added a new content type and defined an XML reference as follows:

<extension
        point="org.eclipse.wst.xml.search.editor.xmlReferences">
  <references
        contentTypeIds="....">
    <reference>
       <from
             path="//provider"
             targetNodes="text()" />
        <toJava />
    </reference>
  </references>
</extension>

The content type is recognized and missing classes will be marked. But the completion proposal is missing, even for full qualified packages (#2). This works fine for web.xml.

<..>
  <..>
    <provider>foo.bar</provider>
  </..>
</..>

Do I have to add XML/Java Query specifications? What's the missing part here?

angelozerr commented 10 years ago

It was so long time, that I have developped this feature.

It's time to write wiki.

Is it possible for you to add your plugin + your project sample in your github please, It's hard for me to discover your problem without debugging.

CrystalMethod commented 10 years ago

Yes, I will push it to Github soon.

A general question: When do you prefer "wtp-xml-search" over a custom WTP extension, like your "eclipse-angularjs" plugins? There are other WTP extensions, e.g. to provide completion for "persistence.xml" which do not depend on "wtp-xml-search". What are the criteria to use the one or the other?

angelozerr commented 10 years ago

A general question: When do you prefer "wtp-xml-search"

I have created "wtp-xml-search" for my professional job because we have a lot and lot of XML files which defines a lot of dependencies like XML-> Java, XML -> XML like Jetty https://github.com/angelozerr/eclipse-wtp-xml-search/wiki/XML-Jetty-Plugins#user-content-xml-completion

We could develop Java code for each XML descriptor but we have more 100 of descriptors with a lot of dependencies. To maintain it, it's very hard. With WTP/XML Search you define your references with extension point, so you can see quickly references.

Once you define your reference you benefit with :

with few code.

In the future, I could manage refactoring too, because we have references.

I hope one day WTP/XML Search will be hosted inside WXTP. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=330576

For that I need that more plugins depends on WTP/XML Search. Today there is :

and the very cool thing, is that Liferay IDE used it.

over a custom WTP extension, like your "eclipse-angularjs" plugins?

For AngularJS Eclipse, it's not very interesting to do that, because there is none dependencies like XML <-> XML or XML <-> Java.

There are other WTP extensions, e.g. to provide completion for "persistence.xml" which do not >depend on "wtp-xml-search". What are the criteria to use the one or the other?

The goal of WTP/XML Search is to provide by defaut searcher for commons case like reference to Java class (you can implement your own searcher). So persitence.xml could be managed with WTP/XML Search with a simple reference and you benefit automaticly with completion, hover, validation, hyperlink and Ctrl+Shift+G.

I think if wtp-xml-search is hosted inside WTP one day, a lot of plugins could use it.

CrystalMethod commented 10 years ago

I definitely see the benefit of "wtp-xml-search". I have two use cases:

1) https://github.com/buschmais/extended-objects uses persistence descriptors similar to the well-known persistence.xml (JPA) (see https://github.com/buschmais/extended-objects/blob/master/impl/src/test/resources/META-INF/xo.xml)

2) One or two years ago we wrote an Xtext editor for Liquibase change sets (http://www.liquibase.org/documentation/databasechangelog.html). While it was very easy to implement all the reference stuff (linking, hovering,... - this is what Xtext was made for) it was very time-consuming to implement all the basic features the XML editor from WTP provides (DTD, XSD,...). My idea is to use "wtp-xml-search" now. But there is a new challenge: XML -> SQL references.

angelozerr commented 10 years ago

I definitely see the benefit of "wtp-xml-search".

Cool!

https://github.com/buschmais/extended-objects/blob/master/impl/src/test/resources/META-INF/xo.xml

It the goal of WTP/XML Search. Ok I have seen that this descriptor uses namespace, try with //ns:provider path :

<extension
        point="org.eclipse.wst.xml.search.editor.xmlReferences">
  <references
        contentTypeIds="....">
    <reference>
       <from
             path="//ns:provider"
             targetNodes="text()" />
        <toJava />
    </reference>
  </references>
</extension>

My idea is to use "wtp-xml-search" now.

Cool!

But there is a new challenge: XML -> SQL references.

Could you explain more your idea?

CrystalMethod commented 10 years ago

Given the following simple Liquibase change set

<changeSet author="liquibase-docs" id="addColumn-example">
    <addColumn catalogName="cat"
            schemaName="public"
            tableName="person">
        <column name="address" type="varchar(255)"/>
    </addColumn>
</changeSet>

and a database connection (Eclipse DTP) I want to validate that the column "address" in table "person" does not yet exist (b/c addColumn would throw an exception at runtime). So we have references from XML nodes to SQL/database nodes (tables, columns, keys)

angelozerr commented 10 years ago

Ok, I see the idea.

I would like to avoid adding the toSQL* element name inside the reference extension point.

I think the best idea is that you create your own extension point wich call WTP XML Search classes to register reference. I don't know if it's possible to do that but I will try to help you when you will need this feature.

CrystalMethod commented 10 years ago

Regarding the original question: I've pushed a minimal project setup. It contains only one plugin with just a plugin.xml. No implementation etc. Target platform and launch configuration can be found under releng/

https://github.com/BluWings/xope-ide

CrystalMethod commented 10 years ago

Thx for your PR, this was a good starting point.

angelozerr commented 10 years ago

Glad WTP/XML Search can help you. Hope you will like it.