blob: 8127e9e8b8d1a9bef2702383cfc8cf5ba0ae9363 [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="8d.html">org.eclipse.wst.sse.ui.internal.spelling</A>]</TD></TR></TABLE><H2>COVERAGE SUMMARY FOR SOURCE FILE [<SPAN CLASS="in">SpellcheckStrategy.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>SpellcheckStrategy.java</TD><TD>100% (4/4)</TD><TD CLASS="h">36%  (8/22)</TD><TD CLASS="h">25%  (154/623)</TD><TD CLASS="h">26%  (37/141)</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">SpellcheckStrategy$SpellCheckPreferenceListener</A></TD><TD>100% (1/1)</TD><TD CLASS="h">33%  (1/3)</TD><TD CLASS="h">15%  (6/39)</TD><TD CLASS="h">17%  (1/6)</TD></TR><TR><TD CLASS="f"><A HREF="#1">isInterestingProperty (Object): boolean</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/12)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2">propertyChange (PropertyChangeEvent): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/21)</TD><TD CLASS="h">0%   (0/4)</TD></TR><TR><TD CLASS="f"><A HREF="#0">SpellcheckStrategy$SpellCheckPreferenceListener (SpellcheckStrategy): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#4">SpellcheckStrategy$SpellingProblemCollector</A></TD><TD>100% (1/1)</TD><TD CLASS="h">17%  (1/6)</TD><TD CLASS="h">16%  (11/70)</TD><TD CLASS="h">12%  (2/16)</TD></TR><TR><TD CLASS="f"><A HREF="#5">accept (SpellingProblem): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/44)</TD><TD CLASS="h">0%   (0/9)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#6">beginCollecting (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#7">clear (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/4)</TD><TD CLASS="h">0%   (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#8">endCollecting (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#9">getAnnotations (): Annotation []</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/9)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4">SpellcheckStrategy$SpellingProblemCollector (SpellcheckStrategy): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (11/11)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#b">SpellcheckStrategy</A></TD><TD>100% (1/1)</TD><TD CLASS="h">42%  (5/12)</TD><TD CLASS="h">26%  (131/508)</TD><TD CLASS="h">28%  (33/118)</TD></TR><TR><TD CLASS="f"><A HREF="#c">containsStep (IReconcileStep): boolean</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/5)</TD><TD CLASS="h">0%   (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#d">getSpellingAnnotationsToRemove (IRegion): TemporaryAnnotation []</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/90)</TD><TD CLASS="h">0%   (0/21)</TD></TR><TR><TD CLASS="f"><A HREF="#e">isInterestingProblem (SpellingProblem): boolean</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/51)</TD><TD CLASS="h">0%   (0/13)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#f">isSupportedContext (String): boolean</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/30)</TD><TD CLASS="h">0%   (0/8)</TD></TR><TR><TD CLASS="f"><A HREF="#10">reconcile (): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/23)</TD><TD CLASS="h">0%   (0/7)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#11">reconcile (DirtyRegion, IRegion): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/49)</TD><TD CLASS="h">0%   (0/13)</TD></TR><TR><TD CLASS="f"><A HREF="#12">spellCheck (IRegion, IRegion, IAnnotationModel): void</A></TD><TD> </TD><TD CLASS="h">0%   (0/1)</TD><TD CLASS="h">0%   (0/120)</TD><TD CLASS="h">0%   (0/20)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#13">reconcile (IRegion): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">69%  (11/16)</TD><TD>83%  (5/6)</TD></TR><TR><TD CLASS="f"><A HREF="#14">setDocument (IDocument): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD CLASS="h">78%  (14/18)</TD><TD>83%  (5/6)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#b">&lt;static initializer&gt;</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (11/11)</TD><TD>100% (3/3)</TD></TR><TR><TD CLASS="f"><A HREF="#16">SpellcheckStrategy (ISourceViewer, String): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (94/94)</TD><TD>100% (19/19)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#17">createReconcileSteps (): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (1/1)</TD><TD>100% (1/1)</TD></TR><TR><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD><TD CLASS="bt"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#18">SpellcheckStrategy$1</A></TD><TD>100% (1/1)</TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (2/2)</TD></TR><TR><TD CLASS="f"><A HREF="#18">SpellcheckStrategy$1 (SpellcheckStrategy): void</A></TD><TD> </TD><TD>100% (1/1)</TD><TD>100% (6/6)</TD><TD>100% (2/2)</TD></TR></TABLE><P></P><TABLE CLASS="s" CELLSPACING="0" WIDTH="100%"><TR CLASS="c"><TD CLASS="l">1</TD><TD>/*******************************************************************************</TD></TR><TR><TD CLASS="l">2</TD><TD> * Copyright (c) 2006, 2009 IBM Corporation 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> *     IBM Corporation - initial API and implementation</TD></TR><TR><TD CLASS="l">10</TD><TD> *     </TD></TR><TR><TD CLASS="l">11</TD><TD> *******************************************************************************/</TD></TR><TR><TD CLASS="l">12</TD><TD>package org.eclipse.wst.sse.ui.internal.spelling;</TD></TR><TR><TD CLASS="l">13</TD><TD> </TD></TR><TR><TD CLASS="l">14</TD><TD>import java.util.ArrayList;</TD></TR><TR><TD CLASS="l">15</TD><TD>import java.util.Arrays;</TD></TR><TR><TD CLASS="l">16</TD><TD>import java.util.HashMap;</TD></TR><TR><TD CLASS="l">17</TD><TD>import java.util.Iterator;</TD></TR><TR><TD CLASS="l">18</TD><TD>import java.util.List;</TD></TR><TR><TD CLASS="l">19</TD><TD>import java.util.Map;</TD></TR><TR><TD CLASS="l">20</TD><TD> </TD></TR><TR><TD CLASS="l">21</TD><TD>import org.eclipse.core.runtime.Platform;</TD></TR><TR><TD CLASS="l">22</TD><TD>import org.eclipse.core.runtime.content.IContentType;</TD></TR><TR><TD CLASS="l">23</TD><TD>import org.eclipse.jface.text.IDocument;</TD></TR><TR><TD CLASS="l">24</TD><TD>import org.eclipse.jface.text.IRegion;</TD></TR><TR><TD CLASS="l">25</TD><TD>import org.eclipse.jface.text.Position;</TD></TR><TR><TD CLASS="l">26</TD><TD>import org.eclipse.jface.text.Region;</TD></TR><TR><TD CLASS="l">27</TD><TD>import org.eclipse.jface.text.reconciler.DirtyRegion;</TD></TR><TR><TD CLASS="l">28</TD><TD>import org.eclipse.jface.text.reconciler.IReconcileStep;</TD></TR><TR><TD CLASS="l">29</TD><TD>import org.eclipse.jface.text.source.Annotation;</TD></TR><TR><TD CLASS="l">30</TD><TD>import org.eclipse.jface.text.source.IAnnotationModel;</TD></TR><TR><TD CLASS="l">31</TD><TD>import org.eclipse.jface.text.source.IAnnotationModelExtension;</TD></TR><TR><TD CLASS="l">32</TD><TD>import org.eclipse.jface.text.source.IAnnotationModelExtension2;</TD></TR><TR><TD CLASS="l">33</TD><TD>import org.eclipse.jface.text.source.ISourceViewer;</TD></TR><TR><TD CLASS="l">34</TD><TD>import org.eclipse.jface.util.IPropertyChangeListener;</TD></TR><TR><TD CLASS="l">35</TD><TD>import org.eclipse.jface.util.PropertyChangeEvent;</TD></TR><TR><TD CLASS="l">36</TD><TD>import org.eclipse.ui.editors.text.EditorsUI;</TD></TR><TR><TD CLASS="l">37</TD><TD>import org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector;</TD></TR><TR><TD CLASS="l">38</TD><TD>import org.eclipse.ui.texteditor.spelling.SpellingAnnotation;</TD></TR><TR><TD CLASS="l">39</TD><TD>import org.eclipse.ui.texteditor.spelling.SpellingContext;</TD></TR><TR><TD CLASS="l">40</TD><TD>import org.eclipse.ui.texteditor.spelling.SpellingProblem;</TD></TR><TR><TD CLASS="l">41</TD><TD>import org.eclipse.ui.texteditor.spelling.SpellingService;</TD></TR><TR><TD CLASS="l">42</TD><TD>import org.eclipse.wst.sse.core.internal.parser.ForeignRegion;</TD></TR><TR><TD CLASS="l">43</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;</TD></TR><TR><TD CLASS="l">44</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;</TD></TR><TR><TD CLASS="l">45</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;</TD></TR><TR><TD CLASS="l">46</TD><TD>import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;</TD></TR><TR><TD CLASS="l">47</TD><TD>import org.eclipse.wst.sse.core.utils.StringUtils;</TD></TR><TR><TD CLASS="l">48</TD><TD>import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;</TD></TR><TR><TD CLASS="l">49</TD><TD>import org.eclipse.wst.sse.ui.internal.Logger;</TD></TR><TR><TD CLASS="l">50</TD><TD>import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;</TD></TR><TR><TD CLASS="l">51</TD><TD>import org.eclipse.wst.sse.ui.internal.reconcile.StructuredReconcileStep;</TD></TR><TR><TD CLASS="l">52</TD><TD>import org.eclipse.wst.sse.ui.internal.reconcile.StructuredTextReconcilingStrategy;</TD></TR><TR><TD CLASS="l">53</TD><TD>import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;</TD></TR><TR><TD CLASS="l">54</TD><TD> </TD></TR><TR><TD CLASS="l">55</TD><TD>/**</TD></TR><TR><TD CLASS="l">56</TD><TD> * A reconciling strategy that queries the SpellingService using its default</TD></TR><TR><TD CLASS="l">57</TD><TD> * engine. Results are show as temporary annotations.</TD></TR><TR><TD CLASS="l">58</TD><TD> * </TD></TR><TR><TD CLASS="l"><A NAME="0">59</A></TD><TD> * @since 1.1</TD></TR><TR><TD CLASS="l">60</TD><TD> */</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="1">61</A></TD><TD>public class SpellcheckStrategy extends StructuredTextReconcilingStrategy {</TD></TR><TR><TD CLASS="l">62</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">63</TD><TD>        class SpellCheckPreferenceListener implements IPropertyChangeListener {</TD></TR><TR><TD CLASS="l">64</TD><TD>                private boolean isInterestingProperty(Object property) {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="2">65</A></TD><TD>                        return SpellingService.PREFERENCE_SPELLING_ENABLED.equals(property) || SpellingService.PREFERENCE_SPELLING_ENGINE.equals(property);</TD></TR><TR><TD CLASS="l">66</TD><TD>                }</TD></TR><TR><TD CLASS="l">67</TD><TD> </TD></TR><TR><TD CLASS="l">68</TD><TD>                public void propertyChange(PropertyChangeEvent event) {</TD></TR><TR CLASS="z"><TD CLASS="l">69</TD><TD>                        if (isInterestingProperty(event.getProperty())) {</TD></TR><TR CLASS="z"><TD CLASS="l">70</TD><TD>                                if (event.getOldValue() == null || event.getNewValue() == null || !event.getNewValue().equals(event.getOldValue())) {</TD></TR><TR CLASS="z"><TD CLASS="l">71</TD><TD>                                        reconcile();</TD></TR><TR><TD CLASS="l">72</TD><TD>                                }</TD></TR><TR><TD CLASS="l"><A NAME="4">73</A></TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">74</TD><TD>                }</TD></TR><TR><TD CLASS="l">75</TD><TD>        }</TD></TR><TR><TD CLASS="l">76</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="5">77</A></TD><TD>        private class SpellingProblemCollector implements ISpellingProblemCollector {</TD></TR><TR CLASS="c"><TD CLASS="l">78</TD><TD>                List annotations = new ArrayList();</TD></TR><TR><TD CLASS="l">79</TD><TD> </TD></TR><TR><TD CLASS="l">80</TD><TD>                public void accept(SpellingProblem problem) {</TD></TR><TR CLASS="z"><TD CLASS="l">81</TD><TD>                        if (isInterestingProblem(problem)) {</TD></TR><TR CLASS="z"><TD CLASS="l">82</TD><TD>                                TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(problem.getOffset(), problem.getLength()), SpellingAnnotation.TYPE, problem.getMessage(), fReconcileAnnotationKey);</TD></TR><TR><TD CLASS="l">83</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">84</TD><TD>                                SpellingQuickAssistProcessor quickAssistProcessor = new SpellingQuickAssistProcessor();</TD></TR><TR CLASS="z"><TD CLASS="l">85</TD><TD>                                quickAssistProcessor.setSpellingProblem(problem);</TD></TR><TR CLASS="z"><TD CLASS="l">86</TD><TD>                                annotation.setAdditionalFixInfo(quickAssistProcessor);</TD></TR><TR CLASS="z"><TD CLASS="l">87</TD><TD>                                annotations.add(annotation);</TD></TR><TR CLASS="z"><TD CLASS="l">88</TD><TD>                                if (_DEBUG_SPELLING_PROBLEMS) {</TD></TR><TR CLASS="z"><TD CLASS="l">89</TD><TD>                                        Logger.log(Logger.INFO, problem.getMessage());</TD></TR><TR><TD CLASS="l">90</TD><TD>                                }</TD></TR><TR><TD CLASS="l"><A NAME="6">91</A></TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">92</TD><TD>                }</TD></TR><TR><TD CLASS="l">93</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="7">94</A></TD><TD>                public void beginCollecting() {</TD></TR><TR CLASS="z"><TD CLASS="l">95</TD><TD>                }</TD></TR><TR><TD CLASS="l">96</TD><TD> </TD></TR><TR><TD CLASS="l">97</TD><TD>                void clear() {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="8">98</A></TD><TD>                        annotations.clear();</TD></TR><TR CLASS="z"><TD CLASS="l">99</TD><TD>                }</TD></TR><TR><TD CLASS="l">100</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="9">101</A></TD><TD>                public void endCollecting() {</TD></TR><TR CLASS="z"><TD CLASS="l">102</TD><TD>                }</TD></TR><TR><TD CLASS="l">103</TD><TD> </TD></TR><TR><TD CLASS="l">104</TD><TD>                Annotation[] getAnnotations() {</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="b">105</A></TD><TD>                        return (Annotation[]) annotations.toArray(new Annotation[annotations.size()]);</TD></TR><TR><TD CLASS="l">106</TD><TD>                }</TD></TR><TR><TD CLASS="l">107</TD><TD>        }</TD></TR><TR><TD CLASS="l">108</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">109</TD><TD>        private static final boolean _DEBUG_SPELLING = Boolean.valueOf(Platform.getDebugOption(&#34;org.eclipse.wst.sse.ui/debug/reconcilerSpelling&#34;)).booleanValue(); //$NON-NLS-1$</TD></TR><TR CLASS="c"><TD CLASS="l">110</TD><TD>        private static final boolean _DEBUG_SPELLING_PROBLEMS = Boolean.valueOf(Platform.getDebugOption(&#34;org.eclipse.wst.sse.ui/debug/reconcilerSpelling/showProblems&#34;)).booleanValue(); //$NON-NLS-1$</TD></TR><TR><TD CLASS="l">111</TD><TD> </TD></TR><TR><TD CLASS="l">112</TD><TD>        private static final String EXTENDED_BUILDER_TYPE_CONTEXTS = &#34;spellingregions&#34;; //$NON-NLS-1$</TD></TR><TR><TD CLASS="l">113</TD><TD>        private static final String KEY_CONTENT_TYPE = &#34;org.eclipse.wst.sse.ui.temp.spelling&#34;; //$NON-NLS-1$</TD></TR><TR><TD CLASS="l">114</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">115</TD><TD>        private String fContentTypeId = null;</TD></TR><TR><TD CLASS="l">116</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">117</TD><TD>        private SpellingProblemCollector fProblemCollector = new SpellingProblemCollector();</TD></TR><TR><TD CLASS="l">118</TD><TD> </TD></TR><TR><TD CLASS="l">119</TD><TD>        /*</TD></TR><TR><TD CLASS="l">120</TD><TD>         * Keying our Temporary Annotations based on the partition doesn't help</TD></TR><TR><TD CLASS="l">121</TD><TD>         * this strategy to only remove its own TemporaryAnnotations since it's</TD></TR><TR><TD CLASS="l">122</TD><TD>         * possibly run on all partitions. Instead, set the key to use an</TD></TR><TR><TD CLASS="l">123</TD><TD>         * arbitrary partition type that we can check for using our own</TD></TR><TR><TD CLASS="l">124</TD><TD>         * implementation of getAnnotationsToRemove(DirtyRegion).</TD></TR><TR><TD CLASS="l">125</TD><TD>         */</TD></TR><TR><TD CLASS="l">126</TD><TD>        ReconcileAnnotationKey fReconcileAnnotationKey;</TD></TR><TR><TD CLASS="l">127</TD><TD> </TD></TR><TR><TD CLASS="l">128</TD><TD>        private IPropertyChangeListener fSpellCheckPreferenceListener;</TD></TR><TR><TD CLASS="l"><A NAME="18">129</A></TD><TD> </TD></TR><TR><TD CLASS="l">130</TD><TD>        private SpellingContext fSpellingContext;</TD></TR><TR><TD CLASS="l">131</TD><TD> </TD></TR><TR><TD CLASS="l">132</TD><TD>        private String[] fSupportedTextRegionContexts;</TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="16">133</A></TD><TD>        private IReconcileStep fSpellingStep = new StructuredReconcileStep() {</TD></TR><TR><TD CLASS="l">134</TD><TD>        };</TD></TR><TR><TD CLASS="l">135</TD><TD> </TD></TR><TR><TD CLASS="l">136</TD><TD>        public SpellcheckStrategy(ISourceViewer viewer, String contentTypeId) {</TD></TR><TR CLASS="c"><TD CLASS="l">137</TD><TD>                super(viewer);</TD></TR><TR CLASS="c"><TD CLASS="l">138</TD><TD>                fContentTypeId = contentTypeId;</TD></TR><TR><TD CLASS="l">139</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">140</TD><TD>                fSpellingContext = new SpellingContext();</TD></TR><TR CLASS="c"><TD CLASS="l">141</TD><TD>                IContentType contentType = Platform.getContentTypeManager().getContentType(fContentTypeId);</TD></TR><TR CLASS="c"><TD CLASS="l">142</TD><TD>                fSpellingContext.setContentType(contentType);</TD></TR><TR CLASS="c"><TD CLASS="l">143</TD><TD>                fReconcileAnnotationKey = new ReconcileAnnotationKey(fSpellingStep, KEY_CONTENT_TYPE, ReconcileAnnotationKey.PARTIAL);</TD></TR><TR><TD CLASS="l">144</TD><TD> </TD></TR><TR><TD CLASS="l">145</TD><TD>                /**</TD></TR><TR><TD CLASS="l">146</TD><TD>                 * Inherit spelling region rules</TD></TR><TR><TD CLASS="l">147</TD><TD>                 */</TD></TR><TR CLASS="c"><TD CLASS="l">148</TD><TD>                List contexts = new ArrayList();</TD></TR><TR CLASS="c"><TD CLASS="l">149</TD><TD>                IContentType testType = contentType;</TD></TR><TR CLASS="c"><TD CLASS="l">150</TD><TD>                while (testType != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">151</TD><TD>                        String[] textRegionContexts = ExtendedConfigurationBuilder.getInstance().getDefinitions(EXTENDED_BUILDER_TYPE_CONTEXTS, testType.getId());</TD></TR><TR CLASS="c"><TD CLASS="l">152</TD><TD>                        for (int j = 0; j &lt; textRegionContexts.length; j++) {</TD></TR><TR CLASS="c"><TD CLASS="l">153</TD><TD>                                contexts.addAll(Arrays.asList(StringUtils.unpack(textRegionContexts[j])));</TD></TR><TR><TD CLASS="l">154</TD><TD>                        }</TD></TR><TR CLASS="c"><TD CLASS="l">155</TD><TD>                        testType = testType.getBaseType();</TD></TR><TR><TD CLASS="l">156</TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l">157</TD><TD>                fSupportedTextRegionContexts = (String[]) contexts.toArray(new String[contexts.size()]);</TD></TR><TR><TD CLASS="l">158</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l"><A NAME="c">159</A></TD><TD>                fSpellCheckPreferenceListener = new SpellCheckPreferenceListener();</TD></TR><TR CLASS="c"><TD CLASS="l">160</TD><TD>        }</TD></TR><TR><TD CLASS="l">161</TD><TD> </TD></TR><TR><TD CLASS="l">162</TD><TD>        protected boolean containsStep(IReconcileStep step) {</TD></TR><TR CLASS="z"><TD CLASS="l">163</TD><TD>                return fSpellingStep.equals(step);</TD></TR><TR><TD CLASS="l"><A NAME="17">164</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">165</TD><TD> </TD></TR><TR><TD CLASS="l">166</TD><TD>        public void createReconcileSteps() {</TD></TR><TR><TD CLASS="l"><A NAME="d">167</A></TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">168</TD><TD>        }</TD></TR><TR><TD CLASS="l">169</TD><TD> </TD></TR><TR><TD CLASS="l">170</TD><TD>        private TemporaryAnnotation[] getSpellingAnnotationsToRemove(IRegion region) {</TD></TR><TR CLASS="z"><TD CLASS="l">171</TD><TD>                List toRemove = new ArrayList();</TD></TR><TR CLASS="z"><TD CLASS="l">172</TD><TD>                IAnnotationModel annotationModel = getAnnotationModel();</TD></TR><TR><TD CLASS="l">173</TD><TD>                // can be null when closing the editor</TD></TR><TR CLASS="z"><TD CLASS="l">174</TD><TD>                if (annotationModel != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">175</TD><TD>                        Iterator i = null;</TD></TR><TR CLASS="z"><TD CLASS="l">176</TD><TD>                        boolean annotationOverlaps = false;</TD></TR><TR CLASS="z"><TD CLASS="l">177</TD><TD>                        if (annotationModel instanceof IAnnotationModelExtension2) {</TD></TR><TR CLASS="z"><TD CLASS="l">178</TD><TD>                                i = ((IAnnotationModelExtension2) annotationModel).getAnnotationIterator(region.getOffset(), region.getLength(), true, true);</TD></TR><TR CLASS="z"><TD CLASS="l">179</TD><TD>                                annotationOverlaps = true;</TD></TR><TR><TD CLASS="l">180</TD><TD>                        }</TD></TR><TR><TD CLASS="l">181</TD><TD>                        else {</TD></TR><TR CLASS="z"><TD CLASS="l">182</TD><TD>                                i = annotationModel.getAnnotationIterator();</TD></TR><TR><TD CLASS="l">183</TD><TD>                        }</TD></TR><TR><TD CLASS="l">184</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">185</TD><TD>                        while (i.hasNext()) {</TD></TR><TR CLASS="z"><TD CLASS="l">186</TD><TD>                                Object obj = i.next();</TD></TR><TR CLASS="z"><TD CLASS="l">187</TD><TD>                                if (!(obj instanceof TemporaryAnnotation))</TD></TR><TR CLASS="z"><TD CLASS="l">188</TD><TD>                                        continue;</TD></TR><TR><TD CLASS="l">189</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">190</TD><TD>                                TemporaryAnnotation annotation = (TemporaryAnnotation) obj;</TD></TR><TR CLASS="z"><TD CLASS="l">191</TD><TD>                                ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();</TD></TR><TR><TD CLASS="l">192</TD><TD> </TD></TR><TR><TD CLASS="l">193</TD><TD>                                // then if this strategy knows how to add/remove this</TD></TR><TR><TD CLASS="l">194</TD><TD>                                // partition type</TD></TR><TR CLASS="z"><TD CLASS="l">195</TD><TD>                                if (key != null &amp;&amp; key.equals(fReconcileAnnotationKey)) {</TD></TR><TR CLASS="z"><TD CLASS="l">196</TD><TD>                                        if (key.getScope() == ReconcileAnnotationKey.PARTIAL &amp;&amp; (annotationOverlaps || annotation.getPosition().overlapsWith(region.getOffset(), region.getLength()))) {</TD></TR><TR CLASS="z"><TD CLASS="l">197</TD><TD>                                                toRemove.add(annotation);</TD></TR><TR><TD CLASS="l">198</TD><TD>                                        }</TD></TR><TR CLASS="z"><TD CLASS="l">199</TD><TD>                                        else if (key.getScope() == ReconcileAnnotationKey.TOTAL) {</TD></TR><TR CLASS="z"><TD CLASS="l">200</TD><TD>                                                toRemove.add(annotation);</TD></TR><TR><TD CLASS="l">201</TD><TD>                                        }</TD></TR><TR><TD CLASS="l">202</TD><TD>                                }</TD></TR><TR><TD CLASS="l">203</TD><TD>                        }</TD></TR><TR><TD CLASS="l">204</TD><TD>                }</TD></TR><TR><TD CLASS="l">205</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">206</TD><TD>                return (TemporaryAnnotation[]) toRemove.toArray(new TemporaryAnnotation[toRemove.size()]);</TD></TR><TR><TD CLASS="l">207</TD><TD>        }</TD></TR><TR><TD CLASS="l">208</TD><TD> </TD></TR><TR><TD CLASS="l">209</TD><TD>        /**</TD></TR><TR><TD CLASS="l">210</TD><TD>         * Judge whether a spelling problem is &#34;interesting&#34;. Accept any regions</TD></TR><TR><TD CLASS="l">211</TD><TD>         * that are explicitly allowed, and since valid prose areas are rarely in</TD></TR><TR><TD CLASS="l">212</TD><TD>         * a complicated document region, accept any document region with more</TD></TR><TR><TD CLASS="l">213</TD><TD>         * than one text region and reject any document regions containing foreign</TD></TR><TR><TD CLASS="l">214</TD><TD>         * text regions.</TD></TR><TR><TD CLASS="l">215</TD><TD>         * </TD></TR><TR><TD CLASS="l">216</TD><TD>         * @param problem</TD></TR><TR><TD CLASS="l"><A NAME="e">217</A></TD><TD>         *            a SpellingProblem</TD></TR><TR><TD CLASS="l">218</TD><TD>         * @return whether the collector should accept the given SpellingProblem</TD></TR><TR><TD CLASS="l">219</TD><TD>         */</TD></TR><TR><TD CLASS="l">220</TD><TD>        protected boolean isInterestingProblem(SpellingProblem problem) {</TD></TR><TR CLASS="z"><TD CLASS="l">221</TD><TD>                IDocument document = getDocument();</TD></TR><TR CLASS="z"><TD CLASS="l">222</TD><TD>                if (document instanceof IStructuredDocument) {</TD></TR><TR><TD CLASS="l">223</TD><TD>                        /*</TD></TR><TR><TD CLASS="l">224</TD><TD>                         * If the error is in a read-only section, ignore it. The user</TD></TR><TR><TD CLASS="l">225</TD><TD>                         * won't be able to correct it.</TD></TR><TR><TD CLASS="l">226</TD><TD>                         */</TD></TR><TR CLASS="z"><TD CLASS="l">227</TD><TD>                        if (((IStructuredDocument) document).containsReadOnly(problem.getOffset(), problem.getLength()))</TD></TR><TR CLASS="z"><TD CLASS="l">228</TD><TD>                                return false;</TD></TR><TR><TD CLASS="l">229</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">230</TD><TD>                        IStructuredDocumentRegion documentRegion = ((IStructuredDocument) document).getRegionAtCharacterOffset(problem.getOffset());</TD></TR><TR CLASS="z"><TD CLASS="l">231</TD><TD>                        if (documentRegion != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">232</TD><TD>                                ITextRegion textRegion = documentRegion.getRegionAtCharacterOffset(problem.getOffset());</TD></TR><TR CLASS="z"><TD CLASS="l">233</TD><TD>                                if (textRegion != null &amp;&amp; isSupportedContext(textRegion.getType()) &amp;&amp; !(textRegion instanceof ITextRegionCollection)) {</TD></TR><TR CLASS="z"><TD CLASS="l">234</TD><TD>                                        return true;</TD></TR><TR><TD CLASS="l">235</TD><TD>                                }</TD></TR><TR CLASS="z"><TD CLASS="l">236</TD><TD>                                if (documentRegion.getFirstRegion() instanceof ForeignRegion)</TD></TR><TR CLASS="z"><TD CLASS="l">237</TD><TD>                                        return false;</TD></TR><TR><TD CLASS="l">238</TD><TD>//                                [192572] Simple regions were being spellchecked just for the sake of them being simple</TD></TR><TR><TD CLASS="l">239</TD><TD>//                                if (documentRegion.getRegions().size() == 1)</TD></TR><TR><TD CLASS="l">240</TD><TD>//                                        return true;</TD></TR><TR CLASS="z"><TD CLASS="l">241</TD><TD>                                return false;</TD></TR><TR><TD CLASS="l">242</TD><TD>                        }</TD></TR><TR><TD CLASS="l">243</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">244</TD><TD>                return true;</TD></TR><TR><TD CLASS="l"><A NAME="f">245</A></TD><TD>        }</TD></TR><TR><TD CLASS="l">246</TD><TD> </TD></TR><TR><TD CLASS="l">247</TD><TD> </TD></TR><TR><TD CLASS="l">248</TD><TD>        private boolean isSupportedContext(String type) {</TD></TR><TR CLASS="z"><TD CLASS="l">249</TD><TD>                boolean isSupported = false;</TD></TR><TR CLASS="z"><TD CLASS="l">250</TD><TD>                if (fSupportedTextRegionContexts.length &gt; 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">251</TD><TD>                        for (int i = 0; i &lt; fSupportedTextRegionContexts.length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">252</TD><TD>                                if (type.equals(fSupportedTextRegionContexts[i])) {</TD></TR><TR CLASS="z"><TD CLASS="l">253</TD><TD>                                        isSupported = true;</TD></TR><TR CLASS="z"><TD CLASS="l">254</TD><TD>                                        break;</TD></TR><TR><TD CLASS="l">255</TD><TD>                                }</TD></TR><TR><TD CLASS="l">256</TD><TD>                        }</TD></TR><TR><TD CLASS="l">257</TD><TD>                }</TD></TR><TR><TD CLASS="l">258</TD><TD>                else {</TD></TR><TR CLASS="z"><TD CLASS="l">259</TD><TD>                        isSupported = true;</TD></TR><TR><TD CLASS="l">260</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="10">261</A></TD><TD>                return isSupported;</TD></TR><TR><TD CLASS="l">262</TD><TD>        }</TD></TR><TR><TD CLASS="l">263</TD><TD> </TD></TR><TR><TD CLASS="l">264</TD><TD>        public void reconcile() {</TD></TR><TR CLASS="z"><TD CLASS="l">265</TD><TD>                IDocument document = getDocument();</TD></TR><TR CLASS="z"><TD CLASS="l">266</TD><TD>                if (document != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">267</TD><TD>                        IAnnotationModel annotationModel = getAnnotationModel();</TD></TR><TR CLASS="z"><TD CLASS="l">268</TD><TD>                        if (annotationModel != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">269</TD><TD>                                IRegion documentRegion = new Region(0, document.getLength());</TD></TR><TR CLASS="z"><TD CLASS="l">270</TD><TD>                                spellCheck(documentRegion, documentRegion, annotationModel);</TD></TR><TR><TD CLASS="l">271</TD><TD>                        }</TD></TR><TR><TD CLASS="l">272</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">273</TD><TD>        }</TD></TR><TR><TD CLASS="l">274</TD><TD> </TD></TR><TR><TD CLASS="l">275</TD><TD>        /**</TD></TR><TR><TD CLASS="l"><A NAME="11">276</A></TD><TD>         * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion,</TD></TR><TR><TD CLASS="l">277</TD><TD>         *      org.eclipse.jface.text.IRegion)</TD></TR><TR><TD CLASS="l">278</TD><TD>         */</TD></TR><TR><TD CLASS="l">279</TD><TD>        public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {</TD></TR><TR CLASS="z"><TD CLASS="l">280</TD><TD>                if (isCanceled())</TD></TR><TR CLASS="z"><TD CLASS="l">281</TD><TD>                        return;</TD></TR><TR><TD CLASS="l">282</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">283</TD><TD>                IAnnotationModel annotationModel = getAnnotationModel();</TD></TR><TR><TD CLASS="l">284</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">285</TD><TD>                IDocument document = getDocument();</TD></TR><TR CLASS="z"><TD CLASS="l">286</TD><TD>                if (document != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">287</TD><TD>                        long time0 = 0;</TD></TR><TR CLASS="z"><TD CLASS="l">288</TD><TD>                        if (_DEBUG_SPELLING) {</TD></TR><TR CLASS="z"><TD CLASS="l">289</TD><TD>                                time0 = System.currentTimeMillis();</TD></TR><TR><TD CLASS="l">290</TD><TD>                        }</TD></TR><TR><TD CLASS="l">291</TD><TD>                        /**</TD></TR><TR><TD CLASS="l">292</TD><TD>                         * Apparently the default spelling engine has noticeable overhead</TD></TR><TR><TD CLASS="l">293</TD><TD>                         * when called multiple times in rapid succession. It's faster to</TD></TR><TR><TD CLASS="l">294</TD><TD>                         * check the entire dirty region at once since we know that we're</TD></TR><TR><TD CLASS="l">295</TD><TD>                         * not differentiating by partition.</TD></TR><TR><TD CLASS="l">296</TD><TD>                         * </TD></TR><TR><TD CLASS="l">297</TD><TD>                         * https://bugs.eclipse.org/bugs/show_bug.cgi?id=192530</TD></TR><TR><TD CLASS="l">298</TD><TD>                         */</TD></TR><TR CLASS="z"><TD CLASS="l">299</TD><TD>                        if (_DEBUG_SPELLING) {</TD></TR><TR CLASS="z"><TD CLASS="l">300</TD><TD>                                Logger.log(Logger.INFO, &#34;Spell Checking [&#34; + dirtyRegion.getOffset() + &#34;:&#34; + dirtyRegion.getLength() + &#34;] : &#34; + (System.currentTimeMillis() - time0));</TD></TR><TR><TD CLASS="l">301</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">302</TD><TD>                        if (annotationModel != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">303</TD><TD>                                spellCheck(dirtyRegion, dirtyRegion, annotationModel);</TD></TR><TR><TD CLASS="l">304</TD><TD>                        }</TD></TR><TR><TD CLASS="l"><A NAME="12">305</A></TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">306</TD><TD>        }</TD></TR><TR><TD CLASS="l">307</TD><TD> </TD></TR><TR><TD CLASS="l">308</TD><TD>        private void spellCheck(IRegion dirtyRegion, IRegion regionToBeChecked, IAnnotationModel annotationModel) {</TD></TR><TR CLASS="z"><TD CLASS="l">309</TD><TD>                if (annotationModel == null)</TD></TR><TR CLASS="z"><TD CLASS="l">310</TD><TD>                        return;</TD></TR><TR><TD CLASS="l">311</TD><TD> </TD></TR><TR><TD CLASS="l">312</TD><TD>                TemporaryAnnotation[] annotationsToRemove;</TD></TR><TR><TD CLASS="l">313</TD><TD>                Annotation[] annotationsToAdd;</TD></TR><TR CLASS="z"><TD CLASS="l">314</TD><TD>                annotationsToRemove = getSpellingAnnotationsToRemove(regionToBeChecked);</TD></TR><TR><TD CLASS="l">315</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">316</TD><TD>                if (_DEBUG_SPELLING_PROBLEMS) {</TD></TR><TR CLASS="z"><TD CLASS="l">317</TD><TD>                        Logger.log(Logger.INFO, &#34;Spell checking [&#34; + regionToBeChecked.getOffset() + &#34;-&#34; + (regionToBeChecked.getOffset() + regionToBeChecked.getLength()) + &#34;]&#34;); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$</TD></TR><TR><TD CLASS="l">318</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">319</TD><TD>                if (getDocument() != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">320</TD><TD>                        EditorsUI.getSpellingService().check(getDocument(), new IRegion[]{regionToBeChecked}, fSpellingContext, fProblemCollector, null);</TD></TR><TR><TD CLASS="l">321</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">322</TD><TD>                annotationsToAdd = fProblemCollector.getAnnotations();</TD></TR><TR CLASS="z"><TD CLASS="l">323</TD><TD>                fProblemCollector.clear();</TD></TR><TR><TD CLASS="l">324</TD><TD> </TD></TR><TR><TD CLASS="l">325</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">326</TD><TD>                if (annotationModel instanceof IAnnotationModelExtension) {</TD></TR><TR CLASS="z"><TD CLASS="l">327</TD><TD>                        IAnnotationModelExtension modelExtension = (IAnnotationModelExtension) annotationModel;</TD></TR><TR CLASS="z"><TD CLASS="l">328</TD><TD>                        Map annotationsToAddMap = new HashMap();</TD></TR><TR CLASS="z"><TD CLASS="l">329</TD><TD>                        for (int i = 0; i &lt; annotationsToAdd.length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">330</TD><TD>                                annotationsToAddMap.put(annotationsToAdd[i], ((TemporaryAnnotation) annotationsToAdd[i]).getPosition());</TD></TR><TR><TD CLASS="l">331</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">332</TD><TD>                        modelExtension.replaceAnnotations(annotationsToRemove, annotationsToAddMap);</TD></TR><TR><TD CLASS="l">333</TD><TD>                }</TD></TR><TR><TD CLASS="l">334</TD><TD> </TD></TR><TR><TD CLASS="l">335</TD><TD>                else {</TD></TR><TR CLASS="z"><TD CLASS="l">336</TD><TD>                        for (int j = 0; j &lt; annotationsToAdd.length; j++) {</TD></TR><TR CLASS="z"><TD CLASS="l">337</TD><TD>                                annotationModel.addAnnotation(annotationsToAdd[j], ((TemporaryAnnotation) annotationsToAdd[j]).getPosition());</TD></TR><TR><TD CLASS="l">338</TD><TD>                        }</TD></TR><TR CLASS="z"><TD CLASS="l">339</TD><TD>                        for (int j = 0; j &lt; annotationsToRemove.length; j++) {</TD></TR><TR CLASS="z"><TD CLASS="l">340</TD><TD>                                annotationModel.removeAnnotation(annotationsToRemove[j]);</TD></TR><TR><TD CLASS="l">341</TD><TD>                        }</TD></TR><TR><TD CLASS="l">342</TD><TD>                }</TD></TR><TR CLASS="z"><TD CLASS="l">343</TD><TD>        }</TD></TR><TR><TD CLASS="l">344</TD><TD> </TD></TR><TR><TD CLASS="l">345</TD><TD>        /**</TD></TR><TR><TD CLASS="l">346</TD><TD>         * @param partition</TD></TR><TR><TD CLASS="l"><A NAME="13">347</A></TD><TD>         * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)</TD></TR><TR><TD CLASS="l">348</TD><TD>         */</TD></TR><TR><TD CLASS="l">349</TD><TD> </TD></TR><TR><TD CLASS="l">350</TD><TD>        public void reconcile(IRegion partition) {</TD></TR><TR CLASS="c"><TD CLASS="l">351</TD><TD>                IDocument document = getDocument();</TD></TR><TR CLASS="c"><TD CLASS="l">352</TD><TD>                if (document != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">353</TD><TD>                        IAnnotationModel annotationModel = getAnnotationModel();</TD></TR><TR CLASS="c"><TD CLASS="l">354</TD><TD>                        if (annotationModel != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">355</TD><TD>                                spellCheck(partition, partition, annotationModel);</TD></TR><TR><TD CLASS="l">356</TD><TD>                        }</TD></TR><TR><TD CLASS="l"><A NAME="14">357</A></TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l">358</TD><TD>        }</TD></TR><TR><TD CLASS="l">359</TD><TD> </TD></TR><TR><TD CLASS="l">360</TD><TD>        public void setDocument(IDocument document) {</TD></TR><TR CLASS="c"><TD CLASS="l">361</TD><TD>                if (getDocument() != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">362</TD><TD>                        EditorsUI.getPreferenceStore().removePropertyChangeListener(fSpellCheckPreferenceListener);</TD></TR><TR><TD CLASS="l">363</TD><TD>                }</TD></TR><TR><TD CLASS="l">364</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">365</TD><TD>                super.setDocument(document);</TD></TR><TR><TD CLASS="l">366</TD><TD> </TD></TR><TR CLASS="c"><TD CLASS="l">367</TD><TD>                if (getDocument() != null) {</TD></TR><TR CLASS="c"><TD CLASS="l">368</TD><TD>                        EditorsUI.getPreferenceStore().addPropertyChangeListener(fSpellCheckPreferenceListener);</TD></TR><TR><TD CLASS="l">369</TD><TD>                }</TD></TR><TR CLASS="c"><TD CLASS="l">370</TD><TD>        }</TD></TR><TR><TD CLASS="l">371</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="8d.html">org.eclipse.wst.sse.ui.internal.spelling</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>