Thanks; I was able to fix the enablement of the initial Zoom tool by update 
the MapEditorWithPalette.  

It has a part listener (to determine when the editor has focus and reset the 
tool manager to pay attention to the editor); I updated this code to set the 
active tool; and everything went fine from there...  

--  
Jody Garnett


On Thursday, 18 August 2011 at 4:18 PM, Scott Henderson wrote:

> Committed and pushed.
>  
> Scott.
>  
> From: Jody Garnett [mailto:[email protected]]  
> Sent: Thursday, August 18, 2011 3:21 PM
> To: Scott Henderson
> Cc: User-friendly Internet GIS
> Subject: Re: default tool example  
>  
> That is *great* so we are half way there ...  
>  
>  
>  
> if you look at the other email about "hooking stuff" up (How to run modal 
> toolbar contributions) I think we can handle the other half of the problem.
>  
>  
>  
> Can you commit the code to make the correct tool highlighted in the palette
>  
> a) our screen snaps will be correct
>  
> b) we can tackle registering the correct tool with the map as a separate 
> problem
>  
>  
>  
>  --  
>  Jody Garnett
>  
>  
> On Thursday, 18 August 2011 at 3:44 PM, Scott Henderson wrote:
> > Thanks for that Jody,  
> >  
> > Unfortunately root.setDefaultEntry(tool); set’s Zoom as highlighted in the 
> > palette, but the tool is still not active so dragging the mouse does not 
> > zoom in.
> >  
> > I have also tried using a ToolProxy as such:
> >  
> >  
> >  ToolProxy toolProxy = (ToolProxy) modalItem;
> >  
> >  toolProxy.setActive(true);  
> >  
> > But that was no help either.
> >  
> > At this moment I am still stuck so moving onto another issue and hopefully 
> > someone has an idea as to how to get the Zoom tool active as default.
> >  
> > Thanks, Scott.
> >  
> > From: Jody Garnett [mailto:[email protected]]  
> > Sent: Thursday, August 18, 2011 11:52 AM
> > To: User-friendly Internet GIS
> > Cc: Scott Henderson
> > Subject: default tool example  
> >  
> > Hi Scott:  
> >  
> >  
> >  
> > I am trying to hunt down example(s).
> >  
> >  
> >  
> > There is what I have sorted ...
> >  
> >  
> >  
> > 1) ToolManager owns the concept of the default tool ...
> >  
> >  
> >  
> > ToolManager.defaultModalToolProxy
> >  
> >  
> >  
> > 2) this method has package visibility; and is accessed directly (there is 
> > no getter!)
> >  
> >  
> >  
> > Here is an example of MenuToolCategory checking if its new menu item is the 
> > default (and thus should start out life selected)
> >  
> >  
> >  
> > menuItem = new MenuItem(parent, SWT.RADIO, index);
> >  
> >  
> > menuItem.setText(tool.getName());
> >  
> >  
> > menuItem.setImage(tool.getImage());
> >  
> >  
> > if (items.contains( ((ToolManager)manager).defaultModalToolProxy))
> >  
> >  
> > menuItem.setSelection(true);
> >  
> >  
> >  
> > 3) there is also a static final ToolProxy.DEFAULT_ID which is how it 
> > figures out which thing to use as the defaultModalTool
> >  
> >  
> >  
> >  
> >  /**
> >  
> >  
> >  * The ID of the default tool: Zoom
> >  
> >  
> >  */
> >  
> >  
> > private static final String DEFAULT_ID = "net.refractions.udig.tools.Zoom"; 
> > //$NON-NLS-1$
> >  
> >  
> >  
> >  
> > 4) The ToolPalette has the concept of a default entry; so our 
> > MapToolPaletteFactory could perform a similar check to above
> >  
> >  
> >  
> >  So perhaps something like the following will work?
> >  
> >  
> >  
> >  for( ModalItem modalItem : category ) {
> >  
> >  
> >  String label = fixLabel(modalItem.getName());
> >  
> >  
> >  ToolEntry tool = new MapToolEntry(label, modalItem, category.getId());
> >  
> >  
> >  if( ToolProxy.DEFAULT_ID.equals( tool.getId() ) ){
> >  
> >  
> >  root.setDefaultEntry( tool ); // will this work??
> >  
> >  
> >  }
> >  
> >  
> >  drawer.add(tool);
> >  
> >  
> >  }
> >  
> >  
> > --  
> >  Jody Garnett
> >  
> >  
> >  
> >  
> >  
> > The contents of this email are confidential and may be subject to legal or 
> > professional privilege and copyright. No representation is made that this 
> > email is free of viruses or other defects. If you have received this 
> > communication in error, you may not copy or distribute any part of it or 
> > otherwise disclose its contents to anyone. Please advise the sender of your 
> > incorrect receipt of this correspondence.
> >  
> >  
> >  
>  
>  
>  
>  
>  
> The contents of this email are confidential and may be subject to legal or 
> professional privilege and copyright. No representation is made that this 
> email is free of viruses or other defects. If you have received this 
> communication in error, you may not copy or distribute any part of it or 
> otherwise disclose its contents to anyone. Please advise the sender of your 
> incorrect receipt of this correspondence.

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

Reply via email to