Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.editing.app / org.gvsig.editing.app.mainplugin / src / main / java / org / gvsig / editing / ViewCommandStackExtension.java @ 40557

History | View | Annotate | Download (3.26 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.editing;
25

    
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.andami.plugins.Extension;
28
import org.gvsig.app.gui.command.CommandStackDialog;
29
import org.gvsig.app.project.documents.view.ViewDocument;
30
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
31
import org.gvsig.fmap.dal.feature.FeatureStore;
32
import org.gvsig.fmap.mapcontext.MapContext;
33
import org.gvsig.fmap.mapcontext.layers.FLayers;
34
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
35

    
36

    
37
/**
38
 * DOCUMENT ME!
39
 *
40
 * @author Vicente Caballero Navarro
41
 */
42
public class ViewCommandStackExtension extends Extension {
43

    
44
        public static CommandStackDialog csd=null;
45
        /**
46
         * @see org.gvsig.andami.plugins.IExtension#initialize()
47
         */
48
        public void initialize() {
49
        }
50

    
51
        /**
52
         * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
53
         */
54
        public void execute(String s) {
55
                org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
56
                                .getActiveWindow();
57

    
58
                DefaultViewPanel vista = (DefaultViewPanel) f;
59
                ViewDocument model = vista.getModel();
60
                MapContext mapa = model.getMapContext();
61
                FLayers layers = mapa.getLayers();
62
                if (s.equals("edit-undo-redo-actions-layer")) {
63
                        for (int i =0;i<layers.getLayersCount();i++){
64
                                if (layers.getLayer(i) instanceof FLyrVect){
65
                                        FLyrVect lyrVect=(FLyrVect)layers.getLayer(i);
66
                                        if (lyrVect.isEditing() && lyrVect.isActive()){
67
                                                FeatureStore featureStore=lyrVect.getFeatureStore();
68
                                                csd=new CommandStackDialog();
69
                                                csd.setModel(featureStore);
70
                                                PluginServices.getMDIManager().addWindow(csd);
71
                                                return;
72
                                        }
73
                                }
74
                        }
75
                }
76

    
77
        }
78

    
79
        /**
80
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
81
         */
82
        public boolean isEnabled() {
83

    
84
                return true;
85
        }
86

    
87
        /**
88
         * @see org.gvsig.andami.plugins.IExtension#isVisible()
89
         */
90
        public boolean isVisible() {
91
                if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
92
                        return true;
93
                return false;
94

    
95
        }
96

    
97
//        public void commandRepaint() {
98
//                try {
99
//                        CADExtension.getCADTool().clearSelection();
100
//                } catch (ReadException e) {
101
//                        NotificationManager.addError(e.getMessage(),e);
102
//                }
103
//
104
//        }
105
//
106
//        public void commandRefresh() {
107
//                try {
108
//                        CADExtension.getCADTool().clearSelection();
109
//                } catch (ReadException e) {
110
//                        NotificationManager.addError(e.getMessage(),e);
111
//                }
112
//        }
113

    
114
}