1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

return IEclipsePreferences

This commit is contained in:
Alena Laskavaia 2011-03-11 03:17:19 +00:00
parent 8702144ba5
commit c2dfefd6ea

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia * Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -18,19 +18,19 @@ import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.core.param.IProblemPreference; import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.Preferences; import org.osgi.service.prefs.Preferences;
/** /**
* Helper class to load/save problem profile settings in persistent storage * Helper class to load/save problem profile settings in persistent storage
* *
*/ */
public class CodanPreferencesLoader { public class CodanPreferencesLoader {
private IProblemProfile baseModel; private IProblemProfile baseModel;
/** /**
* Constructor * Constructor
* *
* @param profile - problem profile to work with * @param profile - problem profile to work with
*/ */
public CodanPreferencesLoader(IProblemProfile profile) { public CodanPreferencesLoader(IProblemProfile profile) {
@ -45,7 +45,7 @@ public class CodanPreferencesLoader {
/** /**
* Sets the profile for this class * Sets the profile for this class
* *
* @param profile * @param profile
*/ */
public void setInput(IProblemProfile profile) { public void setInput(IProblemProfile profile) {
@ -113,7 +113,7 @@ public class CodanPreferencesLoader {
/** /**
* Takes string values from storePreferences and applies them to the problem * Takes string values from storePreferences and applies them to the problem
* profile * profile
* *
* @param storePreferences * @param storePreferences
*/ */
public void load(Preferences storePreferences) { public void load(Preferences storePreferences) {
@ -131,7 +131,7 @@ public class CodanPreferencesLoader {
/** /**
* Takes string values of the problem preferences from storePreferences * Takes string values of the problem preferences from storePreferences
* and applies them to the problem profile * and applies them to the problem profile
* *
* @param problemId * @param problemId
* @param storePreferences * @param storePreferences
*/ */
@ -153,14 +153,14 @@ public class CodanPreferencesLoader {
/** /**
* Return preference node (osgi preferences) for the project * Return preference node (osgi preferences) for the project
* *
* @param project * @param project
* @return project preferences node * @return project preferences node
*/ */
public static Preferences getProjectNode(IProject project) { public static IEclipsePreferences getProjectNode(IProject project) {
if (!project.exists()) if (!project.exists())
return null; return null;
Preferences prefNode = new ProjectScope(project).getNode(CodanCorePlugin.PLUGIN_ID); IEclipsePreferences prefNode = new ProjectScope(project).getNode(CodanCorePlugin.PLUGIN_ID);
if (prefNode == null) if (prefNode == null)
return null; return null;
return prefNode; return prefNode;
@ -168,11 +168,11 @@ public class CodanPreferencesLoader {
/** /**
* Return preference node (osgi preferences) for the workspace * Return preference node (osgi preferences) for the workspace
* *
* @return project preferences node * @return project preferences node
*/ */
public static Preferences getWorkspaceNode() { public static IEclipsePreferences getWorkspaceNode() {
Preferences prefNode = new InstanceScope().getNode(CodanCorePlugin.PLUGIN_ID); IEclipsePreferences prefNode = CodanCorePlugin.getDefault().getStorePreferences();
if (prefNode == null) if (prefNode == null)
return null; return null;
return prefNode; return prefNode;
@ -181,7 +181,7 @@ public class CodanPreferencesLoader {
/** /**
* Name of the preference key for the root problem preference in the osgi * Name of the preference key for the root problem preference in the osgi
* preferences * preferences
* *
* @param id - problem id * @param id - problem id
* @return top level preference id * @return top level preference id
*/ */