Revision 24962 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/RedoTableExtension.java
RedoTableExtension.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 |
/** |
... | ... | |
75 | 75 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
76 | 76 |
*/ |
77 | 77 |
public void execute(String s) { |
78 |
Table tabla = (Table) PluginServices.getMDIManager().getActiveWindow();
|
|
78 |
FeatureTableDocumentPanel tabla = (FeatureTableDocumentPanel) PluginServices.getMDIManager().getActiveWindow();
|
|
79 | 79 |
|
80 | 80 |
if (s.compareTo("REDO") == 0) { |
81 |
if (tabla.isEditing()){ |
|
82 |
FeatureStore fs=tabla.getModel().getModel();
|
|
81 |
if (tabla.getModel().getStore().isEditing()){
|
|
82 |
FeatureStore fs=tabla.getModel().getStore();
|
|
83 | 83 |
try { |
84 | 84 |
fs.redo(); |
85 | 85 |
fs.getFeatureSelection().deselectAll(); |
... | ... | |
96 | 96 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
97 | 97 |
*/ |
98 | 98 |
public boolean isEnabled() { |
99 |
Table tabla = (Table) PluginServices.getMDIManager().getActiveWindow();
|
|
99 |
FeatureTableDocumentPanel tabla = (FeatureTableDocumentPanel) PluginServices.getMDIManager().getActiveWindow();
|
|
100 | 100 |
//MapControl mapControl = (MapControl) vista.getMapControl(); |
101 | 101 |
//FLayers layers=mapControl.getMapContext().getLayers(); |
102 | 102 |
//for (int i=0;i<layers.getLayersCount();i++){ |
103 |
if (tabla.getModel().getModel() instanceof FeatureStore && tabla.isEditing()){ |
|
104 |
FeatureStore fs=tabla.getModel().getModel(); |
|
105 |
if (fs==null) { |
|
106 |
return false; |
|
107 |
} |
|
108 |
try { |
|
109 |
return fs.getCommandsRecord().moreRedoCommands(); |
|
110 |
} catch (DataException e) { |
|
111 |
// TODO Auto-generated catch block |
|
112 |
e.printStackTrace(); |
|
113 |
} |
|
103 |
FeatureStore fs=tabla.getModel().getStore(); |
|
104 |
if (fs.isEditing()){ |
|
105 |
if (fs==null) { |
|
106 |
return false; |
|
114 | 107 |
} |
108 |
try { |
|
109 |
return fs.getCommandsRecord().canRedo(); |
|
110 |
} catch (DataException e) { |
|
111 |
// TODO Auto-generated catch block |
|
112 |
e.printStackTrace(); |
|
113 |
} |
|
114 |
} |
|
115 | 115 |
|
116 | 116 |
//} |
117 | 117 |
return false; |
... | ... | |
128 | 128 |
return false; |
129 | 129 |
} |
130 | 130 |
|
131 |
if (f instanceof Table) {
|
|
131 |
if (f instanceof FeatureTableDocumentPanel) {
|
|
132 | 132 |
return true; |
133 | 133 |
} else { |
134 | 134 |
return false; |
Also available in: Unified diff