[udig-devel] Modal tool deactivation
Damjan Šavko
damjan.savd at gmail.com
Tue Aug 8 02:34:44 PDT 2006
Hi, I' ve started moving my plugins to uDig-RC2 (SDK) from uDig-M7(SDK) and
I've been having some troubles. The trick you showed me to deactivate a tool
in the toolbar: ApplicationGIS.getToolManager().getTool (
toolID,categoryID).run(); doesn't do the trick anymore. Instead of turning
the button off it turns it on (although is already on) throwing the tool in
an endless loop.
Also I've noticed that my drawing tools are acting very strange. To draw on
the map I use the folowing commands:
rect = new Rectangle(e.x - 10, e.y -10, 10, 10);
dsc = context.getDrawFactory().createDrawShapeCommand(rect,
java.awt.Color.GREEN, 1, 1);
dsc.setShape(rect);
dsc.setValid(true);
context.sendASyncCommand(dsc);
and
dsc.setValid(false);
context.sendASyncCommand(dsc);
to erase.
Do you know what were the changes from uDigM7 to uDigRC2 that caused my
plugins to stop working?
Thanks.
Damjan Šavko
On 7/21/06, Jesse Eichar <jeichar at refractions.net> wrote:
>
> The reason it works is because when you press the button the run methods
> is executed. So basically you need to simulate a button press... which
> calling run does.
> Jesse
>
> On 21-Jul-06, at 2:10 AM, Damjan Šavko wrote:
>
> Bingo Jesse! That really did the trick. I would have never thought to use
> the run() method inside a modal tool. I still don't know why that works but
> I don't really care that much :)
>
> Another thing: I can get the category ID by ApplicationGIS.getToolManager().getActiveCategory().getId()
> but I cannot do the same with tool ID. There is no
> ApplicationGIS.getToolManager().getActiveTool().getId().
> Anyway that's not such a big problem, it would've been just a bit more
> elegant.
>
> Thanks a lot!
>
> Damjan
>
>
>
> On 7/20/06, Jesse Eichar <jeichar at refractions.net> wrote:
> >
> > Hi
> >
> > The following snippet can be added to you setActiveMethod():
> >
> > Display.getCurrent().asyncExec(new Runnable(){
> > public void run(){
> > ApplicationGIS.getToolManager().getTool(toolID).run();
> > }
> > }
> >
> > I haven't actually tested this situation so let me know how it goes.
> > But theoretically it should work... :) If it doesn't file a bug
> > report and I will fix the issue.
> >
> > Jesse
> >
> > On 20-Jul-06, at 1:52 AM, Damjan Šavko wrote:
> >
> > > Hello, I'm making a modal tool to select certain features on the
> > > map. But certain types of data must be in the current map to use
> > > this tool. So I check if the conditions are valid using the
> > > function setActive(active) (which is run where the button is
> > > pressed) and that works fine. But if the conditions aren't true I
> > > would like to deactivate the button programatically so that the
> > > user wouldn't have to deactivate the button manually. Is there a
> > > way I could do that?
> > >
> > > Thanks for your help.
> > >
> > > Damjan
> > > _______________________________________________
> > > 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
> >
>
> _______________________________________________
> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20060808/975302a1/attachment.html
More information about the udig-devel
mailing list