Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / RemoveTableUnion.java @ 2581

History | View | Annotate | Download (1.57 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
        } catch (DriverException e) {
33
            NotificationManager.addError(e.getMessage(), e);
34
        }
35
        }
36

    
37
        /**
38
         * @see com.iver.andami.plugins.Extension#isEnabled()
39
         */
40
        public boolean isEnabled() {
41
                View v = PluginServices.getMDIManager().getActiveView();
42

    
43
                if (v == null) {
44
                        return false;
45
                }
46

    
47
                if (v.getClass() == Table.class) {
48
                        Table t = (Table) v;
49
                        if (t.getModel().getOriginal() != null){
50
                                return true;
51
                        }
52
                }
53
                return false;
54
        }
55

    
56
        /**
57
         * @see com.iver.andami.plugins.Extension#isVisible()
58
         */
59
        public boolean isVisible() {
60
                View v = PluginServices.getMDIManager().getActiveView();
61

    
62
                if (v == null) {
63
                        return false;
64
                }
65

    
66
                if (v.getClass() == Table.class) {
67
                        return true;
68
                } else {
69
                        return false;
70
                }
71

    
72
        }
73

    
74
}