4.1.2.5. Adding dynamic code assist to custom components that were added to JBoss Tools Palette

Here is what you need to do to add project based code assist to a custom component added in JBoss Developer Studio:

  1. Create a new xml file in <JBDS_home>studio/eclipse/plugins/org.jboss.tools.common.kb_***/schemas/tld/. For example call it JeniaFaces.xml. The file should be written according to <JBDS_home>/studio/eclipse/plugins/org.jboss.tools.common.kb/kb.jar/org/jboss/tools/common/kb/kb-schema_1.0.dtd

Here is how you set what is available for code assist:

  • Adds code assist for JSF pre-defined objects, such as value= "#{param}" :

<AttributeType ...>
       <proposal type="jsfVariables"/>
</AttributeType>
  • Adds bundle resource (property file) code assist:

<AttributeType ...>
       <proposal type="bundleProperty"/>
</AttributeType>
  • Adds managed bean property code assist:

<AttributeType ...>
       <proposal type="beanProperty"/>
</AttributeType>
  • Adds managed bean property but with a specified type:

<AttributeType ...>
       <proposal type="beanProperty">
          <param name="type" value="java.lang.Boolean"/>
       </proposal>
</AttributeType>
  • Adds managed bean method with a signature:

<AttributeType ...>
       <proposal type="beanMethodBySignature">
          <param name="paramType" value="javax.faces.context.FacesContext"/>
          <param name="paramType" value="javax.faces.component.UIComponent"/>
          <param name="paramType" value="java.lang.Object"/>
          <param name="returnType" value="void"/>
       </proposal>
</AttributeType>
  1. Add information on your xml file in <JBDS_home>/studio/eclipse/plugins/org.jboss.common.kb_***/plugin.xml

         <tld
            jsf="true"
            name="Jenia Faces"
            schema-location="schemas/tld/myJSF.xml"
            uri="http://www.jenia.org/jsf/dataTools"/>
    
  1. Restart Eclipse. You should now have code assist for the component.