01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.core.text.cheatsheet.simple;
11:
12: import java.util.HashSet;
13:
14: import org.eclipse.pde.internal.core.text.DocumentTextNode;
15: import org.eclipse.pde.internal.core.util.PDETextHelper;
16:
17: /**
18: * SimpleCSDocumentTextNode
19: *
20: */
21: public class SimpleCSDocumentTextNode extends DocumentTextNode {
22:
23: private static final long serialVersionUID = 1L;
24:
25: private static final HashSet TAG_EXCEPTIONS = new HashSet(3);
26:
27: static {
28: TAG_EXCEPTIONS.add("b"); //$NON-NLS-1$
29: TAG_EXCEPTIONS.add("/b"); //$NON-NLS-1$
30: TAG_EXCEPTIONS.add("br/"); //$NON-NLS-1$
31: }
32:
33: /**
34: *
35: */
36: public SimpleCSDocumentTextNode() {
37: super ();
38: }
39:
40: /* (non-Javadoc)
41: * @see org.eclipse.pde.internal.core.text.DocumentTextNode#write()
42: */
43: public String write() {
44: String content = getText().trim();
45: return PDETextHelper.translateWriteText(content,
46: TAG_EXCEPTIONS, SUBSTITUTE_CHARS);
47: }
48:
49: }
|