View | Details | Raw Unified | Return to bug 289560 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/SetContainerOperation.java (-1 / +21 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 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 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core;
11
package org.eclipse.jdt.internal.core;
12
12
13
import org.eclipse.core.resources.IResourceRuleFactory;
13
import org.eclipse.core.resources.ResourcesPlugin;
14
import org.eclipse.core.resources.ResourcesPlugin;
14
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.CoreException;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.core.runtime.jobs.ISchedulingRule;
18
import org.eclipse.core.runtime.jobs.MultiRule;
16
import org.eclipse.jdt.core.IClasspathContainer;
19
import org.eclipse.jdt.core.IClasspathContainer;
17
import org.eclipse.jdt.core.IClasspathEntry;
20
import org.eclipse.jdt.core.IClasspathEntry;
18
import org.eclipse.jdt.core.IJavaElement;
21
import org.eclipse.jdt.core.IJavaElement;
Lines 140-145 Link Here
140
		}
143
		}
141
	}
144
	}
142
145
146
	protected ISchedulingRule getSchedulingRule() {
147
		if (this.canChangeResources) {
148
			int length = this.affectedProjects.length;
149
			IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
150
			ISchedulingRule[] rules = new ISchedulingRule[length + 1];
151
152
			for (int index = 0; index < length; index++) {
153
				rules[index] = ruleFactory.modifyRule(this.affectedProjects[index].getProject());
154
			}
155
			// External folders might get changed inside ChangeClasspathOperation.classpathChanged(ClasspathChange)
156
			rules[length] = ruleFactory.modifyRule(JavaModelManager.getExternalManager().getExternalFoldersProject());
157
158
			return new MultiRule(rules);
159
		}
160
		return super.getSchedulingRule();
161
	}
162
	
143
	private void verbose_failure(CoreException e) {
163
	private void verbose_failure(CoreException e) {
144
		Util.verbose(
164
		Util.verbose(
145
			"CPContainer SET  - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$
165
			"CPContainer SET  - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$
(-)model/org/eclipse/jdt/internal/core/UserLibraryManager.java (-17 / +16 lines)
Lines 165-188 Link Here
165
		// this.userLibraries was updated during the PreferenceChangeEvent (see preferenceChange(...))
165
		// this.userLibraries was updated during the PreferenceChangeEvent (see preferenceChange(...))
166
	}
166
	}
167
167
168
	public void setUserLibrary(String libName, IClasspathEntry[] entries, boolean isSystemLibrary)  {
168
	public void setUserLibrary(String libName, IClasspathEntry[] entries, boolean isSystemLibrary) {
169
		synchronized (this.userLibraries) {
169
		IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
170
			IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
170
		String propertyName = CP_USERLIBRARY_PREFERENCES_PREFIX + libName;
171
			String propertyName = CP_USERLIBRARY_PREFERENCES_PREFIX+libName;
171
		try {
172
			try {
172
			String propertyValue = UserLibrary.serialize(entries, isSystemLibrary);
173
				String propertyValue = UserLibrary.serialize(entries, isSystemLibrary);
173
			instancePreferences.put(propertyName, propertyValue); // sends out a PreferenceChangeEvent (see
174
				instancePreferences.put(propertyName, propertyValue); // sends out a PreferenceChangeEvent (see preferenceChange(...))
174
																	// preferenceChange(...))
175
			} catch (IOException e) {
175
		} catch (IOException e) {
176
				Util.log(e, "Exception while serializing user library " + libName); //$NON-NLS-1$
176
			Util.log(e, "Exception while serializing user library " + libName); //$NON-NLS-1$
177
				return;
177
			return;
178
			}
179
			try {
180
				instancePreferences.flush();
181
			} catch (BackingStoreException e) {
182
				Util.log(e, "Exception while saving user library " + libName); //$NON-NLS-1$
183
			}
184
		}
178
		}
185
		// this.userLibraries was updated during the PreferenceChangeEvent (see preferenceChange(...))
179
		try {
180
			instancePreferences.flush();
181
		} catch (BackingStoreException e) {
182
			Util.log(e, "Exception while saving user library " + libName); //$NON-NLS-1$
183
		}
184
		// No need to lock this.userLibraries since SetContainerOperation uses ISchedulingRule now.
186
	}
185
	}
187
186
188
}
187
}

Return to bug 289560