Community
Participate
Working Groups
Build 20040529 The dialog to attach source to a JAR allows you to choose a directory. However, I don't get the source for my .class files in the JAR. 1. Create a project containing a class with a main method, Hello.java (default package). 2. Create a JAR containing only Hello.class. 3. Double-click Hello.class. 4. A class file editor opens. 5. Click "Change attached source...". 6. In the resulting dialog, choose to add an external directory (bug 65186 prevents you from choosing the project with the workspace button) and point to the project containing Hello.java 7. You still get the class file editor. The source file Hello.java is not shown.
I'm not sure if external folders are supported as source attachment location. Moving to jdt.core for comments. If not, please move back so I can fix that the source attachment does not allow this.
Olivier - pls check expectation, no feature to add; we only want to align core and ui here.
That case works for me. I can get the source of the Hello class pointing to an external folder.
If I put "P" (when my java project is called P), I end up with: org.eclipse.jdt.internal.core.Assert$AssertionFailedException: Assertion failed; Source attachment path 'P' for IClasspathEntry must be absolute at org.eclipse.jdt.internal.core.Assert.isTrue(Assert.java:89) at org.eclipse.jdt.core.JavaCore.newLibraryEntry(JavaCore.java:2749) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.getNewEntry(SourceAttachmentBlock.java:226) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentDialog.getResult(SourceAttachmentDialog.java:89) at org.eclipse.jdt.ui.wizards.BuildPathDialogAccess.configureSourceAttachment(BuildPathDialogAccess.java:96) at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor$3.widgetSelected(ClassFileEditor.java:270) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2719) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2385) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1363) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1334) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:253) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:334) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:638) at org.eclipse.core.launcher.Main.main(Main.java:622) The wizard should not allow a relative path to be used. /P doesn't seem to work better. I will investigate this second case.
External folders should be supported. But some validation must be done. 1) The source attachment path must be absolute 2) An external folder is not supposed to be able to point to a folder inside the workspace. I tried to debug the case where I put /P as the source attachment path. I don't know where this is discarded, but I end up with an empty source attachment in the .classpath file. The source mapper is not even called. As long as /P means the path to the project location, it should work from my point of view. When I click on the Workspace button, only an internal jar or a internal fodler are expected to be found. The folder representing the project should be a valid option. Move back to JDT/UI for addition of validation in these scenarii.
fixed > 20040610 - You can now select projects - I added validation to require absolute paths - I didn't yet added the check if folders are located in the workbench. It is not so cheap testing that (due to linked resources). Is this validation essential or is it just a recommendation to use local folders if possible?
Olivier, see my last question in comment 6
No, it works. The path is absolute anyway. It is simply weird that you click on "External folder" and you can select a folder located inside the workspace. The remaining issue is in bug 65186. I don't see why /P is discarded. It needs more investigation.
start verifying...
verified that a external directory can be used to attach the source. Couldn't verify the project case due to bug 65186.