001: /*
002: * This program is free software; you can redistribute it and/or
003: * modify it under the terms of the GNU General Public License
004: * as published by the Free Software Foundation; either version 2
005: * of the License, or any later version.
006: *
007: * This program is distributed in the hope that it will be useful,
008: * but WITHOUT ANY WARRANTY; without even the implied warranty of
009: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
010: * GNU General Public License for more details.
011: *
012: * You should have received a copy of the GNU General Public License
013: * along with this program; if not, write to the Free Software
014: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
015: */
016: package org.acm.seguin.ide.jedit;
017:
018: import java.io.File;
019: import java.io.IOException;
020:
021: import java.util.Set;
022: import java.util.HashMap;
023: import java.util.Iterator;
024: import java.util.ArrayList;
025: import java.util.Properties;
026: import java.util.Collection;
027: import java.util.Collections;
028:
029: import javax.swing.Icon;
030:
031: import org.gjt.sp.util.Log;
032: import org.gjt.sp.jedit.GUIUtilities;
033:
034: /**
035: * <p>
036: *
037: * Note: this class is not thread safe!</p>
038: *
039: *@author <a href="mailto:JRefactoryPlugin@ladyshot.demon.co.uk">Mike
040: * Atkinson</a>
041: *@created 23 July 2003
042: *@version $Id: UMLProject.java,v 1.1 2003/09/17 19:52:32 mikeatkinson Exp $
043: *@since 0.0.1
044: */
045: public class UMLProject {
046:
047: private final static Icon projectIcon = GUIUtilities
048: .loadIcon("DriveSmall.png");
049:
050: private ArrayList listeners;
051: private Properties properties;
052: private String name = "";
053: private String root = "";
054:
055: /**
056: * Constructor for the UMLProject object
057: *
058: *@param name Description of the Parameter
059: */
060: public UMLProject(String name) {
061: listeners = new ArrayList();
062: properties = new Properties();
063: }
064:
065: /**
066: * Gets the name attribute of the UMLProject object
067: *
068: *@return The name value
069: */
070: public String getName() {
071: return name;
072: }
073:
074: /**
075: * Sets the name attribute of the UMLProject object
076: *
077: *@param name The new name value
078: */
079: public void setName(String name) {
080: this .name = name;
081: }
082:
083: /**
084: * Gets the rootPath attribute of the UMLProject object
085: *
086: *@return The rootPath value
087: */
088: public String getRootPath() {
089: return root;
090: }
091:
092: /**
093: * Sets the rootPath attribute of the UMLProject object
094: *
095: *@param root The new rootPath value
096: */
097: public void setRootPath(String root) {
098: this .root = root;
099: }
100:
101: /**
102: * Returns the property set for the project.
103: *
104: *@param property Description of the Parameter
105: *@return The property value
106: */
107: public String getProperty(String property) {
108: return properties.getProperty(property);
109: }
110:
111: /**
112: * Sets a property.
113: *
114: *@param name The new property value
115: *@param value The new property value
116: *@return The old value for the property (can be null).
117: */
118: public String setProperty(String name, String value) {
119: String old = properties.getProperty(name);
120: properties.setProperty(name, value);
121: return old;
122: }
123:
124: /**
125: * Returns a set containing all property names for this project.
126: *
127: *@return The propertyNames value
128: */
129: public Set getPropertyNames() {
130: return properties.keySet();
131: }
132:
133: /**
134: * Removes the given property from the project.
135: *
136: *@param property Description of the Parameter
137: *@return Description of the Return Value
138: */
139: public Object removeProperty(String property) {
140: return properties.remove(property);
141: }
142:
143: /**
144: * Return the project's property set.
145: *
146: *@return The properties value
147: */
148: public Properties getProperties() {
149: return properties;
150: }
151:
152: /**
153: * Returns the icon to be shown on the tree next to the node name.
154: *
155: *@param expanded If the node is currently expanded or not.
156: *@return The icon value
157: */
158: public Icon getIcon(boolean expanded) {
159: return projectIcon;
160: }
161:
162: /**
163: * Returns a string representation of the current node.
164: *
165: *@return Description of the Return Value
166: */
167: public String toString() {
168: return "UMLProject []";
169: }
170:
171: }
|