Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java,v --- src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 24 May 2005 16:43:14 -0000 1.21 +++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 27 May 2005 15:58:12 -0000 @@ -578,6 +578,45 @@ h.removeTypeHierarchyChangedListener(this); } } +/* + * Ensures that changing the modifiers of the focus type in a working copy reports a hierarchy change on save. + * (regression test for bug + */ +public void testChangeFocusModifier() throws CoreException { + ITypeHierarchy h = null; + ICompilationUnit workingCopy = null; + try { + createJavaProject("P1"); + createFolder("/P1/p"); + createFile( + "/P1/p/X.java", + "package p1;\n" + + "public class X {\n" + + "}" + ); + workingCopy = getCompilationUnit("/P1/p/X.java"); + workingCopy.becomeWorkingCopy(null/*no pb requestor*/, null/*no progress*/); + h = workingCopy.getType("X").newTypeHierarchy(null); + h.addTypeHierarchyChangedListener(this); + + workingCopy.getBuffer().setContents( + "package p1;\n" + + "class X {\n" + + "}" + ); + workingCopy.reconcile(ICompilationUnit.NO_AST, false/*mp pb detection*/, null/*no workingcopy owner*/, null/*no prgress*/); + workingCopy.commitWorkingCopy(false/*don't force*/, null/*no progress*/); + + assertOneChange(h); + } finally { + if (h != null) + h.removeTypeHierarchyChangedListener(this); + if (workingCopy != null) + workingCopy.discardWorkingCopy(); + deleteProjects(new String[] {"P1", "P2"}); + } +} + /** * Ensures that a TypeHierarchyNotification is made invalid when the project is closed. */