Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-06-27 13:52:35 -0400
committerMichael Valenta2003-06-27 13:52:35 -0400
commitf64ce10f31bfaab6416a640189c111593068b84b (patch)
treec30ae4eb75f93780e53adb55728af280c92f2e0a
parent578e1ad9ed4a0f4d801dfe464a73f6de4fd948db (diff)
downloadeclipse.platform.team-MV_Settings_Branch.tar.gz
eclipse.platform.team-MV_Settings_Branch.tar.xz
eclipse.platform.team-MV_Settings_Branch.zip
*** empty log message ***MV_Settings_Branch
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java38
2 files changed, 22 insertions, 27 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index d940676cd..f01fc8360 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -26,6 +26,8 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import org.eclipse.core.internal.settings.ExternalSettingsStore;
+import org.eclipse.core.internal.settings.ProjectSettingsStore;
import org.eclipse.core.internal.settings.SettingsStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -39,7 +41,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
@@ -957,7 +958,7 @@ public class CVSProviderPlugin extends Plugin {
public SettingsStore getPluginSettings() {
if (settings == null) {
- settings = new SettingsStore(getSettingsLocation().toFile());
+ settings = new ExternalSettingsStore(getSettingsLocation().toFile());
// populate the settings with any preferences
Preferences prefs = getPluginPreferences();
String[] names = prefs.propertyNames();
@@ -989,9 +990,11 @@ public class CVSProviderPlugin extends Plugin {
}
public IPath getSettingsLocation() {
+ // TODO: Could just be the state location
return getStateLocation().append("settings");
}
+ // TODO: Can't be in core.runtime because of reference to IProject
public SettingsStore getProjectSettings(IProject project) throws CoreException {
QualifiedName settingsPropertyName = new QualifiedName(ID, "settings");
Object cached = project.getSessionProperty(settingsPropertyName);
@@ -999,12 +1002,14 @@ public class CVSProviderPlugin extends Plugin {
return (SettingsStore)cached;
}
try {
- final SettingsStore store = new SettingsStore(project.getFolder(new Path(".settings").append(ID)).getLocation().toFile());
+ final SettingsStore store = new ProjectSettingsStore(project, this);
store.load();
project.setSessionProperty(settingsPropertyName, store);
store.addPropertyChangeListener(new Preferences.IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
try {
+ // TODO: Could be a change caused by a load from a repo
+ // which doesn't require a store
store.store(ID);
} catch (IOException e) {
log(IStatus.ERROR, "Error storing plugin settings", e);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 7009c72de..9d47c94d3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+import org.eclipse.core.internal.settings.SettingsStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileModificationValidator;
@@ -48,7 +49,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
@@ -129,11 +129,9 @@ public class CVSTeamProvider extends RepositoryProvider {
private static IFileModificationValidator fileModificationValidator;
// property used to indicate whether new directories should be discovered for the project
- private final static QualifiedName FETCH_ABSENT_DIRECTORIES_PROP_KEY =
- new QualifiedName("org.eclipse.team.cvs.core", "fetch_absent_directories"); //$NON-NLS-1$ //$NON-NLS-2$
+ private final static String FETCH_ABSENT_DIRECTORIES_SETTING = "fetch_absent_directories"; //$NON-NLS-1$
// property used to indicate whether the project is configured to use Watch/edit
- private final static QualifiedName WATCH_EDIT_PROP_KEY =
- new QualifiedName("org.eclipse.team.cvs.core", "watch_edit"); //$NON-NLS-1$ //$NON-NLS-2$
+ private final static String WATCH_EDIT_SETTING = "watch_edit"; //$NON-NLS-1$
private static IFileModificationValidator getPluggedInValidator() {
IExtension[] extensions = Platform.getPluginRegistry().getExtensionPoint(CVSProviderPlugin.ID, CVSProviderPlugin.PT_FILE_MODIFICATION_VALIDATOR).getExtensions();
@@ -1418,9 +1416,9 @@ public class CVSTeamProvider extends RepositoryProvider {
*/
public boolean getFetchAbsentDirectories() throws CVSException {
try {
- String property = getProject().getPersistentProperty(FETCH_ABSENT_DIRECTORIES_PROP_KEY);
- if (property == null) return CVSProviderPlugin.getPlugin().getFetchAbsentDirectories();
- return Boolean.valueOf(property).booleanValue();
+ IProject project = getProject();
+ SettingsStore store = CVSProviderPlugin.getPlugin().getProjectSettings(getProject());
+ return store.getBoolean(FETCH_ABSENT_DIRECTORIES_SETTING);
} catch (CoreException e) {
throw new CVSException(new CVSStatus(IStatus.ERROR, Policy.bind("CVSTeamProvider.errorGettingFetchProperty", project.getName()), e)); //$NON-NLS-1$
}
@@ -1428,11 +1426,13 @@ public class CVSTeamProvider extends RepositoryProvider {
/**
* Sets the fetchAbsentDirectories.
- * @param etchAbsentDirectories The etchAbsentDirectories to set
+ * @param fetchAbsentDirectories The fetchAbsentDirectories to set
*/
public void setFetchAbsentDirectories(boolean fetchAbsentDirectories) throws CVSException {
try {
- getProject().setPersistentProperty(FETCH_ABSENT_DIRECTORIES_PROP_KEY, fetchAbsentDirectories ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
+ IProject project = getProject();
+ SettingsStore store = CVSProviderPlugin.getPlugin().getProjectSettings(getProject());
+ store.setValue(FETCH_ABSENT_DIRECTORIES_SETTING, fetchAbsentDirectories);
} catch (CoreException e) {
throw new CVSException(new CVSStatus(IStatus.ERROR, Policy.bind("CVSTeamProvider.errorSettingFetchProperty", project.getName()), e)); //$NON-NLS-1$
}
@@ -1574,18 +1574,8 @@ public class CVSTeamProvider extends RepositoryProvider {
public boolean isWatchEditEnabled() throws CVSException {
try {
IProject project = getProject();
- String property = (String)project.getSessionProperty(WATCH_EDIT_PROP_KEY);
- if (property == null) {
- property = project.getPersistentProperty(WATCH_EDIT_PROP_KEY);
- if (property == null) {
- // The persistant property for the project was never set (i.e. old project)
- // Use the global preference to determinw if the project is using watch/edit
- return CVSProviderPlugin.getPlugin().isWatchEditEnabled();
- } else {
- project.setSessionProperty(WATCH_EDIT_PROP_KEY, property);
- }
- }
- return Boolean.valueOf(property).booleanValue();
+ SettingsStore store = CVSProviderPlugin.getPlugin().getProjectSettings(getProject());
+ return store.getBoolean(WATCH_EDIT_SETTING);
} catch (CoreException e) {
throw new CVSException(new CVSStatus(IStatus.ERROR, Policy.bind("CVSTeamProvider.errorGettingWatchEdit", project.getName()), e)); //$NON-NLS-1$
}
@@ -1594,8 +1584,8 @@ public class CVSTeamProvider extends RepositoryProvider {
public void setWatchEditEnabled(boolean enabled) throws CVSException {
try {
IProject project = getProject();
- project.setPersistentProperty(WATCH_EDIT_PROP_KEY, enabled ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
- project.setSessionProperty(WATCH_EDIT_PROP_KEY, enabled ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
+ SettingsStore store = CVSProviderPlugin.getPlugin().getProjectSettings(getProject());
+ store.setValue(WATCH_EDIT_SETTING, enabled);
} catch (CoreException e) {
throw new CVSException(new CVSStatus(IStatus.ERROR, Policy.bind("CVSTeamProvider.errorSettingWatchEdit", project.getName()), e)); //$NON-NLS-1$
}

Back to the top