View | Details | Raw Unified | Return to bug 113051
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/DeltaProcessor.java (-36 / +44 lines)
Lines 1809-1815 Link Here
1809
					}
1809
					}
1810
					// this.processPostChange = false;
1810
					// this.processPostChange = false;
1811
					if(isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
1811
					if(isAffectedBy(delta)) { // avoid populating for SYNC or MARKER deltas
1812
						updateClasspathMarkers(delta);
1812
						updateClasspathMarkers(delta, updates);
1813
						JavaBuilder.buildStarting();
1813
						JavaBuilder.buildStarting();
1814
					}
1814
					}
1815
					// does not fire any deltas
1815
					// does not fire any deltas
Lines 2097-2103 Link Here
2097
	/*
2097
	/*
2098
	 * Update the .classpath format, missing entries and cycle markers for the projects affected by the given delta.
2098
	 * Update the .classpath format, missing entries and cycle markers for the projects affected by the given delta.
2099
	 */
2099
	 */
2100
	private void updateClasspathMarkers(IResourceDelta delta) {
2100
	private void updateClasspathMarkers(IResourceDelta delta, DeltaProcessingState.ProjectUpdateInfo[] updates) {
2101
		
2101
		
2102
		Map preferredClasspaths = new HashMap(5);
2102
		Map preferredClasspaths = new HashMap(5);
2103
		Map preferredOutputs = new HashMap(5);
2103
		Map preferredOutputs = new HashMap(5);
Lines 2110-2154 Link Here
2110
		// update .classpath format markers for affected projects (dependent projects 
2110
		// update .classpath format markers for affected projects (dependent projects 
2111
		// or projects that reference a library in one of the projects that have changed)
2111
		// or projects that reference a library in one of the projects that have changed)
2112
		if (!affectedProjects.isEmpty()) {
2112
		if (!affectedProjects.isEmpty()) {
2113
			try {
2113
			IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
2114
				IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
2114
			IProject[] projects = workspaceRoot.getProjects();
2115
				IProject[] projects = workspaceRoot.getProjects();
2115
			int length = projects.length;
2116
				int length = projects.length;
2116
			for (int i = 0; i < length; i++){
2117
				for (int i = 0; i < length; i++){
2117
				IProject project = projects[i];
2118
					IProject project = projects[i];
2118
				JavaProject javaProject = (JavaProject)JavaCore.create(project);
2119
					JavaProject javaProject = (JavaProject)JavaCore.create(project);
2119
				if (preferredClasspaths.get(javaProject) == null) { // not already updated
2120
					if (preferredClasspaths.get(javaProject) == null) { // not already updated
2120
					try {
2121
						try {
2121
						IPath projectPath = project.getFullPath();
2122
							IPath projectPath = project.getFullPath();
2122
						IClasspathEntry[] classpath = javaProject.getResolvedClasspath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/); // allowed to reuse model cache
2123
							IClasspathEntry[] classpath = javaProject.getResolvedClasspath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/); // allowed to reuse model cache
2123
						for (int j = 0, cpLength = classpath.length; j < cpLength; j++) {
2124
							for (int j = 0, cpLength = classpath.length; j < cpLength; j++) {
2124
							IClasspathEntry entry = classpath[j];
2125
								IClasspathEntry entry = classpath[j];
2125
							switch (entry.getEntryKind()) {
2126
								switch (entry.getEntryKind()) {
2126
								case IClasspathEntry.CPE_PROJECT:
2127
									case IClasspathEntry.CPE_PROJECT:
2127
									if (affectedProjects.contains(entry.getPath())) {
2128
										if (affectedProjects.contains(entry.getPath())) {
2128
										javaProject.updateClasspathMarkers(null, null);
2129
											javaProject.updateClasspathMarkers(null, null);
2129
									}
2130
										}
2130
									break;
2131
										break;
2131
								case IClasspathEntry.CPE_LIBRARY:
2132
									case IClasspathEntry.CPE_LIBRARY:
2132
									IPath entryPath = entry.getPath();
2133
										IPath entryPath = entry.getPath();
2133
									IPath libProjectPath = entryPath.removeLastSegments(entryPath.segmentCount()-1);
2134
										IPath libProjectPath = entryPath.removeLastSegments(entryPath.segmentCount()-1);
2134
									if (!libProjectPath.equals(projectPath) // if library contained in another project
2135
										if (!libProjectPath.equals(projectPath) // if library contained in another project
2135
											&& affectedProjects.contains(libProjectPath)) {
2136
												&& affectedProjects.contains(libProjectPath)) {
2136
										javaProject.updateClasspathMarkers(null, null);
2137
											javaProject.updateClasspathMarkers(null, null);
2137
									}
2138
										}
2138
									break;
2139
										break;
2140
								}
2141
							}
2139
							}
2142
						} catch(JavaModelException e) {
2143
								// project no longer exists
2144
						}
2140
						}
2141
					} catch(JavaModelException e) {
2142
							// project no longer exists
2145
					}
2143
					}
2146
				}
2144
				}
2147
2145
			}
2148
				// update all cycle markers
2146
		}
2147
		if (!affectedProjects.isEmpty() || updates != null) {
2148
			// update all cycle markers since the given delta may have affected cycles
2149
			if (updates != null) {
2150
				for (int i = 0, length = updates.length; i < length; i++) {
2151
					DeltaProcessingState.ProjectUpdateInfo info = updates[i];
2152
					if (!preferredClasspaths.containsKey(info.project))
2153
						preferredClasspaths.put(info.project, info.newResolvedPath);
2154
				}
2155
			}
2156
			try {
2149
				JavaProject.updateAllCycleMarkers(preferredClasspaths);
2157
				JavaProject.updateAllCycleMarkers(preferredClasspaths);
2150
			} catch(JavaModelException e) {
2158
			} catch (JavaModelException e) {
2151
				// project no longer exists
2159
				// project no longer exist
2152
			}
2160
			}
2153
		}
2161
		}
2154
	}
2162
	}

Return to bug 113051