Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 148309 Details for
Bug 275805
creating a non-primary working copy causes typeHierarchyChanged event
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch (text/plain), 4.59 KB, created by
Satyam Kandula
on 2009-09-29 06:00:09 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Satyam Kandula
Created:
2009-09-29 06:00:09 EDT
Size:
4.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java,v >retrieving revision 1.32 >diff -u -r1.32 TypeHierarchyNotificationTests.java >--- src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 28 Apr 2009 17:49:27 -0000 1.32 >+++ src/org/eclipse/jdt/core/tests/model/TypeHierarchyNotificationTests.java 29 Sep 2009 09:56:14 -0000 >@@ -1244,6 +1244,95 @@ > h.removeTypeHierarchyChangedListener(this); > } > } >+ >+/* >+ * Ensures that getting a non-primary working copy does NOT trigger >+ * a type hierarchy notification for the concerned hierarchy. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=275805 >+ */ >+public void testGetWorkingCopy() throws CoreException { >+ ITypeHierarchy h = null; >+ ICompilationUnit superCopy = null; >+ ICompilationUnit aWorkingCopy = null; >+ try { >+ >+ createJavaProject("P"); >+ createFolder("/P/p"); >+ createFile( >+ "/P/p/IX.java", >+ "package p;\n" + >+ "public interface IX {\n" + >+ "}" >+ ); >+ >+ createFile( >+ "/P/p/X.java", >+ "package p;\n" + >+ "public class X implements IX{\n" + >+ "}" >+ ); >+ >+ superCopy = getCompilationUnit("/P/p/IX.java"); >+ superCopy.becomeWorkingCopy(null/*no progress*/); >+ h = superCopy.getType("IX").newTypeHierarchy(null); >+ h.addTypeHierarchyChangedListener(this); >+ >+ aWorkingCopy = getCompilationUnit("P/p/X.java").getWorkingCopy(null); >+ >+ assertTrue("Should receive NO change", !this.changeReceived); >+ } finally { >+ if (h != null) >+ h.removeTypeHierarchyChangedListener(this); >+ if (aWorkingCopy != null) >+ aWorkingCopy.discardWorkingCopy(); >+ if (superCopy!= null) >+ superCopy.discardWorkingCopy(); >+ >+ deleteProject("P"); >+ } >+} >+ >+/* >+ * Ensures that working copies with different owner than that of the >+ * type hierarchy listener are ignored. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=275805 >+ */ >+public void testOwner() throws CoreException { >+ ITypeHierarchy h = null; >+ ICompilationUnit aWorkingCopy = null; >+ ICompilationUnit anotherWorkingCopy = null; >+ try { >+ createJavaProject("P"); >+ createFolder("/P/p"); >+ createFile( >+ "/P/p/X.java", >+ "package p;\n" + >+ "public class X {\n" + >+ "}" >+ ); >+ >+ aWorkingCopy = getCompilationUnit("/P/p/X.java").getWorkingCopy(null); >+ h = aWorkingCopy.getType("X").newTypeHierarchy(null); >+ h.addTypeHierarchyChangedListener(this); >+ >+ anotherWorkingCopy = getCompilationUnit("/P/p/X.java").getWorkingCopy(null); >+ anotherWorkingCopy.getBuffer().setContents( >+ "package p;\n" + >+ "public class X extends Throwable {\n" + >+ "}" >+ ); >+ anotherWorkingCopy.commitWorkingCopy(false/*don't force*/, null/*no progress*/); >+ assertTrue("Should receive NO change", !this.changeReceived); >+ } finally { >+ if (h != null) >+ h.removeTypeHierarchyChangedListener(this); >+ if (aWorkingCopy != null) >+ aWorkingCopy.discardWorkingCopy(); >+ if (anotherWorkingCopy != null) >+ anotherWorkingCopy.discardWorkingCopy(); >+ deleteProject("P"); >+ } >+} > /** > * Make a note of the change > */ >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java,v >retrieving revision 1.107 >diff -u -r1.107 TypeHierarchy.java >--- model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 7 Mar 2009 01:08:09 -0000 1.107 >+++ model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 29 Sep 2009 09:56:21 -0000 >@@ -984,6 +984,14 @@ > protected boolean isAffectedByOpenable(IJavaElementDelta delta, IJavaElement element, int eventType) { > if (element instanceof CompilationUnit) { > CompilationUnit cu = (CompilationUnit)element; >+ ICompilationUnit focusCU = >+ this.focusType != null ? this.focusType.getCompilationUnit() : null; >+ if (focusCU != null && focusCU.getOwner() != cu.getOwner()) >+ return false; >+ //ADDED delta arising from getWorkingCopy() should be ignored >+ if (eventType != ElementChangedEvent.POST_RECONCILE && !cu.isPrimary() && >+ delta.getKind() == IJavaElementDelta.ADDED) >+ return false; > ChangeCollector collector = this.changeCollector; > if (collector == null) { > collector = new ChangeCollector(this);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
Olivier_Thomann
:
iplog+
Olivier_Thomann
:
review+
Actions:
View
|
Diff
Attachments on
bug 275805
:
135477
|
138315
|
139179
|
147090
| 148309