[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-users] [udig-devel] Mouse Event
|
Please Alberto,
do not crosspost development questions in the user list.
The udig-devel is here for that.
Closing this thread in the users list now.
[...]
> Exception in thread "AWT-EventQueue-0" 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
> net.refractions.udig.tools.edit.MouseTracker.checkAccess(MouseTracker.java:96)
> at
> net.refractions.udig.tools.edit.MouseTracker.updateState(MouseTracker.java:56)
> at
> net.refractions.udig.tools.edit.EditToolHandler.handleEvent(EditToolHandler.java:227)
> at
> net.refractions.udig.tools.edit.AbstractEditTool.onMousePressed(AbstractEditTool.java:235)
> at
> net.refractions.udig.project.ui.tool.SimpleTool.mousePressed(SimpleTool.java:142)
You should run this in the UI thread, which you can do with:
Display.getDefault().asyncExec(new Runnable(){
public void run() {
// do your stuff here
}
});
Ciao,
Andrea
>
> In particular in the method checkAccess() in the class MouseTracker:
>
> private void checkAccess() {
> if( Display.getCurrent()==null )
> SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
> }
>
>
> Alberto.
>
>
> 2012/2/6 Jody Garnett <jody.garnett@xxxxxxxxx>
>>
>> Mouse events are sent to the current tool. Tour can hunt down this
>> tool (use applicationgis to find the tool manager) and then send it
>> mouse event objects. You may wish to do so from the display thread.
>>
>> To simulate mouse and keyboard interaction more generally for test
>> cases use SWTBot
>>
>> --
>> Jody Garnett
>>
>> On 07/02/2012, at 12:31 AM, Alberto Debiasi <debiasi.alberto@xxxxxxxxx>
>> wrote:
>>
>> > Hello everybody,
>> >
>> > How can I "emulate" the click of the mouse on the map?
>> >
>> > For example with a command like this:
>> >
>> > .clickOnTheMap(currentMap,coordinates);
>> >
>> > Thanks.
>> > Alberto
>> > _______________________________________________
>> > User-friendly Desktop Internet GIS (uDig)
>> > http://udig.refractions.net
>> > http://lists.refractions.net/mailman/listinfo/udig-devel
>> _______________________________________________
>> udig-users mailing list
>> udig-users@xxxxxxxxxxxxxxxxxxxxx
>> http://lists.refractions.net/mailman/listinfo/udig-users
>
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>