blob: d65820d5f5f444e3530e86f200b99f1cc3c42192 [file] [log] [blame]
<HTML><HEAD><META CONTENT="text/html; charset=UTF-8" HTTP-EQUIV="Content-Type"/><TITLE>EMMA Coverage Report</TITLE><STYLE TYPE="text/css"> TABLE,TD,TH {border-style:solid; border-color:black;} TD,TH {background:white;margin:0;line-height:100%;padding-left:0.5em;padding-right:0.5em;} TD {border-width:0 1px 0 0;} TH {border-width:1px 1px 1px 0;} TR TD.h {color:red;} TABLE {border-spacing:0; border-collapse:collapse;border-width:0 0 1px 1px;} P,H1,H2,H3,TH {font-family:verdana,arial,sans-serif;font-size:10pt;} TD {font-family:courier,monospace;font-size:10pt;} TABLE.hdft {border-spacing:0;border-collapse:collapse;border-style:none;} TABLE.hdft TH,TABLE.hdft TD {border-style:none;line-height:normal;} TABLE.hdft TH.tl,TABLE.hdft TD.tl {background:#6699CC;color:white;} TABLE.hdft TD.nv {background:#6633DD;color:white;} .nv A:link {color:white;} .nv A:visited {color:white;} .nv A:active {color:yellow;} TABLE.hdft A:link {color:white;} TABLE.hdft A:visited {color:white;} TABLE.hdft A:active {color:yellow;} .in {color:#356085;} TABLE.s TD {padding-left:0.25em;padding-right:0.25em;} TABLE.s TD.l {padding-left:0.25em;padding-right:0.25em;text-align:right;background:#F0F0F0;} TABLE.s TR.z TD {background:#FF9999;} TABLE.s TR.p TD {background:#FFFF88;} TABLE.s TR.c TD {background:#CCFFCC;} A:link {color:#0000EE;text-decoration:none;} A:visited {color:#0000EE;text-decoration:none;} A:hover {color:#0000EE;text-decoration:underline;} TABLE.cn {border-width:0 0 1px 0;} TABLE.s {border-width:1px 0 1px 1px;} TD.h {color:red;border-width:0 1px 0 0;} TD.f {border-width:0 1px 0 1px;} TD.hf {color:red;border-width:0 1px 0 1px;} TH.f {border-width:1px 1px 1px 1px;} TR.cis TD {background:#F0F0F0;} TR.cis TD {border-width:1px 1px 1px 0;} TR.cis TD.h {color:red;border-width:1px 1px 1px 0;} TR.cis TD.f {border-width:1px 1px 1px 1px;} TR.cis TD.hf {color:red;border-width:1px 1px 1px 1px;} TD.b {border-style:none;background:transparent;line-height:50%;} TD.bt {border-width:1px 0 0 0;background:transparent;line-height:50%;} TR.o TD {background:#F0F0F0;}TABLE.it {border-style:none;}TABLE.it TD,TABLE.it TH {border-style:none;}</STYLE></HEAD><BODY><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="tl"><A HREF="http://www.eclemma.org/">EMMA</A> Coverage Report (generated Fri Feb 20 18:44:54 GMT 2009)</TH></TR><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="cb.html">org.eclipse.wst.xsl.ui.internal.contentassist</A>]</TD></TR></TABLE><H2>COVERAGE SUMMARY FOR SOURCE FILE [<SPAN CLASS="in">TemplateNameAttributeContentAssist.java</SPAN>]</H2><TABLE CELLSPACING="0" WIDTH="100%"><TR><TH>name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD>TemplateNameAttributeContentAssist.java</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/91)</TD><TD CLASS="h">0%   (0/22)</TD></TR></TABLE><H3>COVERAGE BREAKDOWN BY CLASS AND METHOD</H3><TABLE CLASS="cn" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="f">name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#0">TemplateNameAttributeContentAssist</A></TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/91)</TD><TD CLASS="h">0%   (0/22)</TD></TR><TR><TD CLASS="f"><A HREF="#0">TemplateNameAttributeContentAssist (Node, IStructuredDocumentRegion, ITextReg...</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/10)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2">addUniqueProposal (CustomCompletionProposal): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/24)</TD><TD CLASS="h">0%   (0/6)</TD></TR><TR><TD CLASS="f"><A HREF="#3">createProposal (CallTemplate): CustomCompletionProposal</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/27)</TD><TD CLASS="h">0%   (0/7)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4">getCompletionProposals (): ArrayList</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/30)</TD><TD CLASS="h">0%   (0/7)</TD></TR></TABLE><P></P><TABLE CLASS="s" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="l">1</TD><TD>/*******************************************************************************</TD></TR><TR><TD CLASS="l">2</TD><TD> *Copyright (c) 2008 Standards for Technology in Automotive Retail and others.</TD></TR><TR><TD CLASS="l">3</TD><TD> *All rights reserved. This program and the accompanying materials</TD></TR><TR><TD CLASS="l">4</TD><TD> *are made available under the terms of the Eclipse Public License v1.0</TD></TR><TR><TD CLASS="l">5</TD><TD> *which accompanies this distribution, and is available at</TD></TR><TR><TD CLASS="l">6</TD><TD> *http://www.eclipse.org/legal/epl-v10.html</TD></TR><TR><TD CLASS="l">7</TD><TD> *</TD></TR><TR><TD CLASS="l">8</TD><TD> *Contributors:</TD></TR><TR><TD CLASS="l">9</TD><TD> *    David Carver (STAR) bug 243577 - initial API and implementation</TD></TR><TR><TD CLASS="l">10</TD><TD> *******************************************************************************/</TD></TR><TR><TD CLASS="l">11</TD><TD>package org.eclipse.wst.xsl.ui.internal.contentassist;</TD></TR><TR><TD CLASS="l">12</TD><TD> </TD></TR><TR><TD CLASS="l">13</TD><TD>import java.util.ArrayList;</TD></TR><TR><TD CLASS="l">14</TD><TD>import java.util.List;</TD></TR><TR><TD CLASS="l">15</TD><TD> </TD></TR><TR><TD CLASS="l">16</TD><TD>import org.eclipse.jface.text.ITextViewer;</TD></TR><TR><TD CLASS="l">17</TD><TD>import org.eclipse.jface.text.contentassist.ICompletionProposal;</TD></TR><TR><TD CLASS="l">18</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;</TD></TR><TR><TD CLASS="l">19</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;</TD></TR><TR><TD CLASS="l">20</TD><TD>import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;</TD></TR><TR><TD CLASS="l">21</TD><TD>import org.eclipse.wst.xsl.core.model.CallTemplate;</TD></TR><TR><TD CLASS="l">22</TD><TD>import org.eclipse.wst.xsl.core.model.StylesheetModel;</TD></TR><TR><TD CLASS="l">23</TD><TD>import org.eclipse.wst.xsl.ui.internal.util.XSLPluginImageHelper;</TD></TR><TR><TD CLASS="l">24</TD><TD>import org.eclipse.wst.xsl.ui.internal.util.XSLPluginImages;</TD></TR><TR><TD CLASS="l">25</TD><TD>import org.w3c.dom.Node;</TD></TR><TR><TD CLASS="l">26</TD><TD> </TD></TR><TR><TD CLASS="l">27</TD><TD>/**</TD></TR><TR><TD CLASS="l">28</TD><TD> * Provides content assistance for XSLT Named Templates.   It provides a list</TD></TR><TR><TD CLASS="l">29</TD><TD> * of available call-template names that have already been used with in the</TD></TR><TR><TD CLASS="l">30</TD><TD> * stylesheet.</TD></TR><TR><TD CLASS="l">31</TD><TD> * </TD></TR><TR><TD CLASS="l">32</TD><TD> * @author David Carver</TD></TR><TR><TD CLASS="l">33</TD><TD> * @since 1.0</TD></TR><TR><TD CLASS="l">34</TD><TD> */</TD></TR><TR><TD CLASS="l">35</TD><TD>public class TemplateNameAttributeContentAssist extends AbstractXSLContentAssistRequest {</TD></TR><TR><TD CLASS="l">36</TD><TD> </TD></TR><TR><TD CLASS="l">37</TD><TD>        private static final String ATTR_NAME = &#34;name&#34;;</TD></TR><TR><TD CLASS="l">38</TD><TD> </TD></TR><TR><TD CLASS="l">39</TD><TD>        /**</TD></TR><TR><TD CLASS="l">40</TD><TD>         * Provides content assistance for XSLT Named Templates.  Will provide a list</TD></TR><TR><TD CLASS="l">41</TD><TD>         * of proposals based on the available named-templates if any are defined in</TD></TR><TR><TD CLASS="l">42</TD><TD>         * the XSL Stylesheet model.   Only provides a list of named templates that haven't already</TD></TR><TR><TD CLASS="l">43</TD><TD>         * been added as a proposal.  Does not check to see if it's already is defined in the current stylesheet.</TD></TR><TR><TD CLASS="l">44</TD><TD>         * @param node</TD></TR><TR><TD CLASS="l">45</TD><TD>         * @param documentRegion</TD></TR><TR><TD CLASS="l">46</TD><TD>         * @param completionRegion</TD></TR><TR><TD CLASS="l">47</TD><TD>         * @param begin</TD></TR><TR><TD CLASS="l">48</TD><TD>         * @param length</TD></TR><TR><TD CLASS="l">49</TD><TD>         * @param filter</TD></TR><TR><TD CLASS="l">50</TD><TD>         * @param textViewer</TD></TR><TR><TD CLASS="l">51</TD><TD>         */</TD></TR><TR><TD CLASS="l"><A NAME="0">52</A></TD><TD>        public TemplateNameAttributeContentAssist(Node node,</TD></TR><TR><TD CLASS="l">53</TD><TD>                        IStructuredDocumentRegion documentRegion,</TD></TR><TR><TD CLASS="l">54</TD><TD>                        ITextRegion completionRegion, int begin, int length, String filter,</TD></TR><TR><TD CLASS="l">55</TD><TD>                        ITextViewer textViewer) {</TD></TR><TR CLASS="z"><TD CLASS="l">56</TD><TD>                super(node, documentRegion, completionRegion, begin, length, filter, textViewer);</TD></TR><TR CLASS="z"><TD CLASS="l">57</TD><TD>        }</TD></TR><TR><TD CLASS="l">58</TD><TD> </TD></TR><TR><TD CLASS="l">59</TD><TD>        /* (non-Javadoc)</TD></TR><TR><TD CLASS="l"><A NAME="4">60</A></TD><TD>         * @see org.eclipse.wst.xsl.ui.internal.contentassist.AbstractXSLContentAssistRequest#getCompletionProposals()</TD></TR><TR><TD CLASS="l">61</TD><TD>         */</TD></TR><TR><TD CLASS="l">62</TD><TD>        @Override</TD></TR><TR><TD CLASS="l">63</TD><TD>        public ArrayList&lt;ICompletionProposal&gt; getCompletionProposals() {</TD></TR><TR CLASS="z"><TD CLASS="l">64</TD><TD>                proposals.clear();</TD></TR><TR><TD CLASS="l">65</TD><TD>                </TD></TR><TR CLASS="z"><TD CLASS="l">66</TD><TD>                StylesheetModel model = getStylesheetModel();</TD></TR><TR CLASS="z"><TD CLASS="l">67</TD><TD>                List&lt;CallTemplate&gt; templates = model.getCallTemplates();</TD></TR><TR><TD CLASS="l">68</TD><TD>                </TD></TR><TR CLASS="z"><TD CLASS="l">69</TD><TD>                for (CallTemplate template : templates) {</TD></TR><TR CLASS="z"><TD CLASS="l">70</TD><TD>                        CustomCompletionProposal proposal = createProposal(template);</TD></TR><TR CLASS="z"><TD CLASS="l">71</TD><TD>                        addUniqueProposal(proposal);</TD></TR><TR><TD CLASS="l">72</TD><TD>                }</TD></TR><TR><TD CLASS="l">73</TD><TD>                </TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="2">74</A></TD><TD>                return getAllCompletionProposals();</TD></TR><TR><TD CLASS="l">75</TD><TD>        }</TD></TR><TR><TD CLASS="l">76</TD><TD> </TD></TR><TR><TD CLASS="l">77</TD><TD>        private void addUniqueProposal(CustomCompletionProposal proposal) {</TD></TR><TR CLASS="z"><TD CLASS="l">78</TD><TD>                if (proposals.lastIndexOf(proposal) == -1) {</TD></TR><TR CLASS="z"><TD CLASS="l">79</TD><TD>                        if (matchString.length() &gt; 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">80</TD><TD>                                if (proposal.getDisplayString().startsWith(matchString)) {</TD></TR><TR CLASS="z"><TD CLASS="l">81</TD><TD>                                        addProposal(proposal);</TD></TR><TR><TD CLASS="l">82</TD><TD>                                }</TD></TR><TR><TD CLASS="l">83</TD><TD>                        } else {</TD></TR><TR CLASS="z"><TD CLASS="l">84</TD><TD>                                addProposal(proposal);</TD></TR><TR><TD CLASS="l">85</TD><TD>                        }</TD></TR><TR><TD CLASS="l"><A NAME="3">86</A></TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">87</TD><TD>        }</TD></TR><TR><TD CLASS="l">88</TD><TD> </TD></TR><TR><TD CLASS="l">89</TD><TD>        private CustomCompletionProposal createProposal(CallTemplate template) {</TD></TR><TR CLASS="z"><TD CLASS="l">90</TD><TD>                CustomCompletionProposal proposal = new CustomCompletionProposal(</TD></TR><TR CLASS="z"><TD CLASS="l">91</TD><TD>                                template.getAttributeValue(ATTR_NAME), getStartOffset() + 1, 0,</TD></TR><TR CLASS="z"><TD CLASS="l">92</TD><TD>                                template.getAttributeValue(ATTR_NAME).length(), XSLPluginImageHelper</TD></TR><TR CLASS="z"><TD CLASS="l">93</TD><TD>                                                .getInstance().getImage(</TD></TR><TR CLASS="z"><TD CLASS="l">94</TD><TD>                                                                XSLPluginImages.IMG_TEMPLATE), template</TD></TR><TR CLASS="z"><TD CLASS="l">95</TD><TD>                                                .getAttributeValue(ATTR_NAME), null, null, 0);</TD></TR><TR CLASS="z"><TD CLASS="l">96</TD><TD>                return proposal;</TD></TR><TR><TD CLASS="l">97</TD><TD>        }</TD></TR><TR><TD CLASS="l">98</TD><TD> </TD></TR><TR><TD CLASS="l">99</TD><TD>}</TD></TR></TABLE><P></P><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="cb.html">org.eclipse.wst.xsl.ui.internal.contentassist</A>]</TD></TR><TR><TD CLASS="tl"><A HREF="http://www.eclemma.org/support.html">EMMA 2.0.5312 EclEmma Fix 1</A> (C) Vladimir Roubtsov</TD></TR></TABLE></BODY></HTML>