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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java (+3 lines)
Lines 984-989 Link Here
984
protected boolean isAffectedByOpenable(IJavaElementDelta delta, IJavaElement element, int eventType) {
984
protected boolean isAffectedByOpenable(IJavaElementDelta delta, IJavaElement element, int eventType) {
985
	if (element instanceof CompilationUnit) {
985
	if (element instanceof CompilationUnit) {
986
		CompilationUnit cu = (CompilationUnit)element;
986
		CompilationUnit cu = (CompilationUnit)element;
987
		if (delta.getKind() == IJavaElementDelta.ADDED && !cu.isPrimary())	
988
			return false;
989
		
987
		ChangeCollector collector = this.changeCollector;
990
		ChangeCollector collector = this.changeCollector;
988
		if (collector == null) {
991
		if (collector == null) {
989
		    collector = new ChangeCollector(this);
992
		    collector = new ChangeCollector(this);
(-)src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java (+49 lines)
Lines 1244-1249 Link Here
1244
		h.removeTypeHierarchyChangedListener(this);
1244
		h.removeTypeHierarchyChangedListener(this);
1245
	}
1245
	}
1246
}
1246
}
1247
1248
/*
1249
 * Ensures that getting a non-primary working copy does NOT trigger
1250
 * a type hierarchy notification for the concerned hierarchy. 
1251
 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=275805
1252
 */
1253
public void testGetWorkingCopy() throws CoreException {
1254
	ITypeHierarchy h = null;
1255
	ICompilationUnit superCopy = null;
1256
	ICompilationUnit aWorkingCopy = null;
1257
1258
	try {
1259
		
1260
		createJavaProject("P");
1261
		createFolder("/P/p");
1262
		createFile(
1263
			"/P/p/IX.java",
1264
			"package p;\n" +
1265
			"public interface IX {\n" +
1266
			"}"
1267
		);
1268
		
1269
		createFile(
1270
				"/P/p/X.java",
1271
				"package p;\n" +
1272
				"public class X implements IX{\n" +
1273
				"}"
1274
			);
1275
1276
		superCopy = getCompilationUnit("/P/p/IX.java");
1277
		superCopy.becomeWorkingCopy(null/*no progress*/);
1278
		h = superCopy.getType("IX").newTypeHierarchy(null);		
1279
		h.addTypeHierarchyChangedListener(this);
1280
		
1281
		aWorkingCopy = getCompilationUnit("P/p/X.java").getWorkingCopy(null);
1282
		
1283
		assertTrue("Should receive NO change", !this.changeReceived);
1284
	} finally {
1285
		if (h != null)
1286
			h.removeTypeHierarchyChangedListener(this);
1287
		if (aWorkingCopy != null)
1288
			aWorkingCopy.discardWorkingCopy();
1289
		if (superCopy!= null)
1290
			superCopy.discardWorkingCopy();
1291
		
1292
		deleteProject("P");
1293
	}
1294
}
1295
1247
/**
1296
/**
1248
 * Make a note of the change
1297
 * Make a note of the change
1249
 */
1298
 */

Return to bug 275805