KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > resources > WorkspaceDescription


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.core.internal.resources;
12
13 import org.eclipse.core.resources.IWorkspaceDescription;
14 import org.eclipse.core.resources.ResourcesPlugin;
15 import org.eclipse.core.runtime.preferences.DefaultScope;
16 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
17
18 /**
19  * @see IWorkspaceDescription
20  */

21 public class WorkspaceDescription extends ModelObject implements IWorkspaceDescription {
22     protected boolean autoBuilding;
23     protected String JavaDoc[] buildOrder;
24     // thread safety: (Concurrency004)
25
protected volatile long fileStateLongevity;
26     protected int maxBuildIterations;
27     protected int maxFileStates;
28     // thread safety: (Concurrency004)
29
protected volatile long maxFileStateSize;
30     // thread safety: (Concurrency004)
31
private volatile long snapshotInterval;
32     protected int operationsPerSnapshot;
33     protected long deltaExpiration;
34
35     public WorkspaceDescription(String JavaDoc name) {
36         super(name);
37         // initialize based on the values in the default preferences
38
IEclipsePreferences node = new DefaultScope().getNode(ResourcesPlugin.PI_RESOURCES);
39         autoBuilding = node.getBoolean(ResourcesPlugin.PREF_AUTO_BUILDING, PreferenceInitializer.PREF_AUTO_BUILDING_DEFAULT);
40         fileStateLongevity = node.getLong(ResourcesPlugin.PREF_FILE_STATE_LONGEVITY, PreferenceInitializer.PREF_FILE_STATE_LONGEVITY_DEFAULT);
41         maxBuildIterations = node.getInt(ResourcesPlugin.PREF_MAX_BUILD_ITERATIONS, PreferenceInitializer.PREF_MAX_BUILD_ITERATIONS_DEFAULT);
42         maxFileStates = node.getInt(ResourcesPlugin.PREF_MAX_FILE_STATES, PreferenceInitializer.PREF_MAX_FILE_STATES_DEFAULT);
43         maxFileStateSize = node.getLong(ResourcesPlugin.PREF_MAX_FILE_STATE_SIZE, PreferenceInitializer.PREF_MAX_FILE_STATE_SIZE_DEFAULT);
44         snapshotInterval = node.getLong(ResourcesPlugin.PREF_SNAPSHOT_INTERVAL, PreferenceInitializer.PREF_SNAPSHOT_INTERVAL_DEFAULT);
45         operationsPerSnapshot = node.getInt(PreferenceInitializer.PREF_OPERATIONS_PER_SNAPSHOT, PreferenceInitializer.PREF_OPERATIONS_PER_SNAPSHOT_DEFAULT);
46         deltaExpiration = node.getLong(PreferenceInitializer.PREF_DELTA_EXPIRATION, PreferenceInitializer.PREF_DELTA_EXPIRATION_DEFAULT);
47     }
48
49     /**
50      * @see IWorkspaceDescription#getBuildOrder()
51      */

52     public String JavaDoc[] getBuildOrder() {
53         return getBuildOrder(true);
54     }
55
56     public String JavaDoc[] getBuildOrder(boolean makeCopy) {
57         if (buildOrder == null)
58             return null;
59         return makeCopy ? (String JavaDoc[]) buildOrder.clone() : buildOrder;
60     }
61
62     public long getDeltaExpiration() {
63         return deltaExpiration;
64     }
65
66     public void setDeltaExpiration(long value) {
67         deltaExpiration = value;
68     }
69
70     /**
71      * @see IWorkspaceDescription#getFileStateLongevity()
72      */

73     public long getFileStateLongevity() {
74         return fileStateLongevity;
75     }
76
77     /**
78      * @see IWorkspaceDescription#getMaxBuildIterations()
79      */

80     public int getMaxBuildIterations() {
81         return maxBuildIterations;
82     }
83
84     /**
85      * @see IWorkspaceDescription#getMaxFileStates()
86      */

87     public int getMaxFileStates() {
88         return maxFileStates;
89     }
90
91     /**
92      * @see IWorkspaceDescription#getMaxFileStateSize()
93      */

94     public long getMaxFileStateSize() {
95         return maxFileStateSize;
96     }
97
98     public int getOperationsPerSnapshot() {
99         return operationsPerSnapshot;
100     }
101
102     /**
103      * @see IWorkspaceDescription#getSnapshotInterval()
104      */

105     public long getSnapshotInterval() {
106         return snapshotInterval;
107     }
108
109     public void internalSetBuildOrder(String JavaDoc[] value) {
110         buildOrder = value;
111     }
112
113     /**
114      * @see IWorkspaceDescription#isAutoBuilding()
115      */

116     public boolean isAutoBuilding() {
117         return autoBuilding;
118     }
119
120     public void setOperationsPerSnapshot(int value) {
121         operationsPerSnapshot = value;
122     }
123
124     /**
125      * @see IWorkspaceDescription#setAutoBuilding(boolean)
126      */

127     public void setAutoBuilding(boolean value) {
128         autoBuilding = value;
129     }
130
131     /**
132      * @see IWorkspaceDescription#setBuildOrder(String[])
133      */

134     public void setBuildOrder(String JavaDoc[] value) {
135         buildOrder = (value == null) ? null : (String JavaDoc[]) value.clone();
136     }
137
138     /**
139      * @see IWorkspaceDescription#setFileStateLongevity(long)
140      */

141     public void setFileStateLongevity(long time) {
142         fileStateLongevity = time;
143     }
144
145     /**
146      * @see IWorkspaceDescription#setMaxBuildIterations(int)
147      */

148     public void setMaxBuildIterations(int number) {
149         maxBuildIterations = number;
150     }
151
152     /**
153      * @see IWorkspaceDescription#setMaxFileStates(int)
154      */

155     public void setMaxFileStates(int number) {
156         maxFileStates = number;
157     }
158
159     /**
160      * @see IWorkspaceDescription#setMaxFileStateSize(long)
161      */

162     public void setMaxFileStateSize(long size) {
163         maxFileStateSize = size;
164     }
165
166     /**
167      * @see IWorkspaceDescription#setSnapshotInterval(long)
168      */

169     public void setSnapshotInterval(long snapshotInterval) {
170         this.snapshotInterval = snapshotInterval;
171     }
172 }
173
Popular Tags