Revision 26053 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/TableEditCopyExtension.java

View differences:

TableEditCopyExtension.java
40 40
 */
41 41
package com.iver.cit.gvsig;
42 42

  
43
import org.gvsig.fmap.dal.exception.DataException;
44
import org.gvsig.project.document.table.FeatureTableOperations;
43 45
import org.gvsig.project.document.table.gui.FeatureTableDocumentPanel;
44 46

  
45 47
import com.iver.andami.PluginServices;
......
52 54
 *
53 55
 * @author Vicente Caballero Navarro
54 56
 */
55
public class TableEditCopyExtension extends Extension {
56
    /**
57
public class TableEditCopyExtension extends AbstractTableEditExtension {
58

  
59
	/**
57 60
     * @see com.iver.andami.plugins.IExtension#initialize()
58 61
     */
59 62
    public void initialize() {
63
    	super.initialize();
60 64
    	registerIcons();
61 65
    }
62 66

  
......
71 75
     */
72 76
    public void execute(String actionCommand) {
73 77
        if ("COPY".equals(actionCommand)) {
74
            IWindow v = PluginServices.getMDIManager().getActiveWindow();
75
//			  FIXME
76
//            try {
77
//                ((FeatureTableDocumentPanel) v).copyFeature();
78
//            } catch (ReadException e) {
79
//				 NotificationManager.addError("No se pudo copiar la fila", e);
80
//			}
78
            try {
79
            	featureTableOperations.setStore(table.getModel().getStore());
80
            	featureTableOperations.copyFeatures();
81
			} catch (DataException e) {
82
				e.printStackTrace();
83
			}
81 84
        }
82 85
    }
83 86

  
......
85 88
     * @see com.iver.andami.plugins.IExtension#isEnabled()
86 89
     */
87 90
    public boolean isEnabled() {
88
    	IWindow v = PluginServices.getMDIManager().getActiveWindow();
89

  
90
        if (v == null) {
91
            return false;
92
        } else if (v.getClass() == FeatureTableDocumentPanel.class) {
93
//        	FIXME
94
//            return (((FeatureTableDocumentPanel) v).getSelectedRowIndices().length>0);
95
        }
91
    	try {
92
			if (table.getTablePanel().getTable().getSelectedRowCount()>0)
93
				return true;
94
		} catch (DataException e) {
95
			e.printStackTrace();
96
		}
96 97
        return false;
97 98
    }
98

  
99
    /**
100
     * @see com.iver.andami.plugins.IExtension#isVisible()
101
     */
102
    public boolean isVisible() {
103
        IWindow v = PluginServices.getMDIManager().getActiveWindow();
104

  
105
        if (v == null) {
106
            return false;
107
        } else if (v instanceof FeatureTableDocumentPanel) {
108
            return true;
109
        } else {
110
            return false;
111
        }
112
    }
113 99
}

Also available in: Unified diff