svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / TableEditStopExtension.java @ 3718
History | View | Annotate | Download (2.03 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
4 |
|
5 |
import com.iver.andami.PluginServices; |
6 |
import com.iver.andami.messages.NotificationManager; |
7 |
import com.iver.andami.plugins.Extension; |
8 |
import com.iver.andami.ui.mdiManager.View; |
9 |
|
10 |
import com.iver.cit.gvsig.gui.Table; |
11 |
|
12 |
|
13 |
/**
|
14 |
* DOCUMENT ME!
|
15 |
*
|
16 |
* @author Vicente Caballero Navarro
|
17 |
*/
|
18 |
public class TableEditStopExtension implements Extension { |
19 |
/**
|
20 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
21 |
*/
|
22 |
public void inicializar() { |
23 |
} |
24 |
|
25 |
/**
|
26 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
27 |
*/
|
28 |
public void execute(String actionCommand) { |
29 |
if ("ROLLBACK".equals(actionCommand)) { |
30 |
View v = PluginServices.getMDIManager().getActiveView();
|
31 |
|
32 |
try {
|
33 |
((Table) v).cancelEditing(); |
34 |
} catch (DriverException e) {
|
35 |
NotificationManager.addError("No se pudo cancelar la edici?n", e);
|
36 |
} |
37 |
} else if ("COMMIT".equals(actionCommand)) { |
38 |
View v = PluginServices.getMDIManager().getActiveView();
|
39 |
|
40 |
try {
|
41 |
((Table) v).stopEditing(); |
42 |
} catch (DriverException e) {
|
43 |
NotificationManager.addError("No se pudo guardar la edici?n", e);
|
44 |
} |
45 |
} |
46 |
} |
47 |
|
48 |
/**
|
49 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
50 |
*/
|
51 |
public boolean isEnabled() { |
52 |
View v = PluginServices.getMDIManager().getActiveView();
|
53 |
|
54 |
if (v == null) { |
55 |
return false; |
56 |
} else if (v.getClass() == Table.class) { |
57 |
return ((Table) v).isEditing();
|
58 |
} else {
|
59 |
return false; |
60 |
} |
61 |
} |
62 |
|
63 |
/**
|
64 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
65 |
*/
|
66 |
public boolean isVisible() { |
67 |
View v = PluginServices.getMDIManager().getActiveView();
|
68 |
|
69 |
if (v == null) { |
70 |
return false; |
71 |
} else if (v.getClass() == Table.class) { |
72 |
return true; |
73 |
} else {
|
74 |
return false; |
75 |
} |
76 |
} |
77 |
} |