Thanks Johan - I&#39;m messing with it like this, for now...:-)<br><div>@Override</div><div>    public void actionPerformed(ActionEvent e) {</div><div><br></div><div>        Collection&lt;Radar&gt; radars = (Collection&lt;Radar&gt;) Lookup.getDefault().lookupAll(Radar.class);</div>
<div>        GISProject project = (GISProject) OpenProjects.getDefault().getMainProject();</div><div>        for (MapContext context : project.getContexts()) {</div><div>            for (Radar radar : radars) {</div><div>
                TargetMapLayer targetLayer = new TargetMapLayer(radar.getTargetManager());</div><div>                context.layers().add(targetLayer);</div><div>                RadarLayer radarLayer = new RadarLayer(radar);</div>
<div>                context.layers().add(radarLayer);</div><div>            }</div><div>        }</div><div>    }</div><div><br></div><div>The auto map save mechanism of course now adds these &quot;ephemeral&quot; layers. But I&#39;ll look into that during the day.</div>
<div><br></div><div>Thanks again.</div><div><br></div><div class="gmail_quote">On Tue, Aug 2, 2011 at 8:40 PM, sorel johann <span dir="ltr">&lt;<a href="mailto:johann.sorel@geomatys.fr">johann.sorel@geomatys.fr</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><u></u>

  
    
    
  
  <div bgcolor="#ffffff" text="#000000">
    Hi thys,<br>
    <br>
    Macontext objects are not always loaded from the start since that
    may imply loading plenty of datastores or coverage readers.<br>
    Unfortunatly there are no lookup which contain all Mapcontext but I
    see three alternatives.<br>
    <br>
    1 - You can acces the currents projects with :<br>
    GISProject project = OpenProjects.getDefault().getMainProject();<br>
    or Project[] projects = OpenProjects.getDefault().getOpenProjects();<br>
    and use project.getContexts() to get all MapContexts. and mess them
    as much as you want.<br>
    <br>
    2 - Like above when you have the project you can get the Map folder
    object :<br>
    FileObject obj = project.getMapFolder(true);<br>
    and then attach a listener on this one to be noticed when a new
    mapcontext file is added.<br>
    <br>
    3 - Make a patch for the GisProject lookup implementation to forward
    all events on creation/deletion of Mapcontexts ;-)<br>
    <br>
    johann<div><div></div><div class="h5"><br>
    <br>
    On 02/08/2011 18:55, Thys Meintjes wrote:
    </div></div><blockquote type="cite"><div><div></div><div class="h5">Hi All,
      <div><br>
      </div>
      <div>I&#39;m building a application on top of puzzle-gis. I want to
        add extra layers to all MapContext&#39;s currently loaded in the
        puzzle-gis application. Is there a convenient Lookup that </div>
      <div>
        has all instances of currently loaded mapContexts ? Maybe
        all GISContextDataObject&#39;s are available in a lookup ?</div>
      <div><br>
      </div>
      <div>Thanks and regards<br clear="all">
        <br>
        -- <br>
        Thys Meintjes<br>
        <br>
        <br>
      </div>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
Geotoolkit mailing list
<a href="mailto:Geotoolkit@lists.osgeo.org" target="_blank">Geotoolkit@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/geotoolkit" target="_blank">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Geotoolkit mailing list<br>
<a href="mailto:Geotoolkit@lists.osgeo.org">Geotoolkit@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geotoolkit" target="_blank">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thys Meintjes<br><br><br>