Statistics
| Revision:

root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / ViewCommandStackExtension.java @ 38564

History | View | Annotate | Download (2.32 KB)

1
package org.gvsig.editing;
2

    
3
import org.gvsig.andami.PluginServices;
4
import org.gvsig.andami.plugins.Extension;
5
import org.gvsig.app.gui.command.CommandStackDialog;
6
import org.gvsig.app.project.documents.view.ViewDocument;
7
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
8
import org.gvsig.fmap.dal.feature.FeatureStore;
9
import org.gvsig.fmap.mapcontext.MapContext;
10
import org.gvsig.fmap.mapcontext.layers.FLayers;
11
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
12

    
13

    
14
/**
15
 * DOCUMENT ME!
16
 *
17
 * @author Vicente Caballero Navarro
18
 */
19
public class ViewCommandStackExtension extends Extension {
20

    
21
        public static CommandStackDialog csd=null;
22
        /**
23
         * @see org.gvsig.andami.plugins.IExtension#initialize()
24
         */
25
        public void initialize() {
26
        }
27

    
28
        /**
29
         * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
30
         */
31
        public void execute(String s) {
32
                org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
33
                                .getActiveWindow();
34

    
35
                DefaultViewPanel vista = (DefaultViewPanel) f;
36
                ViewDocument model = vista.getModel();
37
                MapContext mapa = model.getMapContext();
38
                FLayers layers = mapa.getLayers();
39
                if (s.equals("edit-undo-redo-actions-layer")) {
40
                        for (int i =0;i<layers.getLayersCount();i++){
41
                                if (layers.getLayer(i) instanceof FLyrVect){
42
                                        FLyrVect lyrVect=(FLyrVect)layers.getLayer(i);
43
                                        if (lyrVect.isEditing() && lyrVect.isActive()){
44
                                                FeatureStore featureStore=lyrVect.getFeatureStore();
45
                                                csd=new CommandStackDialog();
46
                                                csd.setModel(featureStore);
47
                                                PluginServices.getMDIManager().addWindow(csd);
48
                                                return;
49
                                        }
50
                                }
51
                        }
52
                }
53

    
54
        }
55

    
56
        /**
57
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
58
         */
59
        public boolean isEnabled() {
60

    
61
                return true;
62
        }
63

    
64
        /**
65
         * @see org.gvsig.andami.plugins.IExtension#isVisible()
66
         */
67
        public boolean isVisible() {
68
                if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
69
                        return true;
70
                return false;
71

    
72
        }
73

    
74
//        public void commandRepaint() {
75
//                try {
76
//                        CADExtension.getCADTool().clearSelection();
77
//                } catch (ReadException e) {
78
//                        NotificationManager.addError(e.getMessage(),e);
79
//                }
80
//
81
//        }
82
//
83
//        public void commandRefresh() {
84
//                try {
85
//                        CADExtension.getCADTool().clearSelection();
86
//                } catch (ReadException e) {
87
//                        NotificationManager.addError(e.getMessage(),e);
88
//                }
89
//        }
90

    
91
}