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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
12 package net.sourceforge.phpdt.internal.ui.text.spelling.engine;
14 import java.io.FileWriter;
15 import java.io.IOException;
19 * Persistent modifiable word-list based dictionary.
23 public class PersistentSpellDictionary extends AbstractSpellDictionary {
25 /** The word list location */
26 private final URL fLocation;
29 * Creates a new persistent spell dictionary.
32 * The URL of the word list for this dictionary
34 public PersistentSpellDictionary(final URL url) {
39 * @see net.sourceforge.phpdt.ui.text.spelling.engine.AbstractSpellDictionary#acceptsWords()
41 public boolean acceptsWords() {
46 * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.ISpellDictionary#addWord(java.lang.String)
48 public void addWord(final String word) {
50 if (!isCorrect(word)) {
55 final FileWriter writer = new FileWriter(fLocation.getPath(),
58 writer.write("\n"); //$NON-NLS-1$
61 } catch (IOException exception) {
68 * @see net.sourceforge.phpdt.internal.ui.text.spelling.engine.AbstractSpellDictionary#getURL()
70 protected final URL getURL() {