Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / AdjustLayerExtension.java @ 6372

History | View | Annotate | Download (1.82 KB)

1
package com.iver.cit.gvsig;
2

    
3

    
4
import com.iver.andami.PluginServices;
5
import com.iver.andami.plugins.Extension;
6
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
7
import com.iver.cit.gvsig.fmap.layers.FLayer;
8
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
9
import com.iver.cit.gvsig.gui.View;
10
import com.iver.cit.gvsig.gui.cad.panels.options.OptionsPanel;
11

    
12
/**
13
 * DOCUMENT ME!
14
 *
15
 * @author Vicente Caballero Navarro
16
 */
17
public class AdjustLayerExtension extends Extension {
18
        /**
19
         * @see com.iver.andami.plugins.IExtension#initialize()
20
         */
21
        public void initialize() {
22
        }
23

    
24
        /**
25
         * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
26
         */
27
        public void execute(String actionCommand) {
28
                CADExtension.initFocus();
29
                com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager()
30
                                .getActiveView();
31
                if (f instanceof View) {
32
                        FLyrVect lv = (FLyrVect)CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
33
                        VectorialEditableAdapter vea=(VectorialEditableAdapter)lv.getSource();
34
                        OptionsPanel op=new OptionsPanel(vea);
35
                        PluginServices.getMDIManager().addView(op);
36
                }
37
        }
38

    
39

    
40
        /**
41
         * @see com.iver.andami.plugins.IExtension#isEnabled()
42
         */
43
        public boolean isEnabled() {
44
                View f = (View) PluginServices.getMDIManager().getActiveView();
45

    
46
                if (f == null) {
47
                        return false;
48
                }
49

    
50
                FLayer[] selected = f.getModel().getMapContext().getLayers()
51
                                .getActives();
52
                if (selected.length == 1 && selected[0] instanceof FLyrVect) {
53
                        if (selected[0].isEditing())
54
                                return true;
55
                }
56
                return false;
57
        }
58

    
59
        /**
60
         * @see com.iver.andami.plugins.IExtension#isVisible()
61
         */
62
        public boolean isVisible() {
63
                com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager()
64
                                .getActiveView();
65

    
66
                if (f == null) {
67
                        return false;
68
                }
69

    
70
                if (f instanceof View) {
71
                        return true;
72
                } else {
73
                        return false;
74
                }
75
        }
76
}