svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.app.document.table.app / org.gvsig.app.document.table.app.mainplugin / src / main / java / org / gvsig / app / extension / RemoveTableLink.java @ 36443
History | View | Annotate | Download (2.78 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.app.extension; |
23 |
|
24 |
import org.gvsig.andami.PluginServices; |
25 |
import org.gvsig.andami.plugins.Extension; |
26 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
27 |
import org.gvsig.app.project.documents.table.TableDocument; |
28 |
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel; |
29 |
|
30 |
/**
|
31 |
* Extensi?n para borrar los link existentes entre tablas.
|
32 |
*
|
33 |
* @author Vicente Caballero Navarro
|
34 |
*/
|
35 |
public class RemoveTableLink extends Extension { |
36 |
|
37 |
/**
|
38 |
* @see org.gvsig.andami.plugins.IExtension#initialize()
|
39 |
*/
|
40 |
public void initialize() { |
41 |
// TODO Auto-generated method stub
|
42 |
} |
43 |
|
44 |
/**
|
45 |
* @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
46 |
*/
|
47 |
public void execute(String actionCommand) { |
48 |
FeatureTableDocumentPanel t = |
49 |
(FeatureTableDocumentPanel) PluginServices.getMDIManager() |
50 |
.getActiveWindow(); |
51 |
TableDocument pt = t.getModel(); |
52 |
pt.removeLinkTable();// restoreDataSource();
|
53 |
t.getModel().setModified(true);
|
54 |
} |
55 |
|
56 |
/**
|
57 |
* @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
58 |
*/
|
59 |
public boolean isEnabled() { |
60 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
61 |
|
62 |
if (v == null) { |
63 |
return false; |
64 |
} |
65 |
|
66 |
if (v.getClass() == FeatureTableDocumentPanel.class) {
|
67 |
FeatureTableDocumentPanel t = (FeatureTableDocumentPanel) v; |
68 |
|
69 |
if (t.getModel().hasLinks()) {
|
70 |
return true; |
71 |
} |
72 |
} |
73 |
|
74 |
return false; |
75 |
} |
76 |
|
77 |
/**
|
78 |
* @see org.gvsig.andami.plugins.IExtension#isVisible()
|
79 |
*/
|
80 |
public boolean isVisible() { |
81 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
82 |
|
83 |
if (v == null) { |
84 |
return false; |
85 |
} |
86 |
|
87 |
if (v instanceof FeatureTableDocumentPanel) { |
88 |
return true; |
89 |
} else {
|
90 |
return false; |
91 |
} |
92 |
} |
93 |
} |