KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > project > ProjectData


1 package org.antlr.works.project;
2
3 import org.antlr.works.components.project.CContainerProject;
4
5 import java.util.HashMap JavaDoc;
6 import java.util.Map JavaDoc;
7 /*
8
9 [The "BSD licence"]
10 Copyright (c) 2005-2006 Jean Bovet
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
16
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22 3. The name of the author may not be used to endorse or promote products
23 derived from this software without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
36 */

37
38 public class ProjectData {
39
40     protected static final String JavaDoc KEY_SOURCE_PATH = "KEY_SOURCE_PATH";
41     protected static final String JavaDoc KEY_RUN_PARAMETERS = "KEY_RUN_PARAMETERS";
42     protected static final String JavaDoc KEY_SHOW_BEFORE_RUNNING = "KEY_SHOW_BEFORE_RUNNING";
43
44     protected static final String JavaDoc KEY_EDITORZONE_DATA = "KEY_EDITORZONE_DATA";
45     protected static final String JavaDoc KEY_EXPLORER_DATA = "KEY_EXPLORER_DATA";
46     protected static final String JavaDoc KEY_BUILD_LIST = "KEY_BUILD_LIST";
47     protected static final String JavaDoc KEY_CONTAINER_DATA = "KEY_CONTAINER_DATA";
48
49     protected CContainerProject project;
50
51     protected Map JavaDoc data = new HashMap JavaDoc();
52
53     public ProjectData() {
54         setShowBeforeRunning(true);
55     }
56
57     public void setProject(CContainerProject project) {
58         this.project = project;
59     }
60
61     public void setSourcePath(String JavaDoc path) {
62         data.put(KEY_SOURCE_PATH, path);
63     }
64
65     public String JavaDoc getSourcePath() {
66         return (String JavaDoc)data.get(KEY_SOURCE_PATH);
67     }
68
69     public void setRunParametersString(String JavaDoc s) {
70         data.put(KEY_RUN_PARAMETERS, s);
71     }
72
73     public String JavaDoc getRunParametersString() {
74         return (String JavaDoc)data.get(KEY_RUN_PARAMETERS);
75     }
76
77     public void setShowBeforeRunning(boolean flag) {
78         data.put(KEY_SHOW_BEFORE_RUNNING, Boolean.valueOf(flag));
79     }
80
81     public boolean getShowBeforeRunning() {
82         Boolean JavaDoc b = (Boolean JavaDoc)data.get(KEY_SHOW_BEFORE_RUNNING);
83         if(b != null)
84             return b.booleanValue();
85         else
86             return false;
87     }
88
89     public void setBuildListData(Object JavaDoc inData) {
90         data.put(KEY_BUILD_LIST, inData);
91     }
92
93     public Object JavaDoc getBuildListData() {
94         return data.get(KEY_BUILD_LIST);
95     }
96
97     public void setExplorerData(Object JavaDoc inData) {
98         data.put(KEY_EXPLORER_DATA, inData);
99     }
100
101     public Object JavaDoc getExplorerData() {
102         return data.get(KEY_EXPLORER_DATA);
103     }
104
105     public void setEditorZoneData(Object JavaDoc inData) {
106         data.put(KEY_EDITORZONE_DATA, inData);
107     }
108
109     public Object JavaDoc getEditorZoneData() {
110         return data.get(KEY_EDITORZONE_DATA);
111     }
112
113     public void setContainerData(Map JavaDoc inData) {
114         data.put(KEY_CONTAINER_DATA, inData);
115     }
116
117     public Object JavaDoc getContainerData() {
118         return data.get(KEY_CONTAINER_DATA);
119     }
120
121     /** Set the data stored on disk to our new class
122      *
123      */

124
125     public void setPersistentData(Map JavaDoc inData) {
126         data.clear();
127         data.putAll(inData);
128     }
129
130     /** Returns the data that will be saved on the disk. Make
131      * sure to use Java only structure to be isolated from
132      * any future changes.
133      */

134
135     public Map JavaDoc getPersistentData() {
136         return data;
137     }
138
139 }
140
Popular Tags