svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / RemoveTableUnion.java @ 3718
History | View | Annotate | Download (1.76 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
4 |
import com.iver.andami.PluginServices; |
5 |
import com.iver.andami.messages.NotificationManager; |
6 |
import com.iver.andami.plugins.Extension; |
7 |
import com.iver.andami.ui.mdiManager.View; |
8 |
import com.iver.cit.gvsig.gui.Table; |
9 |
import com.iver.cit.gvsig.project.ProjectTable; |
10 |
|
11 |
/**
|
12 |
* @author Fernando Gonz?lez Cort?s
|
13 |
*/
|
14 |
public class RemoveTableUnion implements Extension{ |
15 |
|
16 |
/**
|
17 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
18 |
*/
|
19 |
public void inicializar() { |
20 |
// TODO Auto-generated method stub
|
21 |
|
22 |
} |
23 |
|
24 |
/**
|
25 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
26 |
*/
|
27 |
public void execute(String actionCommand) { |
28 |
Table t = (Table) PluginServices.getMDIManager().getActiveView(); |
29 |
ProjectTable pt = t.getModel(); |
30 |
try {
|
31 |
pt.restoreDataSource(); |
32 |
// Por si acaso ten?amos seleccionado un campo
|
33 |
// de los de la uni?n, no seleccionamos
|
34 |
// ning?n campo.
|
35 |
t.clearSelectedFields(); |
36 |
|
37 |
} catch (DriverException e) {
|
38 |
NotificationManager.addError(e.getMessage(), e); |
39 |
} |
40 |
} |
41 |
|
42 |
/**
|
43 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
44 |
*/
|
45 |
public boolean isEnabled() { |
46 |
View v = PluginServices.getMDIManager().getActiveView();
|
47 |
|
48 |
if (v == null) { |
49 |
return false; |
50 |
} |
51 |
|
52 |
if (v.getClass() == Table.class) {
|
53 |
Table t = (Table) v; |
54 |
if (t.getModel().getOriginal() != null){ |
55 |
return true; |
56 |
} |
57 |
} |
58 |
return false; |
59 |
} |
60 |
|
61 |
/**
|
62 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
63 |
*/
|
64 |
public boolean isVisible() { |
65 |
View v = PluginServices.getMDIManager().getActiveView();
|
66 |
|
67 |
if (v == null) { |
68 |
return false; |
69 |
} |
70 |
|
71 |
if (v.getClass() == Table.class) {
|
72 |
return true; |
73 |
} else {
|
74 |
return false; |
75 |
} |
76 |
|
77 |
} |
78 |
|
79 |
} |