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

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/JavaCore.java (-4 / +15 lines)
Lines 3530-3535 Link Here
3530
3530
3531
			// initialize all containers and variables
3531
			// initialize all containers and variables
3532
			JavaModelManager manager = JavaModelManager.getJavaModelManager();
3532
			JavaModelManager manager = JavaModelManager.getJavaModelManager();
3533
			ExternalFoldersManager externalFoldersManager = JavaModelManager.getExternalManager();
3534
			externalFoldersManager.createExternalFoldersProject(monitor);
3533
			SubProgressMonitor subMonitor = null;
3535
			SubProgressMonitor subMonitor = null;
3534
			try {
3536
			try {
3535
				if (monitor != null) {
3537
				if (monitor != null) {
Lines 3565-3571 Link Here
3565
			// and recreate links for external folders if needed
3567
			// and recreate links for external folders if needed
3566
			if (monitor != null)
3568
			if (monitor != null)
3567
				monitor.subTask(Messages.javamodel_resetting_source_attachment_properties);
3569
				monitor.subTask(Messages.javamodel_resetting_source_attachment_properties);
3568
			ExternalFoldersManager externalFoldersManager = JavaModelManager.getExternalManager();
3569
			final IJavaProject[] projects = manager.getJavaModel().getJavaProjects();
3570
			final IJavaProject[] projects = manager.getJavaModel().getJavaProjects();
3570
			HashSet visitedPaths = new HashSet();
3571
			HashSet visitedPaths = new HashSet();
3571
			for (int i = 0, length = projects.length; i < length; i++) {
3572
			for (int i = 0, length = projects.length; i < length; i++) {
Lines 3581-3602 Link Here
3581
					boolean needExternalFolderCreation = false;
3582
					boolean needExternalFolderCreation = false;
3582
					for (int j = 0, length2 = classpath.length; j < length2; j++) {
3583
					for (int j = 0, length2 = classpath.length; j < length2; j++) {
3583
						IClasspathEntry entry = classpath[j];
3584
						IClasspathEntry entry = classpath[j];
3584
						if (entry.getSourceAttachmentPath() != null) {
3585
						IPath sourceAttachmentPath = null;
3586
						if ( (sourceAttachmentPath = entry.getSourceAttachmentPath()) != null) {
3585
							IPath entryPath = entry.getPath();
3587
							IPath entryPath = entry.getPath();
3586
							if (visitedPaths.add(entryPath)) {
3588
							if (visitedPaths.add(entryPath)) {
3587
								Util.setSourceAttachmentProperty(entryPath, null);
3589
								Util.setSourceAttachmentProperty(entryPath, null);
3588
							}
3590
							}
3591
							if (ExternalFoldersManager.isExternalFolderPath(sourceAttachmentPath)
3592
									&& (externalFoldersManager.isPendingFolder(sourceAttachmentPath) || 
3593
											externalFoldersManager.getFolder(sourceAttachmentPath) == null)) {
3594
								needExternalFolderCreation = true;
3595
							}
3589
						}
3596
						}
3590
						// else source might have been attached by IPackageFragmentRoot#attachSource(...), we keep it
3597
						// else source might have been attached by IPackageFragmentRoot#attachSource(...), we keep it
3591
						if (!needExternalFolderCreation && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
3598
						if (!needExternalFolderCreation && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
3592
							IPath entryPath = entry.getPath();
3599
							IPath entryPath = entry.getPath();
3593
							if (ExternalFoldersManager.isExternalFolderPath(entryPath) && externalFoldersManager.getFolder(entryPath) == null) {
3600
							if (ExternalFoldersManager.isExternalFolderPath(entryPath)
3601
									&& (externalFoldersManager.isPendingFolder(entryPath) || 
3602
											externalFoldersManager.getFolder(entryPath) == null)) {
3594
								needExternalFolderCreation = true;
3603
								needExternalFolderCreation = true;
3595
							}
3604
							}
3596
						}
3605
						}
3597
					}
3606
					}
3607
					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=337415
3608
					// Request for creation of external folder's link instead of relying on delta processing. 
3598
					if (needExternalFolderCreation)
3609
					if (needExternalFolderCreation)
3599
						manager.deltaState.addExternalFolderChange(javaProject, null/*act as if all external folders were new*/);
3610
						new ExternalFolderChange(javaProject, classpath).updateExternalFoldersIfNecessary(false, monitor);
3600
				}
3611
				}
3601
			}
3612
			}
3602
3613
(-)model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java (-1 / +4 lines)
Lines 193-199 Link Here
193
	public IProject getExternalFoldersProject() {
193
	public IProject getExternalFoldersProject() {
194
		return ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME);
194
		return ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME);
195
	}
195
	}
196
	private IProject createExternalFoldersProject(IProgressMonitor monitor) throws CoreException {
196
	public IProject createExternalFoldersProject(IProgressMonitor monitor) throws CoreException {
197
		IProject project = getExternalFoldersProject();
197
		IProject project = getExternalFoldersProject();
198
		if (!project.isAccessible()) {
198
		if (!project.isAccessible()) {
199
			if (!project.exists()) {
199
			if (!project.exists()) {
Lines 258-263 Link Here
258
		project.create(desc, IResource.HIDDEN, monitor);
258
		project.create(desc, IResource.HIDDEN, monitor);
259
	}
259
	}
260
260
261
	public boolean isPendingFolder(IPath externalFolderPath) {
262
		return this.pendingFolders != null && this.pendingFolders.contains(externalFolderPath);
263
	}
261
	public IFolder getFolder(IPath externalFolderPath) {
264
	public IFolder getFolder(IPath externalFolderPath) {
262
		return (IFolder) getFolders().get(externalFolderPath);
265
		return (IFolder) getFolders().get(externalFolderPath);
263
	}
266
	}

Return to bug 337415