Revision 3996 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/tables/PopupMenu.java

View differences:

PopupMenu.java
45 45
import com.iver.andami.PluginServices;
46 46

  
47 47
import com.iver.cit.gvsig.AddLayer;
48
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
49
import com.iver.cit.gvsig.fmap.edition.EditionException;
48 50
import com.iver.cit.gvsig.gui.Table;
49 51

  
50 52
import java.awt.Point;
51 53
import java.awt.event.ActionEvent;
52 54
import java.awt.event.ActionListener;
55
import java.io.IOException;
53 56

  
54 57
import javax.swing.ImageIcon;
55 58
import javax.swing.JMenuItem;
......
126 129
        table = (Table) PluginServices.getMDIManager().getActiveView();
127 130
        startEdition.addActionListener(new ActionListener() {
128 131
                public void actionPerformed(ActionEvent e) {
129
                    try {
130
                        table.startEditing();
132
                        try {
133
							table.startEditing();
134
						} catch (EditionException e1) {
135
							// TODO Auto-generated catch block
136
							e1.printStackTrace();
137
						}
131 138
                        PluginServices.getMainFrame().enableControls();
132
                    } catch (DriverException e1) {
133
                        // TODO Auto-generated catch block
134
                        e1.printStackTrace();
135
                    }
136 139
                }
137 140
            });
138 141
        stopEdition.addActionListener(new ActionListener() {
139 142
                public void actionPerformed(ActionEvent e) {
140
                    try {
143

  
141 144
                        table.stopEditing();
142 145
                        PluginServices.getMainFrame().enableControls();
143
                    } catch (DriverException e1) {
144
                        // TODO Auto-generated catch block
145
                        e1.printStackTrace();
146
                    }
146

  
147 147
                }
148 148
            });
149 149
        copy.addActionListener(new ActionListener() {
150 150
                public void actionPerformed(ActionEvent e) {
151
                    try {
152
                        table.copySelectedRows();
151

  
152
                        try {
153
							table.copyRow();
154
						} catch (DriverIOException e1) {
155
							// TODO Auto-generated catch block
156
							e1.printStackTrace();
157
						} catch (IOException e1) {
158
							// TODO Auto-generated catch block
159
							e1.printStackTrace();
160
						}
153 161
                        PluginServices.getMainFrame().enableControls();
154
                    } catch (DriverException e1) {
155
                        // TODO Auto-generated catch block
156
                        e1.printStackTrace();
157
                    }
162

  
158 163
                }
159 164
            });
160 165
        cut.addActionListener(new ActionListener() {
161 166
                public void actionPerformed(ActionEvent e) {
162
                    try {
163
                        table.copySelectedRows();
164
                        table.delSelectionRow();
167

  
168
                        try {
169
							table.cutRow();
170
						} catch (DriverIOException e1) {
171
							// TODO Auto-generated catch block
172
							e1.printStackTrace();
173
						} catch (IOException e1) {
174
							// TODO Auto-generated catch block
175
							e1.printStackTrace();
176
						}
165 177
                        PluginServices.getMainFrame().enableControls();
166
                    } catch (DriverException e1) {
167
                        // TODO Auto-generated catch block
168
                        e1.printStackTrace();
169
                    }
178

  
170 179
                }
171 180
            });
172 181
        paste.addActionListener(new ActionListener() {
173 182
                public void actionPerformed(ActionEvent e) {
174 183
                    //TODO este m?todo a?ade las filas seleccionadas previamente al final de la tabla.
175 184
                    //De momento no se puede a?adir filas en una posici?n en concreto.
176
                    try {
177
                        table.addSelectionToEnd();
185

  
186
                        try {
187
							table.pasteRow();
188
						} catch (DriverIOException e1) {
189
							// TODO Auto-generated catch block
190
							e1.printStackTrace();
191
						} catch (IOException e1) {
192
							// TODO Auto-generated catch block
193
							e1.printStackTrace();
194
						}
178 195
                        PluginServices.getMainFrame().enableControls();
179
                    } catch (DriverException e1) {
180
                        // TODO Auto-generated catch block
181
                        e1.printStackTrace();
182
                    }
196

  
183 197
                }
184 198
            });
185 199
        insertRow.addActionListener(new ActionListener() {
186 200
                public void actionPerformed(ActionEvent e) {
187 201
                    //TODO Este m?todo a?ade filas al final de la tabla y deber?a a?adirlas justo antes de la fila que tengamos seleccionada.
188
                    try {
189
                        table.addEmptyRow();
202

  
203
                        try {
204
							table.addRow(null);
205
						} catch (DriverIOException e1) {
206
							// TODO Auto-generated catch block
207
							e1.printStackTrace();
208
						} catch (IOException e1) {
209
							// TODO Auto-generated catch block
210
							e1.printStackTrace();
211
						}
190 212
                        PluginServices.getMainFrame().enableControls();
191
                    } catch (DriverException e1) {
192
                        // TODO Auto-generated catch block
193
                        e1.printStackTrace();
194
                    }
213

  
195 214
                }
196 215
            });
197 216
        removeRow.addActionListener(new ActionListener() {
198 217
                public void actionPerformed(ActionEvent e) {
199
                    try {
200
                        table.delSelectionRow();
218
                        try {
219
							table.removeRow();
220
						} catch (DriverIOException e1) {
221
							// TODO Auto-generated catch block
222
							e1.printStackTrace();
223
						} catch (IOException e1) {
224
							// TODO Auto-generated catch block
225
							e1.printStackTrace();
226
						}
201 227
                        PluginServices.getMainFrame().enableControls();
202
                    } catch (DriverException e1) {
203
                        // TODO Auto-generated catch block
204
                        e1.printStackTrace();
205
                    }
228

  
206 229
                }
207 230
            });
208 231
        insertColumn.addActionListener(new ActionListener() {
209 232
                public void actionPerformed(ActionEvent e) {
210 233
                    //TODO Falta que implementar.
211
                	
234

  
212 235
                }
213 236
            });
214 237
        removeColumn.addActionListener(new ActionListener() {
......
217 240
                }
218 241
            });
219 242
        editingMenu(table.isEditing());
220
        setEnablePaste(table.isCopy());
243
        setEnablePaste(table.isCopied());
221 244
        this.show(table, point.x, point.y);
222 245
    }
223 246

  
......
241 264
        		removeRow.setEnabled(true);
242 265
        	}
243 266
        }
244
           
267

  
245 268
        if ((table.getSelectedFieldIndices().length() > 0) && b) {
246 269
            removeColumn.setEnabled(true);
247 270
        } else {

Also available in: Unified diff