Revision 31496 branches/v2_0_0_prep/extensions/extWMS/src/org/gvsig/wmc/ImportWebMapContextExtension.java
ImportWebMapContextExtension.java | ||
---|---|---|
110 | 110 |
import org.gvsig.andami.messages.NotificationManager; |
111 | 111 |
import org.gvsig.andami.plugins.Extension; |
112 | 112 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
113 |
import org.gvsig.app.extension.ProjectExtension; |
|
114 | 113 |
import org.gvsig.app.project.Project; |
115 |
import org.gvsig.app.project.ProjectFactory; |
|
116 |
import org.gvsig.app.project.documents.view.ProjectView; |
|
117 |
import org.gvsig.app.project.documents.view.gui.View; |
|
114 |
import org.gvsig.app.project.ProjectManager; |
|
115 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
116 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
117 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
118 | 118 |
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException; |
119 | 119 |
import org.gvsig.gui.beans.swing.JFileChooser; |
120 | 120 |
import org.gvsig.wms.fmap.drivers.wms.FMapWMSDriver; |
... | ... | |
158 | 158 |
// If the current active view is a gvSIG's view, we'll keep its name to |
159 | 159 |
// show it at the JFileChooser's accessory. |
160 | 160 |
String currentViewName; |
161 |
if (v instanceof View) {
|
|
162 |
currentViewName = ((View) v).getModel().getName();
|
|
161 |
if (v instanceof DefaultViewPanel) {
|
|
162 |
currentViewName = ((DefaultViewPanel) v).getModel().getName();
|
|
163 | 163 |
} else { |
164 | 164 |
currentViewName = null; |
165 | 165 |
} |
... | ... | |
190 | 190 |
* @param wmcFile |
191 | 191 |
* @param dstView |
192 | 192 |
*/ |
193 |
private void readMapContextFile(File wmcFile, ProjectView dstView) {
|
|
193 |
private void readMapContextFile(File wmcFile, DefaultViewDocument dstView) {
|
|
194 | 194 |
WebMapContext wmc = new WebMapContext(); |
195 | 195 |
try { |
196 | 196 |
wmc.readFile(wmcFile); |
... | ... | |
224 | 224 |
if (dstView == null) { |
225 | 225 |
// Since the destination view is null, a new one will be added to |
226 | 226 |
// the project. |
227 |
dstView = ProjectFactory.createView(null); |
|
227 |
// dstView = ProjectFactory.createView(null); |
|
228 |
dstView = (DefaultViewDocument) ProjectManager.getInstance().createDocument(ViewManager.TYPENAME); |
|
229 |
|
|
228 | 230 |
dstView.setName(wmc.title); |
229 | 231 |
dstView.setComment("Created from WebMapContext file: "+wmcFile.getName()); |
230 | 232 |
|
231 |
ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
|
232 |
Project theProject = pe.getProject(); |
|
233 |
theProject.addDocument(dstView);
|
|
233 |
// ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
|
|
234 |
// Project theProject = pe.getProject();
|
|
235 |
final Project theProject = ProjectManager.getInstance().getCurrentProject();
|
|
234 | 236 |
|
237 |
theProject.add(dstView); |
|
238 |
|
|
235 | 239 |
// show the view in a new window |
236 |
View v = null;
|
|
237 |
v = new View();
|
|
240 |
DefaultViewPanel v = null;
|
|
241 |
v = new DefaultViewPanel();
|
|
238 | 242 |
v.initialize(); |
239 | 243 |
v.setModel(dstView); |
240 | 244 |
PluginServices.getMDIManager().addWindow(v); |
Also available in: Unified diff