well, this can me util for someone, i resolve me probleme doing:<br><br>IWindow iwin = PluginServices.getMDIManager().getActiveWindow();<br><br>            MapControl mapControl = null;<br>            View vista = null;<br>

            if(iwin instanceof View)<br>                mapControl = ((View) iwin).getMapControl();<br>            else<br>                if(iwin instanceof ProjectWindow){<br>                     vista = new View();<br>

                     ProjectView pv = ProjectFactory.createView(&quot;view 1&quot;);<br>                    <br>                     vista.initialize();<br>                     vista.setModel(pv);<br>                   <br>

                     Project p = new Project();<br>                     ((Project) p).addDocument(pv);<br>                     ((ProjectWindow) iwin).setProject(p);<br>                     <br>                     <br>                     mapControl = vista.getMapControl();<br>

                     PluginServices.getMDIManager().addWindow(vista);<br>                }<br><br>Best regards. <br><div class="gmail_quote">On Fri, Apr 23, 2010 at 1:12 AM, Bruno Gomes <span dir="ltr">&lt;<a href="mailto:semog15@gmail.com" target="_blank">semog15@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I need to add a new layer to the current ProjectWindow, my code looks like:<br><br>IWindow iwin = PluginServices.getMDIManager().getActiveWindow();<br>         <br>                if(iwin instanceof ProjectWindow){<br><br>



                     View vista = new View();<br>                     ProjectView pvb = new ProjectView();<br>                     <br>                     vista.initialize();<br>                     vista.setModel(pvb);<br>



                     PluginServices.getMDIManager().addWindow(vista); <br>                }<br>                   <br>But i get a error[1] when i try to set the view model.<br>How should i set the ProjectView? Any ideas?<br>



<br>java.lang.NullPointerException<br>    at com.iver.cit.gvsig.project.documents.view.gui.View.setModel(View.java:172)<br>                    <br>        <br clear="all"><br>-- <br><font color="#888888">Bruno Gomes<br>
</font></blockquote></div><br>Well, for further reference, i olve the problem by doing:<br><br>IWindow iwin = PluginServices.getMDIManager().getActiveWindow();<br><br>            MapControl mapControl = null;<br>            View vista = null;<br>


            if(iwin instanceof View)<br>                mapControl = ((View) iwin).getMapControl();<br>            else<br>                if(iwin instanceof ProjectWindow){<br>            <br>                     vista = new View();<br>


                     ProjectView pv = ProjectFactory.createView(&quot;view 1&quot;);<br>                     <br>                     <br>                     vista.initialize();<br>                     vista.setModel(pv);<br>


                     <br>                     <br>                     Project p = new Project();<br>                     ((Project) p).addDocument(pv);<br>                     ((ProjectWindow) iwin).setProject(p);<br>                     <br>


                     <br>                     mapControl = vista.getMapControl();<br>                     PluginServices.getMDIManager().addWindow(vista);<br>                }<br clear="all"><br>-- <br>Bruno Gomes<br>