Anything that interacts with the UI must be sent to the display thread. You need to send a IDrawCommand, which is ran in the UI thread. Or use getContext().getDisplay().asyncExec( runnable ). PlatformGIS also has useful methods for interacting with the UI.

Jesse

On 9-Sep-08, at 10:07 AM, Aritz Dávila wrote:

Hi uDiggers,

We are developing a tool against udig sdk rc14.

Its workflow is similar as the one of the InfoTool.

InfoTool:
User activates the tool->He interacts with the map-> A view is shown with the
result.

Our tool:
User activates the tool and a view is opened->He interacts with the
map->Commands are launched-> Map has changed and as feedback, the view is
updated.

The problem I'm having is that I can't update the view from the command because view and commands are on different threads. This is the error I get:

org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:3563)
        at org.eclipse.swt.SWT.error(SWT.java:3481)
        at org.eclipse.swt.SWT.error(SWT.java:3452)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:438)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:377)
        at org.eclipse.swt.custom.CLabel.setText(CLabel.java:731)
        ...
        ..
        .

I would like to know if there is a way for the tool to catch the feedback of the command, so I can know when the command has finalized its run method.

Anyone can tell me if that is possible?

Cheers,

Aritz Dávila
www.axios.es

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to