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 29616 jpiera
package org.gvsig.editing;
2 4118 caballero
3 29616 jpiera
import org.gvsig.andami.PluginServices;
4
import org.gvsig.andami.plugins.Extension;
5
import org.gvsig.app.gui.command.CommandStackDialog;
6 31496 jjdelcerro
import org.gvsig.app.project.documents.view.ViewDocument;
7
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
8 24966 vcaballero
import org.gvsig.fmap.dal.feature.FeatureStore;
9 21666 vcaballero
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 4118 caballero
14
/**
15
 * DOCUMENT ME!
16
 *
17
 * @author Vicente Caballero Navarro
18
 */
19 26833 cordinyana
public class ViewCommandStackExtension extends Extension {
20
21 5084 caballero
        public static CommandStackDialog csd=null;
22 4118 caballero
        /**
23 29616 jpiera
         * @see org.gvsig.andami.plugins.IExtension#initialize()
24 4118 caballero
         */
25 5005 jorpiell
        public void initialize() {
26 4118 caballero
        }
27
28
        /**
29 29616 jpiera
         * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
30 4118 caballero
         */
31
        public void execute(String s) {
32 29616 jpiera
                org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
33 6880 cesar
                                .getActiveWindow();
34 4118 caballero
35 31496 jjdelcerro
                DefaultViewPanel vista = (DefaultViewPanel) f;
36
                ViewDocument model = vista.getModel();
37 6878 cesar
                MapContext mapa = model.getMapContext();
38 4118 caballero
                FLayers layers = mapa.getLayers();
39 38564 jjdelcerro
                if (s.equals("edit-undo-redo-actions-layer")) {
40 4118 caballero
                        for (int i =0;i<layers.getLayersCount();i++){
41 4964 caballero
                                if (layers.getLayer(i) instanceof FLyrVect){
42
                                        FLyrVect lyrVect=(FLyrVect)layers.getLayer(i);
43
                                        if (lyrVect.isEditing() && lyrVect.isActive()){
44 24966 vcaballero
                                                FeatureStore featureStore=lyrVect.getFeatureStore();
45
                                                csd=new CommandStackDialog();
46 25563 vcaballero
                                                csd.setModel(featureStore);
47 24966 vcaballero
                                                PluginServices.getMDIManager().addWindow(csd);
48 6071 caballero
                                                return;
49 4964 caballero
                                        }
50 4118 caballero
                                }
51
                        }
52
                }
53
54
        }
55
56
        /**
57 29616 jpiera
         * @see org.gvsig.andami.plugins.IExtension#isEnabled()
58 4118 caballero
         */
59
        public boolean isEnabled() {
60 6071 caballero
61 4118 caballero
                return true;
62
        }
63
64
        /**
65 29616 jpiera
         * @see org.gvsig.andami.plugins.IExtension#isVisible()
66 4118 caballero
         */
67
        public boolean isVisible() {
68
                if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
69
                        return true;
70 6604 caballero
                return false;
71 4118 caballero
72
        }
73 6071 caballero
74 22986 vcaballero
//        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 6071 caballero
91 4118 caballero
}