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