KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > spelling > HtmlTagDictionary


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.internal.ui.text.spelling;
13
14 import java.net.URL JavaDoc;
15
16 import org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary;
17
18 import org.eclipse.jdt.internal.ui.text.javadoc.IHtmlTagConstants;
19
20 /**
21  * Dictionary for html tags.
22  *
23  * @since 3.0
24  */

25 public class HtmlTagDictionary extends AbstractSpellDictionary {
26
27     /*
28      * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
29      */

30     protected final URL JavaDoc getURL() {
31         return null;
32     }
33
34     /*
35      * @see org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
36      */

37     public boolean isCorrect(final String JavaDoc word) {
38
39         if (word.charAt(0) == IHtmlTagConstants.HTML_TAG_PREFIX)
40             return super.isCorrect(word);
41
42         return false;
43     }
44
45     /*
46      * @see org.eclipse.jdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
47      */

48     protected synchronized boolean load(final URL JavaDoc url) {
49
50         unload();
51
52         for (int index= 0; index < IHtmlTagConstants.HTML_GENERAL_TAGS.length; index++) {
53
54             hashWord(IHtmlTagConstants.HTML_TAG_PREFIX + IHtmlTagConstants.HTML_GENERAL_TAGS[index] + IHtmlTagConstants.HTML_TAG_POSTFIX);
55             hashWord(IHtmlTagConstants.HTML_CLOSE_PREFIX + IHtmlTagConstants.HTML_GENERAL_TAGS[index] + IHtmlTagConstants.HTML_TAG_POSTFIX);
56         }
57         return true;
58     }
59     
60     /*
61      * @see org.eclipse.jdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#stripNonLetters(java.lang.String)
62      * @since 3.3
63      */

64     protected String JavaDoc stripNonLetters(String JavaDoc word) {
65         return word;
66     }
67
68 }
69
Popular Tags