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 59660 Details for
Bug 172666
Importing pde.ui and dependencies as binary gives compile error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix and regression tests
172666.txt (text/plain), 10.19 KB, created by
Jerome Lanneluc
on 2007-02-23 10:26:34 EST
(
hide
)
Description:
Fix and regression tests
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-02-23 10:26:34 EST
Size:
10.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/ProjectReferenceChange.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ProjectReferenceChange.java,v >retrieving revision 1.1 >diff -u -r1.1 ProjectReferenceChange.java >--- model/org/eclipse/jdt/internal/core/ProjectReferenceChange.java 13 Jun 2006 13:00:42 -0000 1.1 >+++ model/org/eclipse/jdt/internal/core/ProjectReferenceChange.java 23 Feb 2007 15:21:22 -0000 >@@ -97,4 +97,7 @@ > throw new JavaModelException(e); > } > } >+ public String toString() { >+ return "ProjectRefenceChange: " + this.project.getElementName(); //$NON-NLS-1$ >+ } > } >Index: model/org/eclipse/jdt/internal/core/DeltaProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java,v >retrieving revision 1.293 >diff -u -r1.293 DeltaProcessor.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessor.java 19 Feb 2007 17:23:55 -0000 1.293 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessor.java 23 Feb 2007 15:21:22 -0000 >@@ -419,19 +419,9 @@ > // workaround for bug 15168 circular errors not reported > if (JavaProject.hasJavaNature(project)) { > addToParentInfo(javaProject); >- >- try { >- // force to (re)read the .classpath file >- javaProject.getPerProjectInfo().readAndCacheClasspath(javaProject); >- } catch (JavaModelException e) { >- if (VERBOSE) { >- e.printStackTrace(); >- } >- } >- >+ readRawClasspath(javaProject); > // ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=121569) >- ClasspathChange change = (ClasspathChange) this.classpathChanges.get(project); >- this.state.addProjectReferenceChange(javaProject, change == null ? null : change.oldResolvedClasspath); >+ checkProjectReferenceChange(project, javaProject); > } > > this.state.rootsAreStale = true; >@@ -448,6 +438,9 @@ > if (project.isOpen()) { > if (JavaProject.hasJavaNature(project)) { > addToParentInfo(javaProject); >+ readRawClasspath(javaProject); >+ // ensure project references are updated >+ checkProjectReferenceChange(project, javaProject); > } > } else { > try { >@@ -472,6 +465,9 @@ > // workaround for bug 15168 circular errors not reported > if (isJavaProject) { > this.addToParentInfo(javaProject); >+ readRawClasspath(javaProject); >+ // ensure project references are updated (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172666) >+ checkProjectReferenceChange(project, javaProject); > } else { > // remove classpath cache so that initializeRoots() will not consider the project has a classpath > this.manager.removePerProjectInfo(javaProject); >@@ -556,6 +552,22 @@ > } > } > } >+ >+ private void checkProjectReferenceChange(IProject project, JavaProject javaProject) { >+ ClasspathChange change = (ClasspathChange) this.classpathChanges.get(project); >+ this.state.addProjectReferenceChange(javaProject, change == null ? null : change.oldResolvedClasspath); >+ } >+ >+ private void readRawClasspath(JavaProject javaProject) { >+ try { >+ // force to (re)read the .classpath file >+ javaProject.getPerProjectInfo().readAndCacheClasspath(javaProject); >+ } catch (JavaModelException e) { >+ if (VERBOSE) { >+ e.printStackTrace(); >+ } >+ } >+ } > private void checkSourceAttachmentChange(IResourceDelta delta, IResource res) { > IPath rootPath = (IPath)this.state.sourceAttachments.get(res.getFullPath()); > if (rootPath != null) { >Index: model/org/eclipse/jdt/internal/core/ClasspathChange.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java,v >retrieving revision 1.3 >diff -u -r1.3 ClasspathChange.java >--- model/org/eclipse/jdt/internal/core/ClasspathChange.java 10 Jul 2006 20:50:44 -0000 1.3 >+++ model/org/eclipse/jdt/internal/core/ClasspathChange.java 23 Feb 2007 15:21:22 -0000 >@@ -497,4 +497,8 @@ > } > } > } >+ >+ public String toString() { >+ return "ClasspathChange: " + this.project.getElementName(); //$NON-NLS-1$ >+ } > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java,v >retrieving revision 1.76 >diff -u -r1.76 JavaProjectTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 20 Dec 2006 16:11:56 -0000 1.76 >+++ src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java 23 Feb 2007 15:21:24 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.jdt.core.*; >+import org.eclipse.jdt.core.tests.model.ClasspathInitializerTests.DefaultContainerInitializer; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.core.JavaModelManager; > import org.eclipse.jdt.internal.core.UserLibrary; >@@ -1069,6 +1070,134 @@ > deleteProjects(new String[] {"P1", "P2"}); > } > } >+ >+/* >+ * Ensures that importing a project correctly update the project references >+ * (regression test for bug 172666 Importing pde.ui and dependencies as binary gives compile error) >+ */ >+public void testProjectImport2() throws CoreException { >+ IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { >+ public void resourceChanged(IResourceChangeEvent event) { >+ try { >+ ContainerInitializer.initializer.initialize(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"), getJavaProject("P2")); >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ }; >+ try { >+ createJavaProject("P1"); >+ createFile("/P1/lib.jar", ""); >+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor) throws CoreException { >+ createProject("P2"); >+ createFile( >+ "/P2/.classpath", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"con\" path=\"org.eclipse.jdt.core.tests.model.TEST_CONTAINER\"/>\n" + >+ "</classpath>" >+ ); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"})); >+ getWorkspace().checkpoint(false/*don't build*/); >+ editFile( >+ "/P2/.project", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<projectDescription>\n" + >+ " <name>P2</name>\n" + >+ " <comment></comment>\n" + >+ " <projects>\n" + >+ " </projects>\n" + >+ " <buildSpec>\n" + >+ " <buildCommand>\n" + >+ " <name>org.eclipse.jdt.core.javabuilder</name>\n" + >+ " <arguments>\n" + >+ " </arguments>\n" + >+ " </buildCommand>\n" + >+ " </buildSpec>\n" + >+ " <natures>\n" + >+ " <nature>org.eclipse.jdt.core.javanature</nature>\n" + >+ " </natures>\n" + >+ "</projectDescription>" >+ ); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1"})); >+ } >+ }; >+ JavaCore.addPreProcessingResourceChangedListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); >+ getWorkspace().run(runnable, null); >+ waitForAutoBuild(); >+ IProject[] referencedProjects = getProject("P2").getReferencedProjects(); >+ assertResourcesEqual( >+ "Unexpected project references", >+ "/P1", >+ referencedProjects); >+ } finally { >+ JavaCore.removePreProcessingResourceChangedListener(resourceChangeListener); >+ deleteProjects(new String[] {"P1", "P2"}); >+ } >+} >+ >+/* >+ * Ensures that importing a project correctly update the project references >+ * (regression test for bug 172666 Importing pde.ui and dependencies as binary gives compile error) >+ */ >+public void testProjectImport3() throws CoreException { >+ IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { >+ public void resourceChanged(IResourceChangeEvent event) { >+ try { >+ ContainerInitializer.initializer.initialize(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"), getJavaProject("P2")); >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ }; >+ try { >+ createJavaProject("P1"); >+ createFile("/P1/lib.jar", ""); >+ createProject("P2"); >+ createFile( >+ "/P2/.classpath", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<classpath>\n" + >+ " <classpathentry kind=\"con\" path=\"org.eclipse.jdt.core.tests.model.TEST_CONTAINER\"/>\n" + >+ "</classpath>" >+ ); >+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1"})); >+ JavaCore.addPreProcessingResourceChangedListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); >+ editFile( >+ "/P2/.project", >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >+ "<projectDescription>\n" + >+ " <name>P2</name>\n" + >+ " <comment></comment>\n" + >+ " <projects>\n" + >+ " </projects>\n" + >+ " <buildSpec>\n" + >+ " <buildCommand>\n" + >+ " <name>org.eclipse.jdt.core.javabuilder</name>\n" + >+ " <arguments>\n" + >+ " </arguments>\n" + >+ " </buildCommand>\n" + >+ " </buildSpec>\n" + >+ " <natures>\n" + >+ " <nature>org.eclipse.jdt.core.javanature</nature>\n" + >+ " </natures>\n" + >+ "</projectDescription>" >+ ); >+ waitForAutoBuild(); >+ IProject[] referencedProjects = getProject("P2").getReferencedProjects(); >+ assertResourcesEqual( >+ "Unexpected project references", >+ "/P1", >+ referencedProjects); >+ } finally { >+ JavaCore.removePreProcessingResourceChangedListener(resourceChangeListener); >+ deleteProjects(new String[] {"P1", "P2"}); >+ } >+} >+ > /** > * Test that the correct package fragments exist in the project. > */
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
Actions:
View
|
Diff
Attachments on
bug 172666
:
59383
|
59449
| 59660