Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: [cdt-dev] Programatically getting settings from the current project

> 
> Alain,
> 
> I worked around the issue I mentioned in my erlier email by using=20
> 
> 		IWorkbenchWindow[] windows =3D =
> PlatformUI.getWorkbench().getWorkbenchWindows();
> 		if (windows.length=3D=3D1) {
> 			IWorkbenchWindow window =3D windows[0];
> 			if (window !=3D null) {=20
> 			...
> 
> because I noticed that the length of the IWorkbenchWindow[] was 1 on my =
> desktop. Although I am not sure what I am doing ...
> 
> But there is another issue, further down in the code, when I try to get =
> the selection from the ISelectionProvider:
> 
> 						ISelection selection =3D selectionProvider.getSelection();
> 
> When I step over this line I get a CoreException ("Invalid thread =
> access"). So it seems there is no straightforward way to access GUI =
> components from the LauchConfigurationDelegate.
> 
> Any hints on this?
> 

In Eclipse, graphics calls have to be in the UI thread.
There is a strong dichotomy between Core vs UI
You will need to wrap you code in a runnable and post it the to the UI thread:
	Display.getCurrent().asyncExec(new Runnable() { ...});

But this may not be necessary see the previous post.



Back to the top