Revision 28616 trunk/extensions/extAnnotations/src/org/gvsig/tools/annotations/labeling/gui/ConfigTargetLayer.java

View differences:

ConfigTargetLayer.java
223 223
	private FileTextField getFileNameField() {
224 224
		if (ftf_fileName==null) {
225 225
			ftf_fileName = new FileTextField(this.getClass().getName());
226
			ftf_fileName.setAcceptAllFileFilterUsed(false);
226 227
			ftf_fileName.addChoosableFileFilter(new FileFilter() {
227 228

  
228 229
				public boolean accept(File f) {
......
351 352
					}
352 353
				}
353 354
				// open the layer
354
				Annotation_Layer layer = Annotation_LayerFactory.createLayer(file.getName(), file, sourceView.getProjection(), CartographicSupportToolkit.DefaultMeasureUnit);
355
				sourceView.getMapControl().getMapContext().getLayers().addLayer(layer);
356
				toolUI.setTargetLayer(layer);
357
				return true;
355
				try {
356
					Annotation_Layer layer = Annotation_LayerFactory.createLayer(file.getName(), file, sourceView.getProjection(), CartographicSupportToolkit.DefaultMeasureUnit);
357
					if (layer!=null) {
358
						sourceView.getMapControl().getMapContext().getLayers().addLayer(layer);
359
						toolUI.setTargetLayer(layer);
360
						return true;
361
					}
362
				} catch (Exception ex) {
363
					NotificationManager.showMessageError(
364
							PluginServices.getText(this, "Error_opening_annotation_layer"),
365
							ex);
366
					return false;
367
				}
358 368
			}
359 369
		}
360 370
		NotificationManager.showMessageError(

Also available in: Unified diff