In particular the following looks to be where the side effects occur... 

public void setActiveEditor(IEditorPart targetEditor) { 
super.setActiveEditor(targetEditor);
 IToolManager toolManager = ApplicationGIS.getToolManager();
 toolManager.contributeGlobalActions(targetEditor, getActionBars());
 toolManager.registerActionsWithPart(targetEditor);
 getActionBars().updateActionBars();
}

So MapEditorActionBarContributor took on the job of wiring up the TooManager 
with the current editor; we need to relocate this code somewhere ... options?

a) MapViewer.init( IWorkBenchPart part )

This is a good candidate as it is when we make the association between the Map 
and our MapEditDomain...

/** 
 * Used to internal "MapPart" to the provided WorkbenchPart
 * (any status messages etc.. would be sent to the view or 
 * editor provided).
 * <p>
 * This is an *optional* step; if you can call this method
 * setSelectionProvider will work.
 * </p>
 * @param part Editor or View workbench part
 */
public void init( IWorkbenchPart part ){
this.part = part;
this.mapPart = (MapPart) part;

 MapEditDomain editDomain = mapPart.getEditDomain();
 editDomain.setMapViewer( this );
 }


b) MapEditorActionBarContributor

 Yes we could still do it here; the life cycle for this beast is that it is 
called when we switch between editors ...
 In this case we would no longer be able to do things exactly the same (as we 
no longer have actions to call).

 You may want to talk to Levi who looked at the difference between actions and 
commands / handlers for recent cheat sheet work.

General feedback - MapPart would be much nicer if it gave us access to the 
MapViewer; I may ask if we can change the Interface in that direction ...
-- 
Jody Garnett


On Thursday, 18 August 2011 at 12:27 PM, Jody Garnett wrote:

>  Hi Scott: 
> 
> The code to do the modal toolbar contributions seems to have some fun side 
> effects
> a) keyboard bindings work
> b) default tool activated (not sure if it is set on the MapViewer or just 
> activated)
> 
> To try these things out; so you can step through with a debugger and 
> reproduce the same side effects ....
> 
> 1) Open up MapEditorActionBarContributor
> 
> 2) Edit the following
> 
> private boolean isModalIncluded = false;
> 
> 3) Set the value to true and run your app; and have fun with the debugger 
> 
> -- 
> Jody Garnett
> 

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

Reply via email to