Revision 26053 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditRemoveRowExtension.java
TableEditRemoveRowExtension.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 |
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel;
|
|
43 |
import org.gvsig.fmap.dal.exception.DataException;
|
|
44 | 44 |
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.andami.plugins.Extension; |
|
47 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
48 | 45 |
|
49 |
|
|
50 | 46 |
/** |
51 | 47 |
* DOCUMENT ME! |
52 | 48 |
* |
53 | 49 |
* @author Vicente Caballero Navarro |
54 | 50 |
*/ |
55 |
public class TableEditRemoveRowExtension extends Extension { |
|
56 |
/** |
|
57 |
* @see com.iver.andami.plugins.IExtension#initialize() |
|
58 |
*/ |
|
59 |
public void initialize() { |
|
60 |
} |
|
51 |
public class TableEditRemoveRowExtension extends AbstractTableEditExtension { |
|
61 | 52 |
|
62 | 53 |
/** |
63 | 54 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
64 | 55 |
*/ |
65 | 56 |
public void execute(String actionCommand) { |
66 | 57 |
if ("REMOVEROW".equals(actionCommand)) { |
67 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
68 |
|
|
69 |
// try { |
|
70 |
// ((FeatureTableDocumentPanel) v).removeFeature(); |
|
71 |
// } catch (ReadException e) { |
|
72 |
// NotificationManager.addError("No se pudo elimnar la fila", e); |
|
73 |
// } |
|
58 |
try{ |
|
59 |
featureTableOperations.setStore(table.getModel().getStore()); |
|
60 |
featureTableOperations.deleteFeatures(); |
|
61 |
} catch (DataException e) { |
|
62 |
e.printStackTrace(); |
|
63 |
} |
|
74 | 64 |
} |
75 | 65 |
} |
76 | 66 |
|
... | ... | |
78 | 68 |
* @see com.iver.andami.plugins.IExtension#isEnabled() |
79 | 69 |
*/ |
80 | 70 |
public boolean isEnabled() { |
81 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
82 |
|
|
83 |
if (v == null) { |
|
84 |
return false; |
|
85 |
} |
|
86 |
|
|
87 |
if (v instanceof FeatureTableDocumentPanel) { |
|
88 |
//FIXME |
|
89 |
// return (((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) && ((FeatureTableDocumentPanel) v).getSelectedRowIndices().length>0; |
|
90 |
} |
|
91 |
|
|
71 |
try { |
|
72 |
if (table.getTablePanel().getTable().getSelectedRowCount()>0) |
|
73 |
return true; |
|
74 |
} catch (DataException e) { |
|
75 |
e.printStackTrace(); |
|
76 |
} |
|
92 | 77 |
return false; |
93 | 78 |
} |
94 |
|
|
95 |
/** |
|
96 |
* @see com.iver.andami.plugins.IExtension#isVisible() |
|
97 |
*/ |
|
98 |
public boolean isVisible() { |
|
99 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
|
100 |
|
|
101 |
if (v == null) { |
|
102 |
return false; |
|
103 |
} else if (v instanceof FeatureTableDocumentPanel && ((FeatureTableDocumentPanel) v).getModel().getStore().isEditing()) { |
|
104 |
return true; |
|
105 |
} else { |
|
106 |
return false; |
|
107 |
} |
|
108 |
} |
|
109 | 79 |
} |
Also available in: Unified diff