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

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/JavaCore.java (-7 / +5 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 3578-3584 Link Here
3578
					continue;
3579
					continue;
3579
				}
3580
				}
3580
				if (classpath != null) {
3581
				if (classpath != null) {
3581
					boolean needExternalFolderCreation = false;
3582
					for (int j = 0, length2 = classpath.length; j < length2; j++) {
3582
					for (int j = 0, length2 = classpath.length; j < length2; j++) {
3583
						IClasspathEntry entry = classpath[j];
3583
						IClasspathEntry entry = classpath[j];
3584
						if (entry.getSourceAttachmentPath() != null) {
3584
						if (entry.getSourceAttachmentPath() != null) {
Lines 3588-3605 Link Here
3588
							}
3588
							}
3589
						}
3589
						}
3590
						// else source might have been attached by IPackageFragmentRoot#attachSource(...), we keep it
3590
						// else source might have been attached by IPackageFragmentRoot#attachSource(...), we keep it
3591
						if (!needExternalFolderCreation && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
3591
						if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
3592
							IPath entryPath = entry.getPath();
3592
							IPath entryPath = entry.getPath();
3593
							if (ExternalFoldersManager.isExternalFolderPath(entryPath) && externalFoldersManager.getFolder(entryPath) == null) {
3593
							if (ExternalFoldersManager.isExternalFolderPath(entryPath) && externalFoldersManager.getFolder(entryPath) == null) {
3594
								needExternalFolderCreation = true;
3594
								externalFoldersManager.addFolder(entryPath, true);
3595
							}
3595
							}
3596
						}
3596
						}
3597
					}
3597
					}
3598
					if (needExternalFolderCreation)
3599
						manager.deltaState.addExternalFolderChange(javaProject, null/*act as if all external folders were new*/);
3600
				}
3598
				}
3601
			}
3599
			}
3602
3600
			externalFoldersManager.createPendingFolders(monitor);
3603
			// initialize delta state
3601
			// initialize delta state
3604
			if (monitor != null)
3602
			if (monitor != null)
3605
				monitor.subTask(Messages.javamodel_initializing_delta_state);
3603
				monitor.subTask(Messages.javamodel_initializing_delta_state);
(-)model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java (-1 / +16 lines)
Lines 38-43 Link Here
38
import org.eclipse.core.runtime.jobs.Job;
38
import org.eclipse.core.runtime.jobs.Job;
39
import org.eclipse.jdt.core.IClasspathEntry;
39
import org.eclipse.jdt.core.IClasspathEntry;
40
import org.eclipse.jdt.core.JavaCore;
40
import org.eclipse.jdt.core.JavaCore;
41
import org.eclipse.jdt.core.JavaModelException;
41
import org.eclipse.jdt.internal.core.util.Messages;
42
import org.eclipse.jdt.internal.core.util.Messages;
42
import org.eclipse.jdt.internal.core.util.Util;
43
import org.eclipse.jdt.internal.core.util.Util;
43
44
Lines 148-153 Link Here
148
		return result;
149
		return result;
149
	}
150
	}
150
151
152
	public void createPendingFolders(IProgressMonitor monitor) throws JavaModelException{
153
		if (this.pendingFolders == null) return;
154
		Iterator iterator = this.pendingFolders.iterator();
155
		while (iterator.hasNext()) {
156
			Object folderPath = iterator.next();
157
			try {
158
				createLinkFolder((IPath) folderPath, false, monitor);
159
			} catch (CoreException e) {
160
				throw new JavaModelException(e);
161
			}
162
		}
163
		this.pendingFolders.clear();
164
	}
165
	
151
	public void cleanUp(IProgressMonitor monitor) throws CoreException {
166
	public void cleanUp(IProgressMonitor monitor) throws CoreException {
152
		ArrayList toDelete = getFoldersToCleanUp(monitor);
167
		ArrayList toDelete = getFoldersToCleanUp(monitor);
153
		if (toDelete == null)
168
		if (toDelete == null)
Lines 193-199 Link Here
193
	public IProject getExternalFoldersProject() {
208
	public IProject getExternalFoldersProject() {
194
		return ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME);
209
		return ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME);
195
	}
210
	}
196
	private IProject createExternalFoldersProject(IProgressMonitor monitor) throws CoreException {
211
	public IProject createExternalFoldersProject(IProgressMonitor monitor) throws CoreException {
197
		IProject project = getExternalFoldersProject();
212
		IProject project = getExternalFoldersProject();
198
		if (!project.isAccessible()) {
213
		if (!project.isAccessible()) {
199
			if (!project.exists()) {
214
			if (!project.exists()) {

Return to bug 337415