Bug 30505 Exception attaching source to library [build path]
I2003-01-22 I am trying to attach sourcecode to a library. This is done withing the package explorer using the properties of the library. However, after selecting the source location, pressing okay results in the following exception. (NB: The library is not referenced by the project's build path) !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:277) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run (ProgressMonitorDialog.java:351) at org.eclipse.jdt.internal.ui.preferences.SourceAttachmentPropertyPage.performOk (SourceAttachmentPropertyPage.java:118) at org.eclipse.jface.preference.PreferenceDialog.okPressed (PreferenceDialog.java:616) at org.eclipse.jface.preference.PreferenceDialog.buttonPressed (PreferenceDialog.java:185) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.jface.window.Window.runEventLoop(Window.java:561) at org.eclipse.jface.window.Window.open(Window.java:541) at org.eclipse.ui.dialogs.PropertyDialogAction.run (PropertyDialogAction.java:158) at org.eclipse.jface.action.Action.runWithEvent(Action.java:804) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:422) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:374) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:368) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:69) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1525) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1508) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) 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:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) Caused by: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:2231) at org.eclipse.swt.SWT.error(SWT.java:2161) at org.eclipse.swt.widgets.Widget.error(Widget.java:381) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:311) at org.eclipse.swt.widgets.Control.getShell(Control.java:898) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.getShell (SourceAttachmentBlock.java:507) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.putJarOnCl asspathDialog(SourceAttachmentBlock.java:628) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.updateProj ectClasspath(SourceAttachmentBlock.java:616) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock.attachSour ce(SourceAttachmentBlock.java:575) at org.eclipse.jdt.internal.ui.wizards.buildpaths.SourceAttachmentBlock$1.run (SourceAttachmentBlock.java:555) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:95)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/SourceAttachmentPropertyPage.java
private SourceAttachmentBlock fSourceAttachmentBlock;
	private IPackageFragmentRoot fRoot;
	public SourceAttachmentPropertyPage() {
	}
	
	/*
	 * @see PreferencePage#createContents
	 */
	protected Control createContents(Composite composite) {
		initializeDialogUnits(composite);
		WorkbenchHelp.setHelp(composite, IJavaHelpContextIds.SOURCE_ATTACHMENT_PROPERTY_PAGE);		
		try {
			fRoot= getJARPackageFragmentRoot();
			if (fRoot == null || fRoot.getKind() != IPackageFragmentRoot.K_BINARY) {
				return createMessageContent(composite, PreferencesMessages.getString("SourceAttachmentPropertyPage.noarchive.message"));  
			}
			IPath containerPath= null;
			IJavaProject jproject= fRoot.getJavaProject();
			IClasspathEntry entry= fRoot.getRawClasspathEntry();
			if (entry == null) {
				
				entry= JavaCore.newLibraryEntry(fRoot.getPath(), null, null);
			} else {
				if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
					containerPath= entry.getPath();