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

Collapse All | Expand All

(-)launching/org/eclipse/jdt/internal/launching/JREContainerInitializer.java (+31 lines)
Lines 78-83 Link Here
78
			}
78
			}
79
		}
79
		}
80
	}
80
	}
81
	public void initialize(IPath containerPath, IJavaProject[] projects) throws CoreException {
82
		int size = containerPath.segmentCount();
83
		if (size > 0) {
84
			if (containerPath.segment(0).equals(JavaRuntime.JRE_CONTAINER)) {
85
				int length = projects.length;
86
				IVMInstall vm = resolveVM(containerPath);
87
				IClasspathContainer[] containers = new JREContainer[length];
88
				if (vm != null) {
89
					if (JREContainer.DEBUG_JRE_CONTAINER) {
90
						System.out.println("\tResolved VM: " + vm.getName()); //$NON-NLS-1$
91
					}
92
					for (int i=0; i<length; i++) {
93
						containers[i] = new JREContainer(vm, containerPath, projects[i]);
94
					}
95
				} else {
96
					if (JREContainer.DEBUG_JRE_CONTAINER) {
97
						System.out.println("\t*** FAILED RESOLVE VM ***"); //$NON-NLS-1$
98
					}
99
				}
100
				JavaCore.setClasspathContainer(containerPath, projects, containers, null);
101
			} else {
102
				if (JREContainer.DEBUG_JRE_CONTAINER) {
103
					System.out.println("\t*** INVALID JRE CONTAINER PATH ***"); //$NON-NLS-1$
104
				}	
105
			}
106
		} else {
107
			if (JREContainer.DEBUG_JRE_CONTAINER) {
108
				System.out.println("\t*** NO SEGMENTS IN CONTAINER PATH ***"); //$NON-NLS-1$
109
			}
110
		}
111
	}
81
	
112
	
82
	/**
113
	/**
83
	 * Returns the VM install associated with the container path, or <code>null</code>
114
	 * Returns the VM install associated with the container path, or <code>null</code>
(-)launching/org/eclipse/jdt/internal/launching/LaunchingPlugin.java (-4 / +20 lines)
Lines 272-278 Link Here
272
			monitor.worked(1);
272
			monitor.worked(1);
273
														
273
														
274
			// re-bind all container entries
274
			// re-bind all container entries
275
			for (int i = 0; i < projects.length; i++) {
275
			int length = projects.length;
276
			Map projectsMap = new HashMap();
277
			for (int i = 0; i < length; i++) {
276
				IJavaProject project = projects[i];
278
				IJavaProject project = projects[i];
277
				IClasspathEntry[] entries = project.getRawClasspath();
279
				IClasspathEntry[] entries = project.getRawClasspath();
278
				boolean replace = false;
280
				boolean replace = false;
Lines 292-301 Link Here
292
										newBinding = renamed;
294
										newBinding = renamed;
293
									}
295
									}
294
								}
296
								}
295
								JREContainerInitializer initializer = new JREContainerInitializer();
297
//								JREContainerInitializer initializer = new JREContainerInitializer();
296
								if (newBinding == null){
298
								if (newBinding == null){
297
									// re-bind old path
299
									// re-bind old path
298
									initializer.initialize(reference, project);
300
//									initializer.initialize(reference, project);
301
									List projectsList = (List) projectsMap.get(reference);
302
									if (projectsList == null) {
303
										projectsMap.put(reference, projectsList = new ArrayList(length));
304
									}
305
									projectsList.add(project);
299
								} else {
306
								} else {
300
									// replace old class path entry with a new one
307
									// replace old class path entry with a new one
301
									IClasspathEntry newEntry = JavaCore.newContainerEntry(newBinding, entry.isExported());
308
									IClasspathEntry newEntry = JavaCore.newContainerEntry(newBinding, entry.isExported());
Lines 313-319 Link Here
313
				}
320
				}
314
				monitor.worked(1);
321
				monitor.worked(1);
315
			}
322
			}
316
323
			Iterator references = projectsMap.keySet().iterator();
324
			while (references.hasNext()) {
325
				IPath reference = (IPath) references.next();
326
				List projectsList = (List) projectsMap.get(reference);
327
				IJavaProject[] referenceProjects = new IJavaProject[projectsList.size()];
328
				projectsList.toArray(referenceProjects);
329
				// re-bind old path
330
				JREContainerInitializer initializer = new JREContainerInitializer();
331
				initializer.initialize(reference, projects);
332
			}
317
		}
333
		}
318
334
319
	}
335
	}

Return to bug 302295