Revision 38381 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StartEditing.java
StartEditing.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import javax.swing.JOptionPane; |
6 | 6 |
|
7 |
import org.slf4j.Logger; |
|
8 |
import org.slf4j.LoggerFactory; |
|
9 |
|
|
7 | 10 |
import org.gvsig.andami.PluginServices; |
11 |
import org.gvsig.andami.messages.Messages; |
|
8 | 12 |
import org.gvsig.andami.messages.NotificationManager; |
9 | 13 |
import org.gvsig.andami.plugins.Extension; |
14 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
15 |
import org.gvsig.app.ApplicationLocator; |
|
10 | 16 |
import org.gvsig.app.extension.ProjectExtension; |
11 | 17 |
import org.gvsig.app.project.documents.view.ViewDocument; |
12 | 18 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
... | ... | |
28 | 34 |
* @author Vicente Caballero Navarro |
29 | 35 |
*/ |
30 | 36 |
public class StartEditing extends Extension { |
37 |
|
|
38 |
private static Logger logger = LoggerFactory.getLogger(StartEditing.class); |
|
31 | 39 |
|
32 | 40 |
// private class MyAction extends AbstractAction |
33 | 41 |
// { |
... | ... | |
49 | 57 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String) |
50 | 58 |
*/ |
51 | 59 |
public void execute(String actionCommand) { |
52 |
CADExtension.initFocus(); |
|
60 |
|
|
53 | 61 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
54 | 62 |
.getActiveWindow(); |
55 | 63 |
|
... | ... | |
60 | 68 |
ViewDocument model = vista.getModel(); |
61 | 69 |
FLayer[] actives = model.getMapContext().getLayers().getActives(); |
62 | 70 |
|
63 |
boolean bEditingStarted = false; |
|
71 |
// boolean bEditingStarted = false;
|
|
64 | 72 |
if (actives.length == 1 && actives[0] instanceof FLyrVect) { |
65 | 73 |
|
74 |
FLyrVect lv = (FLyrVect) actives[0]; |
|
75 |
|
|
76 |
if (!lv.getFeatureStore().getTransforms().isEmpty()) { |
|
77 |
|
|
78 |
// cannot edit transformed |
|
79 |
JOptionPane.showMessageDialog( |
|
80 |
(Component) f, |
|
81 |
Messages.get("_Cannot_start_edition_in_transformed_layer") |
|
82 |
+ ": '" + lv.getName() + "'", |
|
83 |
PluginServices.getText(this, "warning_title"), |
|
84 |
JOptionPane.INFORMATION_MESSAGE); |
|
85 |
return; |
|
86 |
} |
|
87 |
|
|
88 |
CADExtension.initFocus(); |
|
66 | 89 |
vista.showConsole(); |
67 | 90 |
EditionManager editionManager=CADExtension.getEditionManager(); |
68 | 91 |
editionManager.setMapControl(mapControl); |
... | ... | |
71 | 94 |
* layers.getLayer(j).setVisible(false); } |
72 | 95 |
*/ |
73 | 96 |
|
74 |
FLyrVect lv = (FLyrVect) actives[0]; |
|
75 | 97 |
// lv.setVisible(true); |
76 | 98 |
lv.addLayerListener(editionManager); |
77 | 99 |
try { |
78 |
ILegend legendOriginal=lv.getLegend().cloneLegend(); |
|
100 |
// ILegend legendOriginal=lv.getLegend().cloneLegend();
|
|
79 | 101 |
|
80 | 102 |
if (!lv.isWritable()) |
81 | 103 |
{ |
82 | 104 |
JOptionPane.showMessageDialog( |
83 |
(Component) PluginServices.getMDIManager().getActiveWindow(),
|
|
105 |
(Component) f,
|
|
84 | 106 |
PluginServices.getText(this, "this_layer_is_not_self_editable"), |
85 | 107 |
PluginServices.getText(this, "warning_title"), |
86 | 108 |
JOptionPane.WARNING_MESSAGE); |
... | ... | |
109 | 131 |
vista.repaintMap(); |
110 | 132 |
|
111 | 133 |
} catch (StartEditionLayerException e) { |
112 |
NotificationManager.addError(e.getMessage(),e); |
|
134 |
|
|
135 |
logger.info("Error while starting edition: " + e.getMessage(), e); |
|
136 |
|
|
137 |
ApplicationLocator.getManager().message( |
|
138 |
Messages.get("_Unable_to_start_edition_in_layer") + ": " + lv.getName(), |
|
139 |
JOptionPane.ERROR_MESSAGE); |
|
140 |
|
|
141 |
// NotificationManager.addError(e.getMessage(),e); |
|
113 | 142 |
// } catch (ReadException e) { |
114 | 143 |
// NotificationManager.addError(e.getMessage(),e); |
115 | 144 |
// } catch (DataException e) { |
Also available in: Unified diff