Revision 24759 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/actions/CopyPasteLayersUtiles.java
CopyPasteLayersUtiles.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.ArrayList; |
4 | 4 |
|
5 |
import org.gvsig.fmap.data.ReadException; |
|
6 | 5 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
7 | 6 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
8 | 7 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
9 |
import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
|
10 | 8 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
11 | 9 |
|
12 | 10 |
import com.iver.andami.PluginServices; |
... | ... | |
15 | 13 |
import com.iver.cit.gvsig.project.Project; |
16 | 14 |
import com.iver.cit.gvsig.project.documents.ProjectDocument; |
17 | 15 |
import com.iver.cit.gvsig.project.documents.exceptions.OpenException; |
18 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
|
19 | 16 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
20 | 17 |
import com.iver.cit.gvsig.project.documents.table.ProjectTableFactory; |
21 | 18 |
import com.iver.utiles.XMLEntity; |
... | ... | |
40 | 37 |
XMLEntity xmlDataSources = this.newDataSourcesNode(); |
41 | 38 |
|
42 | 39 |
for (int i=0;i < actives.length; i++) { |
43 |
if (!this.addToXMLLayer(actives[i],xmlLayers ,xmlTables,xmlDataSources)) return null; |
|
40 |
if (!this.addToXMLLayer(actives[i],xmlLayers ,xmlTables,xmlDataSources)) { |
|
41 |
return null; |
|
42 |
} |
|
44 | 43 |
|
45 | 44 |
} |
46 | 45 |
|
... | ... | |
75 | 74 |
XMLEntity xmlTables = xml.firstChild("type","tables"); |
76 | 75 |
XMLEntity xmlDataSources = xml.firstChild("type","dataSources"); |
77 | 76 |
|
78 |
if (xmlLayers == null ) return false; |
|
77 |
if (xmlLayers == null ) { |
|
78 |
return false; |
|
79 |
} |
|
79 | 80 |
|
80 | 81 |
// Se pegan las tablas igualmente |
81 | 82 |
/* |
... | ... | |
86 | 87 |
|
87 | 88 |
|
88 | 89 |
if (xmlDataSources != null) { |
89 |
if (!this.registerDataSources(xmlDataSources)) return false; |
|
90 |
if (!this.registerDataSources(xmlDataSources)) { |
|
91 |
return false; |
|
92 |
} |
|
90 | 93 |
} |
91 | 94 |
|
92 |
if (!this.addLayers(xmlLayers,root)) return false; |
|
95 |
if (!this.addLayers(xmlLayers,root)) { |
|
96 |
return false; |
|
97 |
} |
|
93 | 98 |
|
94 | 99 |
if (xmlTables != null) { |
95 |
if (!this.addTables(xmlTables)) return false; |
|
100 |
if (!this.addTables(xmlTables)) { |
|
101 |
return false; |
|
102 |
} |
|
96 | 103 |
} |
97 | 104 |
|
98 | 105 |
return true; |
... | ... | |
104 | 111 |
XMLEntity xmlDataSources = xml.firstChild("type","dataSources"); |
105 | 112 |
|
106 | 113 |
|
107 |
if (xmlTables == null ) return false; |
|
114 |
if (xmlTables == null ) { |
|
115 |
return false; |
|
116 |
} |
|
108 | 117 |
|
109 | 118 |
/* |
110 | 119 |
Project project = this.getProject(); |
... | ... | |
113 | 122 |
*/ |
114 | 123 |
|
115 | 124 |
if (xmlDataSources != null) { |
116 |
if (!this.registerDataSources(xmlDataSources)) return false; |
|
125 |
if (!this.registerDataSources(xmlDataSources)) { |
|
126 |
return false; |
|
127 |
} |
|
117 | 128 |
} |
118 | 129 |
|
119 | 130 |
|
... | ... | |
123 | 134 |
|
124 | 135 |
|
125 | 136 |
public boolean checkXMLRootNode(XMLEntity xml) { |
126 |
if (!xml.contains("applicationName")) return false; |
|
127 |
if (!xml.getStringProperty("applicationName").equalsIgnoreCase("gvSIG")) return false; |
|
137 |
if (!xml.contains("applicationName")) { |
|
138 |
return false; |
|
139 |
} |
|
140 |
if (!xml.getStringProperty("applicationName").equalsIgnoreCase("gvSIG")) { |
|
141 |
return false; |
|
142 |
} |
|
128 | 143 |
|
129 |
if (!xml.contains("version")) return false; |
|
130 |
if (!xml.getStringProperty("version").equalsIgnoreCase(Version.format())) return false; |
|
144 |
if (!xml.contains("version")) { |
|
145 |
return false; |
|
146 |
} |
|
147 |
if (!xml.getStringProperty("version").equalsIgnoreCase(Version.format())) { |
|
148 |
return false; |
|
149 |
} |
|
131 | 150 |
|
132 | 151 |
return true; |
133 | 152 |
} |
... | ... | |
192 | 211 |
private boolean addTables(XMLEntity xmlTables) { |
193 | 212 |
try { |
194 | 213 |
int numTables = xmlTables.getChildrenCount(); |
195 |
if (numTables == 0) return true; |
|
214 |
if (numTables == 0) { |
|
215 |
return true; |
|
216 |
} |
|
196 | 217 |
|
197 | 218 |
Project project = this.getProject(); |
198 | 219 |
|
Also available in: Unified diff