<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Overview of Context Dependency Injection Tools
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="http://community.jboss.org/people/akazakov">Alexey Kazakov</a> in <i>JBoss Tools</i> - <a href="http://community.jboss.org/community/tools/blog/2011/01/31/overview-of-context-dependency-injection-tools">View the full blog post</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>The very first version of Context Dependency Injection (CDI) Tools was introduced as a part of JBoss Tools 3.1.0. But now JBoss Tools 3.2 is moving to its first stable release. Let's have some review of main features of the improved and up coming CDI Tools in JBoss Tools 3.2.</p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;"><strong>Enabling CDI support</strong></h3><p>First at all we need to enable CDI support for the project. If you already have some CDI project and don't want to start from scratch then just go to<em>Project Properties-&gt;CDI-&gt;CDI support</em> to enable all the features.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11251/00enableCDI.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11251/450-340/00enableCDI.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If your project is Maven-based and the pom.xml references the CDI api jars CDI support will be enabled automatically. If you want to create a brand new WTP project with CDI support, just add a CDI facet to the list of installing facets.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>See Max's blog <a class="jive-link-blog-small" href="http://community.jboss.org/community/tools/blog/2010/12/10/simple-cdi-hello-world-in-eclipse">Simple CDI Hello World with Eclipse and JBoss Tools</a> for details.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Make sure you have CDI support enabled for all the related projects. For instance if you have a web project (is to deployed as WAR) which uses some Java project (JAR) then both projects should have CDI support enabled.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If you are interested in Weld examples (Weld is the reference implementation of CDI spec.) you can download it from JBoss Tools example site.<em>Help-&gt;Project Examples-&gt;Weld 1.0.1</em></p><p><em><br/></em></p><p><em><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11252/01examples.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11252/421-600/01examples.png </span></a><br/></em></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;"><strong>CDI Wizards</strong></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>There are a set of CDI Wizards to help you to create basic CDI artifacts. The wizards are available in <em>File-&gt;New-&gt;Other...-&gt;CDI</em></p><p><em><br/></em></p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11253/02wizards.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11253/450-436/02wizards.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11254/03newStereotype.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11254/450-486/03newStereotype.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;"><strong>CDI validation</strong></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>CDI validation covers most of the rules declared in the JSR-299 specification. There are 100+ validation rules including definition errors and deployment problems. You can see the full list in the CDI Preferences, where you can also control which rules you want to be Errors, Warnings or simply Ignored.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11255/04validation.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11255/450-434/04validation.png </span></a><br/></strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The CDI validator checks for problems in java source files, JSP, XHTML and beans.xml files.</p><p>Some of the validation problems can be fixed via Quick Fixes menu (Ctrl+1):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11256/05nonBusinessProducer.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11256/450-160/05nonBusinessProducer.png </span></a></p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;"><strong>Code completion</strong></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Another useful feature is a code completion. CDI tools provides two types of code completion. Code completion for @Named beans and their members which are available in EL expressions:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11257/06elca.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11257/450-228/06elca.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And code completion for the relevant types/annotations in beans.xml:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11258/07beansXmlCA.gif"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11258/450-280/07beansXmlCA.gif </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;"><strong>Hyperlinks (OpenOns)</strong></h3><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="margin-left: 0pt; font-weight: normal;">Hyperlinks help you to navigate between source files. For example Ctrl+Click or F3 on any EL will navigate you to the corresponding java source.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="margin-left: 0pt; font-weight: normal;">For Injection's it is a bit more tricky. The built-in Java hyperlink for its declared type will open the type. But for Injection there are additional relevant items to navigate to. CDI Tools offers you an alternative navigation to the actual bean which is to be injected.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11259/08openOnInj.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11259/450-196/08openOnInj.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="margin-left: 0pt; font-weight: normal;">If&#160; the injection has multiple eligible beans, you can see a full list of these beans. Btw. you can fix the multiple eligible beans via a quick-fix (Ctrl+1).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="margin-left: 0pt; font-weight: normal;"><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11260/09openOnsInj.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11260/450-203/09openOnsInj.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="margin-left: 0pt; font-weight: normal;">Also you can open the corresponding class/interface mentioned in beans.xml via the same Ctrl+Click on the type name.</p><p>Observers and Events can be navigated to via OpenOn too.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11261/10eventOpenons.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11261/450-103/10eventOpenons.png </span></a></p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11262/11observerOpenOns.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11262/450-159/11observerOpenOns.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>As well as Producer and Disposer methods:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11263/12producerOpenOn.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11263/413-122/12producerOpenOn.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a href="http://community.jboss.org/servlet/JiveServlet/showImage/38-3559-11264/13disposerOpenOn.png"><span> http://community.jboss.org/servlet/JiveServlet/downloadImage/38-3559-11264/450-127/13disposerOpenOn.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>At last we also have:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>EL refactoring. For example if your name the method/field or class name of some bean using Java refactoring dialogs CDI Tools will offer you to update all the EL expressions that use this method/field/type.</li><li>Related CDI Beans are added in search result for field/method references search. See <a class="jive-link-external-small" href="http://screencast.com/t/NGUxOTA5YmQt">demo movie</a>.</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h3 style="color: #333333; font-weight: bold; margin-left: 0pt; padding-top: 10px; padding-bottom: 4px; font-size: 14pt;">Feedback</h3><p>This was a quick overview of the main features of up coming JBoss Tools 3.2 for CDI developers.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If you think CDI Tools misses some useful functionality then please create a feature request in <a class="jive-link-external-small" href="https://issues.jboss.org/browse/JBIDE">JIRA</a>! We are working to help you to enjoy this exciting world of CDI <span> :) </span></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="http://community.jboss.org/community/tools/blog/2011/01/31/overview-of-context-dependency-injection-tools">going to Community</a></p>

</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>