1 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 21 public class WorkspaceDescription extends ModelObject implements IWorkspaceDescription { 22 protected boolean autoBuilding; 23 protected String [] buildOrder; 24 protected volatile long fileStateLongevity; 26 protected int maxBuildIterations; 27 protected int maxFileStates; 28 protected volatile long maxFileStateSize; 30 private volatile long snapshotInterval; 32 protected int operationsPerSnapshot; 33 protected long deltaExpiration; 34 35 public WorkspaceDescription(String name) { 36 super(name); 37 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 52 public String [] getBuildOrder() { 53 return getBuildOrder(true); 54 } 55 56 public String [] getBuildOrder(boolean makeCopy) { 57 if (buildOrder == null) 58 return null; 59 return makeCopy ? (String []) 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 73 public long getFileStateLongevity() { 74 return fileStateLongevity; 75 } 76 77 80 public int getMaxBuildIterations() { 81 return maxBuildIterations; 82 } 83 84 87 public int getMaxFileStates() { 88 return maxFileStates; 89 } 90 91 94 public long getMaxFileStateSize() { 95 return maxFileStateSize; 96 } 97 98 public int getOperationsPerSnapshot() { 99 return operationsPerSnapshot; 100 } 101 102 105 public long getSnapshotInterval() { 106 return snapshotInterval; 107 } 108 109 public void internalSetBuildOrder(String [] value) { 110 buildOrder = value; 111 } 112 113 116 public boolean isAutoBuilding() { 117 return autoBuilding; 118 } 119 120 public void setOperationsPerSnapshot(int value) { 121 operationsPerSnapshot = value; 122 } 123 124 127 public void setAutoBuilding(boolean value) { 128 autoBuilding = value; 129 } 130 131 134 public void setBuildOrder(String [] value) { 135 buildOrder = (value == null) ? null : (String []) value.clone(); 136 } 137 138 141 public void setFileStateLongevity(long time) { 142 fileStateLongevity = time; 143 } 144 145 148 public void setMaxBuildIterations(int number) { 149 maxBuildIterations = number; 150 } 151 152 155 public void setMaxFileStates(int number) { 156 maxFileStates = number; 157 } 158 159 162 public void setMaxFileStateSize(long size) { 163 maxFileStateSize = size; 164 } 165 166 169 public void setSnapshotInterval(long snapshotInterval) { 170 this.snapshotInterval = snapshotInterval; 171 } 172 } 173 | Popular Tags |