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

View differences:

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

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

  
46 47
import com.iver.andami.PluginServices;
47
import com.iver.andami.plugins.Extension;
48 48
import com.iver.andami.ui.mdiManager.IWindow;
49 49

  
50 50

  
......
53 53
 *
54 54
 * @author Vicente Caballero Navarro
55 55
 */
56
public class TableEditStartExtension extends Extension {
57
	 /**
58
     * @see com.iver.andami.plugins.IExtension#initialize()
59
     */
60
    public void initialize() {
61
    }
56
public class TableEditStartExtension extends AbstractTableEditExtension {
62 57

  
63 58
    /**
64 59
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
65 60
     */
66 61
    public void execute(String actionCommand) {
67 62
    	if ("STARTEDIT".equals(actionCommand)) {
68
    		IWindow v = PluginServices.getMDIManager().getActiveWindow();
69
//			FIXME
70
//    		try {
71
//    			FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) v;
72
////  			Driver drv = table.getModel().getModelo().getOriginalDriver();
73
////  			if (drv instanceof IWriteable)
74
////  			{
75
////  			IWriter writer = ((IWriteable) drv).getWriter();
76
////  			if (!writer.canSaveEdits())
77
////  			{
78
////  			JOptionPane.showMessageDialog(
79
////  			(Component) PluginServices.getMDIManager().getActiveWindow(),
80
////  			PluginServices.getText(this, "this_table_is_not_self_editable"),
81
////  			PluginServices.getText(this, "warning"),
82
////  			JOptionPane.WARNING_MESSAGE);
83
////  			return;
84
////  			}
85
////  			}
86
////  			else
87
////  			{
88
////  			JOptionPane.showMessageDialog(
89
////  			(Component) PluginServices.getMDIManager().getActiveWindow(),
90
////  			PluginServices.getText(this, "this_table_is_not_self_editable"),
91
////  			PluginServices.getText(this, "warning"),
92
////  			JOptionPane.WARNING_MESSAGE);
93
////  			return;
94
////  			}
95
//
96
//    			table.startEditing();
97
//    			/* IEditableSource edTable = (IEditableSource) table.getModel().getAssociatedTable();
98
//    			 edTable.getCommandRecord().addCommandListener(table); */
99
//
100
//    		} catch (StartEditingTableException e) {
101
//    			e.printStackTrace();
102
//    		} catch (HeadlessException e) {
103
//    			e.printStackTrace();
104
//    		}
105
    	}
63
    		try {
64
				table.getModel().getStore().edit(FeatureStore.MODE_FULLEDIT);
65
			} catch (DataException e) {
66
				e.printStackTrace();
67
			}
68
       	}
106 69
    }
107 70

  
108 71
    /**
......
149 112
        }
150 113

  
151 114
        if (v instanceof FeatureTableDocumentPanel && !((FeatureTableDocumentPanel) v).getModel().getStore().isEditing() && ((FeatureTableDocumentPanel)v).getModel().getAssociatedLayer()==null) {
152
       		return true;
115
       		table=(FeatureTableDocumentPanel)v;
116
        	return true;
153 117
        }
154 118

  
155 119
        return false;

Also available in: Unified diff