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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/DeltaProcessor.java (+6 lines)
Lines 1849-1854 Link Here
1849
									this.currentDelta = null;
1849
									this.currentDelta = null;
1850
							}
1850
							}
1851
							
1851
							
1852
							// add late coming elements to refresh (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=212769 )
1853
							if (elementsToRefresh == null)
1854
								elementsToRefresh = this.state.removeExternalElementsToRefresh();
1855
							else
1856
								elementsToRefresh.addAll(this.state.removeExternalElementsToRefresh());
1857
							
1852
							// generate external archive change deltas
1858
							// generate external archive change deltas
1853
							if (elementsToRefresh != null) {
1859
							if (elementsToRefresh != null) {
1854
								createExternalArchiveDelta(elementsToRefresh, null);
1860
								createExternalArchiveDelta(elementsToRefresh, null);
(-)model/org/eclipse/jdt/internal/core/ClasspathChange.java (+26 lines)
Lines 10-21 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core;
11
package org.eclipse.jdt.internal.core;
12
12
13
import java.io.File;
14
import java.net.URI;
13
import java.util.ArrayList;
15
import java.util.ArrayList;
14
import java.util.HashMap;
16
import java.util.HashMap;
15
import java.util.HashSet;
17
import java.util.HashSet;
16
import java.util.Iterator;
18
import java.util.Iterator;
17
import java.util.Map;
19
import java.util.Map;
18
20
21
import org.eclipse.core.filesystem.EFS;
22
import org.eclipse.core.filesystem.IFileStore;
19
import org.eclipse.core.resources.IFolder;
23
import org.eclipse.core.resources.IFolder;
20
import org.eclipse.core.resources.IResource;
24
import org.eclipse.core.resources.IResource;
21
import org.eclipse.core.resources.IWorkspace;
25
import org.eclipse.core.resources.IWorkspace;
Lines 261-266 Link Here
261
		
265
		
262
		delta.changed(this.project, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED);
266
		delta.changed(this.project, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED);
263
		result |= HAS_DELTA;
267
		result |= HAS_DELTA;
268
269
		state.addForRefresh(this.project); // ensure external jars are refreshed for this project (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=212769 )
264
		
270
		
265
		Map removedRoots = null;
271
		Map removedRoots = null;
266
		IPackageFragmentRoot[] roots = null;
272
		IPackageFragmentRoot[] roots = null;
Lines 314-319 Link Here
314
					}
320
					}
315
				}
321
				}
316
				addClasspathDeltas(delta, pkgFragmentRoots, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH);
322
				addClasspathDeltas(delta, pkgFragmentRoots, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH);
323
				
324
				// remember timestamp of jars that were removed (in case they are added as external jar in the same operation)
325
				for (int j = 0, length = pkgFragmentRoots.length; j < length; j++) {
326
					IPackageFragmentRoot root = pkgFragmentRoots[j];
327
					if (root.isArchive() && !root.isExternal()) {
328
						URI location = root.getResource().getLocationURI();
329
						File file = null;
330
						try {
331
							IFileStore fileStore = EFS.getStore(location);
332
							file = fileStore.toLocalFile(EFS.NONE, null);
333
						} catch (CoreException e) {
334
							// continue
335
						}
336
						if (file == null)
337
							continue;
338
						long timeStamp = DeltaProcessor.getTimeStamp(file);
339
						IPath externalPath = new org.eclipse.core.runtime.Path(file.getAbsolutePath());
340
						state.getExternalLibTimeStamps().put(externalPath, new Long(timeStamp));
341
					}
342
				}
317
			} else {
343
			} else {
318
				// remote project changes
344
				// remote project changes
319
				if (this.oldResolvedClasspath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) {
345
				if (this.oldResolvedClasspath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) {
(-)src/org/eclipse/jdt/core/tests/model/ExternalJarDeltaTests.java (+35 lines)
Lines 270-275 Link Here
270
		this.stopDeltas();
270
		this.stopDeltas();
271
	}
271
	}
272
}
272
}
273
/*
274
 * Ensures that the correct delta is reported after a setRawClasspath and after a modification of an external jar.
275
 */
276
public void testExternalJarChanged6() throws CoreException, IOException {
277
	File f = null;
278
	try {
279
		IJavaProject project = this.createJavaProject("P", new String[] {""}, "");
280
		
281
		String pPath = getExternalPath() + "p.jar";
282
		setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null)});
283
		
284
		f = new File(pPath);
285
		f.createNewFile();
286
		getJavaModel().refreshExternalArchives(null,null);
287
		waitUntilIndexesReady();
288
		startDeltas();
289
		
290
		touch(f);
291
		setClasspath(project, new IClasspathEntry[]{JavaCore.newLibraryEntry(new Path(pPath), null, null), JavaCore.newSourceEntry(new Path("/P"))});
292
		
293
		assertDeltas(
294
			"Unexpected delta", 
295
			"P[*]: {CHILDREN | CONTENT | RAW CLASSPATH CHANGED | RESOLVED CLASSPATH CHANGED}\n" + 
296
			"	<project root>[*]: {ADDED TO CLASSPATH}\n" + 
297
			"	D:\\eclipse\\workspace\\p.jar[*]: {CONTENT | ARCHIVE CONTENT CHANGED}\n" + 
298
			"	ResourceDelta(/P/.classpath)[*]"
299
		);
300
	} finally {
301
		if(f != null) {
302
			deleteFile(f);
303
		}
304
		this.deleteProject("P");
305
		this.stopDeltas();
306
	}
307
}
273
/**
308
/**
274
 * Refresh the JavaModel after an addition of an external jar.
309
 * Refresh the JavaModel after an addition of an external jar.
275
 */
310
 */

Return to bug 212769