KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > product > ConfigurationFileInfo


1 /*******************************************************************************
2  * Copyright (c) 2005 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.product;
12
13 import java.io.PrintWriter JavaDoc;
14
15 import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo;
16 import org.eclipse.pde.internal.core.iproduct.IProductModel;
17 import org.w3c.dom.Element JavaDoc;
18 import org.w3c.dom.Node JavaDoc;
19
20
21 public class ConfigurationFileInfo extends ProductObject implements
22         IConfigurationFileInfo {
23
24     private static final long serialVersionUID = 1L;
25     
26     private String JavaDoc fUse;
27
28     private String JavaDoc fPath;
29
30     public ConfigurationFileInfo(IProductModel model) {
31         super(model);
32     }
33     
34     /* (non-Javadoc)
35      * @see org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo#setPath(java.lang.String)
36      */

37     public void setPath(String JavaDoc path) {
38         String JavaDoc old = fPath;
39         fPath = path;
40         if (isEditable())
41             firePropertyChanged(P_PATH, old, fPath);
42     }
43
44     /* (non-Javadoc)
45      * @see org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo#getPath()
46      */

47     public String JavaDoc getPath() {
48         return fPath;
49     }
50
51     /* (non-Javadoc)
52      * @see org.eclipse.pde.internal.core.iproduct.IProductObject#parse(org.w3c.dom.Node)
53      */

54     public void parse(Node JavaDoc node) {
55         if (node.getNodeType() == Node.ELEMENT_NODE) {
56             Element JavaDoc element = (Element JavaDoc)node;
57             fPath = element.getAttribute(P_PATH);
58             fUse = element.getAttribute(P_USE);
59         }
60     }
61
62     /* (non-Javadoc)
63      * @see org.eclipse.pde.core.IWritable#write(java.lang.String, java.io.PrintWriter)
64      */

65     public void write(String JavaDoc indent, PrintWriter JavaDoc writer) {
66         writer.print(indent + "<configIni"); //$NON-NLS-1$
67
if (fUse != null)
68             writer.print(" " + P_USE + "=\"" + fUse + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
69
if (fPath != null && fPath.trim().length() > 0)
70             writer.print(" " + P_PATH + "=\"" + getWritableString(fPath.trim()) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
71
writer.println("/>"); //$NON-NLS-1$
72
}
73
74
75     /* (non-Javadoc)
76      * @see org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo#setUse(java.lang.String)
77      */

78     public void setUse(String JavaDoc use) {
79         String JavaDoc old = fUse;
80         fUse = use;
81         if (isEditable())
82             firePropertyChanged(P_USE, old, fUse);
83     }
84
85
86     /* (non-Javadoc)
87      * @see org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo#getUse()
88      */

89     public String JavaDoc getUse() {
90         return fUse;
91     }
92
93 }
94
Popular Tags