617f537625297c1cd7c62baaaca636440256568f
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / text / spelling / HtmlTagDictionary.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.internal.ui.text.spelling;
13
14 import java.net.URL;
15
16 import net.sourceforge.phpdt.internal.ui.text.phpdoc.IHtmlTagConstants;
17 import net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary;
18
19 /**
20  * Dictionary for html tags.
21  * 
22  * @since 3.0
23  */
24 public class HtmlTagDictionary extends AbstractSpellDictionary implements
25                 IHtmlTagConstants {
26
27         /*
28          * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getName()
29          */
30         protected final URL getURL() {
31                 return null;
32         }
33
34         /*
35          * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#isCorrect(java.lang.String)
36          */
37         public boolean isCorrect(final String word) {
38
39                 if (word.charAt(0) == HTML_TAG_PREFIX)
40                         return super.isCorrect(word);
41
42                 return false;
43         }
44
45         /*
46          * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#load(java.net.URL)
47          */
48         protected boolean load(final URL url) {
49
50                 unload();
51
52                 for (int index = 0; index < HTML_GENERAL_TAGS.length; index++) {
53
54                         hashWord(HTML_TAG_PREFIX + HTML_GENERAL_TAGS[index]
55                                         + HTML_TAG_POSTFIX);
56                         hashWord(HTML_CLOSE_PREFIX + HTML_GENERAL_TAGS[index]
57                                         + HTML_TAG_POSTFIX);
58                 }
59                 return true;
60         }
61 }