Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 202384 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/internal/resources/Project.java (-2 / +1 lines)
Lines 15-22 Link Here
15
 *******************************************************************************/
15
 *******************************************************************************/
16
package org.eclipse.core.internal.resources;
16
package org.eclipse.core.internal.resources;
17
17
18
import java.util.LinkedHashSet;
19
20
import java.net.URI;
18
import java.net.URI;
21
import java.util.*;
19
import java.util.*;
22
import org.eclipse.core.filesystem.*;
20
import org.eclipse.core.filesystem.*;
Lines 1169-1174 Link Here
1169
		} finally {
1167
		} finally {
1170
			monitor.done();
1168
			monitor.done();
1171
		}
1169
		}
1170
		((ProjectPreferences) Platform.getPreferencesService().getRootNode().node(ProjectScope.SCOPE).node(getName())).initialize();
1172
	}
1171
	}
1173
1172
1174
	/* (non-Javadoc)
1173
	/* (non-Javadoc)
(-)src/org/eclipse/core/internal/resources/ProjectPreferences.java (-16 / +12 lines)
Lines 70-76 Link Here
70
	 */
70
	 */
71
	protected static Set loadedNodes = Collections.synchronizedSet(new HashSet());
71
	protected static Set loadedNodes = Collections.synchronizedSet(new HashSet());
72
	private IFile file;
72
	private IFile file;
73
	private boolean initialized = false;
74
	/**
73
	/**
75
	 * Flag indicating that this node is currently reading values from disk,
74
	 * Flag indicating that this node is currently reading values from disk,
76
	 * to avoid flushing during a read.
75
	 * to avoid flushing during a read.
Lines 341-361 Link Here
341
		if (segmentCount > 2)
340
		if (segmentCount > 2)
342
			qualifier = getSegment(path, 2);
341
			qualifier = getSegment(path, 2);
343
342
344
		if (segmentCount != 2)
343
		initialize();
345
			return;
346
347
		// else segmentCount == 2 so we initialize the children
348
		if (initialized)
349
			return;
350
		try {
351
			synchronized (this) {
352
				String[] names = computeChildren();
353
				for (int i = 0; i < names.length; i++)
354
					addChild(names[i], null);
355
			}
356
		} finally {
357
			initialized = true;
358
		}
359
	}
344
	}
360
345
361
	/*
346
	/*
Lines 440-445 Link Here
440
		return new ProjectPreferences(nodeParent, nodeName);
425
		return new ProjectPreferences(nodeParent, nodeName);
441
	}
426
	}
442
427
428
	protected void initialize() {
429
		if (segmentCount == 2) {
430
			// segmentCount == 2 so we initialize the children
431
			synchronized (this) {
432
				String[] names = computeChildren();
433
				for (int i = 0; i < names.length; i++)
434
					addChild(names[i], null);
435
			}
436
		}
437
	}
438
443
	protected boolean isAlreadyLoaded(IEclipsePreferences node) {
439
	protected boolean isAlreadyLoaded(IEclipsePreferences node) {
444
		return loadedNodes.contains(node.absolutePath());
440
		return loadedNodes.contains(node.absolutePath());
445
	}
441
	}
(-)src/org/eclipse/core/resources/ProjectScope.java (-2 / +16 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2006 IBM Corporation and others.
2
 * Copyright (c) 2004, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-20 Link Here
15
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
16
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
17
import org.eclipse.core.runtime.preferences.IScopeContext;
17
import org.eclipse.core.runtime.preferences.IScopeContext;
18
import org.osgi.service.prefs.BackingStoreException;
19
import org.osgi.service.prefs.Preferences;
18
20
19
/**
21
/**
20
 * Object representing the project scope in the Eclipse preferences
22
 * Object representing the project scope in the Eclipse preferences
Lines 64-70 Link Here
64
	public IEclipsePreferences getNode(String qualifier) {
66
	public IEclipsePreferences getNode(String qualifier) {
65
		if (qualifier == null)
67
		if (qualifier == null)
66
			throw new IllegalArgumentException();
68
			throw new IllegalArgumentException();
67
		return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(SCOPE).node(context.getName()).node(qualifier);
69
		// be careful looking up for our node so not to create any nodes as side effect
70
		Preferences prefs = Platform.getPreferencesService().getRootNode().node(SCOPE);
71
		try {
72
			if (!prefs.nodeExists(context.getName()))
73
				return null;
74
			prefs = prefs.node(context.getName());
75
			if (!prefs.nodeExists(qualifier))
76
				return null;
77
			return (IEclipsePreferences) prefs.node(qualifier);
78
		} catch (BackingStoreException e) {
79
			//ignore
80
		}
81
		return null;
68
	}
82
	}
69
83
70
	/*
84
	/*
(-)src/org/eclipse/ui/internal/ide/LineDelimiterEditor.java (-3 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 162-169 Link Here
162
	 * @return the currently stored encoding
162
	 * @return the currently stored encoding
163
	 */
163
	 */
164
	public String getStoredValue() {
164
	public String getStoredValue() {
165
		IScopeContext[] scopeContext = new IScopeContext[] { getScopeContext() };
165
		IScopeContext scopeContext = getScopeContext();
166
		IEclipsePreferences node = scopeContext[0].getNode(Platform.PI_RUNTIME);
166
		IEclipsePreferences node = scopeContext.getNode(Platform.PI_RUNTIME);
167
		if (node == null)
168
			return null;
167
		return node.get(Platform.PREF_LINE_SEPARATOR, null);
169
		return node.get(Platform.PREF_LINE_SEPARATOR, null);
168
	}
170
	}
169
171

Return to bug 202384