KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > schema > SchemaEnumeration


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 package org.eclipse.pde.internal.core.schema;
12
13 import java.io.PrintWriter JavaDoc;
14
15 import org.eclipse.pde.internal.core.ischema.ISchemaEnumeration;
16 import org.eclipse.pde.internal.core.ischema.ISchemaObject;
17
18 public class SchemaEnumeration extends SchemaObject implements ISchemaEnumeration {
19
20     private static final long serialVersionUID = 1L;
21
22     public SchemaEnumeration(ISchemaObject parent, String JavaDoc name) {
23         super(parent, name);
24     }
25
26     public void write(String JavaDoc indent, PrintWriter JavaDoc writer) {
27         writer.println(indent + "<enumeration value=\"" + getName() + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
28
String JavaDoc description = getDescription();
29         if (description != null)
30             description.trim();
31         if (description != null && description.length() > 0) {
32             String JavaDoc indent2 = indent + Schema.INDENT;
33             String JavaDoc indent3 = indent2 + Schema.INDENT;
34             writer.println(indent2 + "<annotation>"); //$NON-NLS-1$
35
writer.println(indent3 + "<documentation>"); //$NON-NLS-1$
36
writer.println(indent3 + description);
37             writer.println(indent3 + "</documentation>"); //$NON-NLS-1$
38
writer.println(indent2 + "</annotation>"); //$NON-NLS-1$
39
}
40         writer.println(indent + "</enumeration>"); //$NON-NLS-1$
41
}
42 }
43
Popular Tags