svn-gvsig-desktop / branches / gvSIG_GisPlanet / applications / appgvSIG / src / com / iver / cit / gvsig / RemoveTableUnion.java @ 2147
History | View | Annotate | Download (1.33 KB)
1 | 1830 | fernando | package com.iver.cit.gvsig; |
---|---|---|---|
2 | |||
3 | import com.iver.andami.PluginServices; |
||
4 | import com.iver.andami.plugins.Extension; |
||
5 | import com.iver.andami.ui.mdiManager.View; |
||
6 | import com.iver.cit.gvsig.gui.Table; |
||
7 | import com.iver.cit.gvsig.project.ProjectTable; |
||
8 | |||
9 | /**
|
||
10 | * @author Fernando Gonz?lez Cort?s
|
||
11 | */
|
||
12 | public class RemoveTableUnion implements Extension{ |
||
13 | |||
14 | /**
|
||
15 | * @see com.iver.andami.plugins.Extension#inicializar()
|
||
16 | */
|
||
17 | public void inicializar() { |
||
18 | // TODO Auto-generated method stub
|
||
19 | |||
20 | } |
||
21 | |||
22 | /**
|
||
23 | * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
||
24 | */
|
||
25 | public void execute(String actionCommand) { |
||
26 | Table t = (Table) PluginServices.getMDIManager().getActiveView(); |
||
27 | ProjectTable pt = t.getModel(); |
||
28 | pt.restoreDataSource(); |
||
29 | } |
||
30 | |||
31 | /**
|
||
32 | * @see com.iver.andami.plugins.Extension#isEnabled()
|
||
33 | */
|
||
34 | public boolean isEnabled() { |
||
35 | View v = PluginServices.getMDIManager().getActiveView();
|
||
36 | |||
37 | if (v == null) { |
||
38 | return false; |
||
39 | } |
||
40 | |||
41 | if (v.getClass() == Table.class) {
|
||
42 | Table t = (Table) v; |
||
43 | if (t.getModel().getOriginal() != null){ |
||
44 | return true; |
||
45 | } |
||
46 | } |
||
47 | return false; |
||
48 | } |
||
49 | |||
50 | /**
|
||
51 | * @see com.iver.andami.plugins.Extension#isVisible()
|
||
52 | */
|
||
53 | public boolean isVisible() { |
||
54 | View v = PluginServices.getMDIManager().getActiveView();
|
||
55 | |||
56 | if (v == null) { |
||
57 | return false; |
||
58 | } |
||
59 | |||
60 | if (v.getClass() == Table.class) {
|
||
61 | return true; |
||
62 | } else {
|
||
63 | return false; |
||
64 | } |
||
65 | |||
66 | } |
||
67 | |||
68 | } |