Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Peter Gromov
Subsystem
J2EE.Spring
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Taras Tielkes
    4 years ago (20 Sep 2007 13:53)
  • Updated by   root
    2 years ago (17 Jan 2010 20:52)
  • Jira: IDEADEV-21440
    (history, comments)
 
IDEA-41029 <tx:advice> / <tx:annotation-driven>: disable XSD-driven attribute completion for @transaction-manager
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
The namespace elements <tx:advice> and <tx:annotation-driven> have an attribute "transaction-manager".
This attribute should refer to a bean of PlatformTransactionManager type.

At the moment the XML editor inserts a completion variant "transactionManager" from the "default" attribute declaration in XSD.
It would be nice if this could be disabled:
  • if there's no bean named "transactionManager" the suggestion will be invalid
  • if there actually is a "transactionManager" bean, the spring facet itself will provide completion for it (based on DOM or schema annotations, not sure)

An API to restrict/filter completions coming from DTD/XSD would be nice, but I assume not in Selena timeframe :)

Issue was resolved
Comments (10)
 
History
 
Linked Issues (?)
 
Maxim Mossienko
  Maxim Mossienko
20 Sep 2007 14:00
4 years ago
We added this completion as feature since it can give idea of reasonable value
Taras Tielkes
  Taras Tielkes
20 Sep 2007 14:04
4 years ago
Maxim, that makes sense.
However, when using the spring facet, sometimes XSD-driven completion suggests a "default" value that is not valid (in spring sense).
Sascha Weinreuter
  Sascha Weinreuter
20 Sep 2007 14:05
4 years ago
Hmm, I'd say it's a matter of taste. Generally, it's IMHO a bad thing (one of several ones in XSD) that a schema (-validation) can modify the XML Infoset. So it may be desired to explicitly state the default value in an instance document to produce XML that behaves consistently, no matter if it's fed into a validator or not.
Taras Tielkes
  Taras Tielkes
20 Sep 2007 14:14
4 years ago
Sascha, I really agree: I consider use of XSD attribute defaulting a "Schema anti-pattern". However, your suggestion to explicitly stating default values in an instance document makes sense.

Ok, so if we let the current behavior in place, if there a way for the spring facet to remove such a completion variant?
Maxim Mossienko
  Maxim Mossienko
20 Sep 2007 14:29
4 years ago
We need particular attribute names to evaluate suggested route
Taras Tielkes
  Taras Tielkes
20 Sep 2007 16:24
4 years ago
Added screenshot showing duplicate (facet-based and XSD-based) completion.
Taras Tielkes
  Taras Tielkes
20 Sep 2007 16:27
4 years ago
Maxim:

namespace URI: http://www.springframework.org/schema/tx
element names: "annotation-driven", "advice"
attribute name: "transaction-manager"
Taras Tielkes
  Taras Tielkes
03 Nov 2007 16:43
4 years ago
This is not fixed in #7531 - please reopen.

Try to invoke code completion for "transaction-manager" attributes in example below:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                           http://www.springframework.org/schema/tx
                           http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

  <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="txMan"/>
  
  <tx:annotation-driven transaction-manager=""/>
  <tx:advice transaction-manager=""/>

</beans>


Using #7531, I still get _both_ the XSD-driven default attribute value proposal, as well as the facet-provided bean name reference.
Peter Gromov
  Peter Gromov
05 Nov 2007 15:02
4 years ago
In fact, it's another problem to suppress the XSD-based completion, and there's no way to fix it in Selena
Taras Tielkes
  Taras Tielkes
05 Nov 2007 16:27
4 years ago
I guess impact is minor.

However, such pattern is not limited to <tx:advice> and <tx:annotation-driven>: the new "jms" namespace uses a number of such "bean name reference" defaults in the schema. Also some custom namespaces copy the pattern.