Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 116501

Summary: [quick fix] unwanted correction proposal to add classpath container to another project
Product: [Eclipse Project] JDT Reporter: Ernest Pasour <Ernest.Pasour>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Ernest Pasour CLA 2005-11-15 15:37:09 EST
I have created a classpath container using extension point
org.eclipse.jdt.core.classpathContainerInitializer.  In a project which already
has my classpath container as a classpath entry, I have a compile error for an
unknown import.  All instances of my classpath container do NOT generate the
same classpath.  The class below runs and generates a correction proposal of the
form "add library <my classpath container> to build path of <current project>".
 This makes no sense for my container, and in fact will cause problems.  It
finds this container in another project and will replicate it into my current
project.  I don't think this is a good idea.  

So...
1. I think IClasspathEntry.CPE_CONTAINER should be removed as a type of
classpath entry that can be poached from another project.
2. It would be nice to maybe add an interface on IClasspathContainer that would
allow me to tie my container to a nature (i.e. not let the user add the
container by itself via a correction proposal or the build path editor in
project properties).

The code below is from ReorgCorrectionsSubProcessor.importNotFoundProposals()

					if ((entryKind == IClasspathEntry.CPE_LIBRARY || entryKind ==
IClasspathEntry.CPE_VARIABLE || entryKind == IClasspathEntry.CPE_CONTAINER) &&
addedClaspaths.add(entry)) {
						String label= getAddClasspathLabel(entry, root, project);
						if (label != null) {
							AddToClasspathChange change= new AddToClasspathChange(project, entry);
							if (!change.entryAlreadyExists()) {
								ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(label,
change, 7, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE));
								proposals.add(proposal);
							}
						}
					}
Comment 1 Olivier Thomann CLA 2006-10-10 12:17:19 EDT
Build path issue.
Comment 2 Jerome Lanneluc CLA 2007-06-20 05:12:34 EDT
I'm afraid I don't understand the problem. It lools like a class is missing ('The class below ...'). In 1. what are you referring to ?
In the end, it looks like you are hooking into the quick fix mechanism.
Moving to JDT/UI (Martin does this speak to you ?)
Comment 3 Martin Aeschlimann CLA 2007-06-20 06:01:47 EDT
You're right. For your scenario, the quick fix isn't helpful. But from my current experiences, it mostly is, also for containers. I agree that we should be more precise wit the proposals. Maybe we should add an extension point.
Comment 4 Eclipse Genie CLA 2019-07-29 15:42:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.