|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2004, 2006 IBM Corporation and others. |
2 |
* Copyright (c) 2004, 2007 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 107-120
Link Here
|
| 107 |
// ignore |
107 |
// ignore |
| 108 |
} |
108 |
} |
| 109 |
|
109 |
|
| 110 |
// if the node was loaded we need to clear the values and remove |
110 |
// clear the preferences |
| 111 |
// its reference from the parent (don't save it though) |
111 |
nodeDeleted(projectNode.node(qualifier)); |
| 112 |
// otherwise just remove the reference from the parent |
|
|
| 113 |
String childPath = projectNode.absolutePath() + IPath.SEPARATOR + qualifier; |
| 114 |
if (projectNode.isAlreadyLoaded(childPath)) |
| 115 |
removeNode(projectNode.node(qualifier)); |
| 116 |
else |
| 117 |
projectNode.removeNode(qualifier); |
| 118 |
|
112 |
|
| 119 |
// notifies the CharsetManager if needed |
113 |
// notifies the CharsetManager if needed |
| 120 |
if (qualifier.equals(ResourcesPlugin.PI_RESOURCES)) |
114 |
if (qualifier.equals(ResourcesPlugin.PI_RESOURCES)) |
|
Lines 257-262
Link Here
|
| 257 |
i.remove(); |
251 |
i.remove(); |
| 258 |
} |
252 |
} |
| 259 |
} |
253 |
} |
|
|
254 |
|
| 255 |
private static void clearAll(Preferences node) throws BackingStoreException { |
| 256 |
node.clear(); |
| 257 |
String[] names = node.childrenNames(); |
| 258 |
for (int i = 0; i < names.length; i++) { |
| 259 |
clearAll(node.node(names[i])); |
| 260 |
} |
| 261 |
} |
| 262 |
|
| 263 |
static void nodeDeleted(Preferences node) throws CoreException { |
| 264 |
// if the underlying properties file was deleted, clear the values and remove |
| 265 |
// it from the list of loaded classes keep the node as it might still be referenced |
| 266 |
try { |
| 267 |
clearAll(node); |
| 268 |
} catch (BackingStoreException e) { |
| 269 |
String message = NLS.bind(Messages.preferences_clearNodeException, node.absolutePath()); |
| 270 |
IStatus status = new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, IStatus.ERROR, message, e); |
| 271 |
throw new CoreException(status); |
| 272 |
} |
| 273 |
String path = node.absolutePath(); |
| 274 |
for (Iterator i = loadedNodes.iterator(); i.hasNext();) { |
| 275 |
String key = (String) i.next(); |
| 276 |
if (key.startsWith(path)) |
| 277 |
i.remove(); |
| 278 |
} |
| 279 |
} |
| 260 |
|
280 |
|
| 261 |
public static void updatePreferences(IFile file) throws CoreException { |
281 |
public static void updatePreferences(IFile file) throws CoreException { |
| 262 |
IPath path = file.getFullPath(); |
282 |
IPath path = file.getFullPath(); |