Revision 24962 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/UndoTableExtension.java
UndoTableExtension.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import org.gvsig.fmap.dal.exception.DataException; |
44 | 44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
45 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel; |
|
45 | 46 |
|
46 | 47 |
import com.iver.andami.PluginServices; |
47 | 48 |
import com.iver.andami.messages.NotificationManager; |
48 | 49 |
import com.iver.andami.plugins.Extension; |
49 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
|
50 | 50 |
|
51 | 51 |
|
52 | 52 |
/** |
... | ... | |
74 | 74 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
75 | 75 |
*/ |
76 | 76 |
public void execute(String s) { |
77 |
Table tabla = (Table) PluginServices.getMDIManager().getActiveWindow();
|
|
77 |
FeatureTableDocumentPanel tabla = (FeatureTableDocumentPanel) PluginServices.getMDIManager().getActiveWindow();
|
|
78 | 78 |
|
79 | 79 |
if (s.compareTo("UNDO") == 0) { |
80 |
if (tabla.isEditing()){ |
|
81 |
FeatureStore fs=tabla.getModel().getModel();
|
|
80 |
if (tabla.getModel().getStore().isEditing()){
|
|
81 |
FeatureStore fs=tabla.getModel().getStore();
|
|
82 | 82 |
try { |
83 | 83 |
fs.undo(); |
84 | 84 |
fs.getFeatureSelection().deselectAll(); |
... | ... | |
95 | 95 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
96 | 96 |
*/ |
97 | 97 |
public boolean isEnabled() { |
98 |
Table tabla = (Table) PluginServices.getMDIManager().getActiveWindow();
|
|
98 |
FeatureTableDocumentPanel tabla = (FeatureTableDocumentPanel) PluginServices.getMDIManager().getActiveWindow();
|
|
99 | 99 |
//MapControl mapControl = (MapControl) vista.getMapControl(); |
100 | 100 |
//FLayers layers=mapControl.getMapContext().getLayers(); |
101 | 101 |
//for (int i=0;i<layers.getLayersCount();i++){ |
102 |
if (tabla.getModel().getModel() instanceof FeatureStore && tabla.isEditing()){
|
|
103 |
FeatureStore fs = tabla.getModel().getModel();
|
|
102 |
FeatureStore fs=tabla.getModel().getStore();
|
|
103 |
if (fs.isEditing()){
|
|
104 | 104 |
if (fs==null) { |
105 | 105 |
return false; |
106 | 106 |
} |
107 | 107 |
try { |
108 |
return fs.getCommandsRecord().moreUndoCommands();
|
|
108 |
return fs.getCommandsRecord().canUndo();
|
|
109 | 109 |
} catch (DataException e) { |
110 | 110 |
// TODO Auto-generated catch block |
111 | 111 |
e.printStackTrace(); |
... | ... | |
127 | 127 |
return false; |
128 | 128 |
} |
129 | 129 |
|
130 |
if (f instanceof Table) {
|
|
130 |
if (f instanceof FeatureTableDocumentPanel) {
|
|
131 | 131 |
return true; |
132 | 132 |
} else { |
133 | 133 |
return false; |
Also available in: Unified diff