Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app.document.table.app / org.gvsig.app.document.table.app.mainplugin / src / main / java / org / gvsig / app / extension / AbstractTableEditExtension.java @ 44259

History | View | Annotate | Download (2.5 KB)

1 40558 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3 40435 jjdelcerro
 *
4 40558 jjdelcerro
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6 40435 jjdelcerro
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8 40558 jjdelcerro
 * as published by the Free Software Foundation; either version 3
9 40435 jjdelcerro
 * of the License, or (at your option) any later version.
10 40558 jjdelcerro
 *
11 40435 jjdelcerro
 * 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 40558 jjdelcerro
 *
16 40435 jjdelcerro
 * 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 40558 jjdelcerro
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 40435 jjdelcerro
 * MA  02110-1301, USA.
20 40558 jjdelcerro
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23 40435 jjdelcerro
 */
24
package org.gvsig.app.extension;
25
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.andami.plugins.Extension;
28
import org.gvsig.andami.ui.mdiManager.IWindow;
29 44199 jjdelcerro
import org.gvsig.app.ApplicationLocator;
30
import org.gvsig.app.ApplicationManager;
31
import org.gvsig.app.project.documents.table.TableDocument;
32
import org.gvsig.app.project.documents.table.TableManager;
33 40435 jjdelcerro
import org.gvsig.app.project.documents.table.TableOperations;
34
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel;
35 41824 jjdelcerro
import org.slf4j.Logger;
36
import org.slf4j.LoggerFactory;
37 40435 jjdelcerro
38
public abstract class AbstractTableEditExtension extends Extension {
39 41824 jjdelcerro
40
    protected static final Logger logger = LoggerFactory.getLogger(AbstractTableEditExtension.class);
41 40435 jjdelcerro
42
    protected FeatureTableDocumentPanel table = null;
43
    protected TableOperations featureTableOperations = null;
44
45
    /**
46
     * @see org.gvsig.andami.plugins.IExtension#initialize()
47
     */
48
    public void initialize() {
49
        featureTableOperations = TableOperations.getInstance();
50
    }
51
52 44199 jjdelcerro
    @Override
53 40435 jjdelcerro
    public boolean isVisible() {
54 44199 jjdelcerro
        ApplicationManager application = ApplicationLocator.getManager();
55
        TableDocument tableDoc = (TableDocument) application.getActiveDocument(TableManager.TYPENAME);
56
        if( tableDoc == null ) {
57
            return false;
58
        }
59
        if( tableDoc.getFeatureStore().isEditing() ) {
60
            this.table = (FeatureTableDocumentPanel) tableDoc.getMainComponent();
61 40435 jjdelcerro
            return true;
62
        }
63
        return false;
64
    }
65
66
}