root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / ViewCommandStackExtension.java @ 38539
History | View | Annotate | Download (3.04 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 | 24500 | jmvivo | import org.gvsig.fmap.dal.exception.DataException; |
9 | 24966 | vcaballero | import org.gvsig.fmap.dal.feature.FeatureStore; |
10 | 21666 | vcaballero | import org.gvsig.fmap.mapcontext.MapContext; |
11 | import org.gvsig.fmap.mapcontext.layers.FLayers; |
||
12 | import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
||
13 | |||
14 | 4118 | caballero | |
15 | /**
|
||
16 | * DOCUMENT ME!
|
||
17 | *
|
||
18 | * @author Vicente Caballero Navarro
|
||
19 | */
|
||
20 | 26833 | cordinyana | public class ViewCommandStackExtension extends Extension { |
21 | |||
22 | 5084 | caballero | public static CommandStackDialog csd=null; |
23 | 4118 | caballero | /**
|
24 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#initialize()
|
25 | 4118 | caballero | */
|
26 | 5005 | jorpiell | public void initialize() { |
27 | 15637 | jmvivo | PluginServices.getIconTheme().registerDefault( |
28 | 14810 | jmvivo | "commands-stack",
|
29 | this.getClass().getClassLoader().getResource("images/commandstack.png") |
||
30 | ); |
||
31 | 4118 | caballero | } |
32 | |||
33 | /**
|
||
34 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
35 | 4118 | caballero | */
|
36 | public void execute(String s) { |
||
37 | 29616 | jpiera | org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
38 | 6880 | cesar | .getActiveWindow(); |
39 | 4118 | caballero | |
40 | 31496 | jjdelcerro | DefaultViewPanel vista = (DefaultViewPanel) f; |
41 | ViewDocument model = vista.getModel(); |
||
42 | 6878 | cesar | MapContext mapa = model.getMapContext(); |
43 | 4118 | caballero | FLayers layers = mapa.getLayers(); |
44 | if (s.equals("COMMANDSTACK")) { |
||
45 | for (int i =0;i<layers.getLayersCount();i++){ |
||
46 | 4964 | caballero | if (layers.getLayer(i) instanceof FLyrVect){ |
47 | FLyrVect lyrVect=(FLyrVect)layers.getLayer(i); |
||
48 | if (lyrVect.isEditing() && lyrVect.isActive()){
|
||
49 | 30050 | cordinyana | // try{
|
50 | 24966 | vcaballero | FeatureStore featureStore=lyrVect.getFeatureStore(); |
51 | // CommandsRecord commandsRecord=null;
|
||
52 | // try {
|
||
53 | // commandsRecord = lyrVect.getFeatureStore().getCommandsRecord();
|
||
54 | // } catch (ReadException e) {
|
||
55 | // // TODO Auto-generated catch block
|
||
56 | // e.printStackTrace();
|
||
57 | // } catch (DataException e) {
|
||
58 | // // TODO Auto-generated catch block
|
||
59 | // e.printStackTrace();
|
||
60 | // }
|
||
61 | // commandsRecord.addObserver(this);
|
||
62 | csd=new CommandStackDialog();
|
||
63 | 25563 | vcaballero | csd.setModel(featureStore); |
64 | 24966 | vcaballero | PluginServices.getMDIManager().addWindow(csd); |
65 | 30050 | cordinyana | // } catch (DataException e) {
|
66 | // e.printStackTrace();
|
||
67 | // }
|
||
68 | 6071 | caballero | return;
|
69 | 4964 | caballero | } |
70 | 4118 | caballero | } |
71 | } |
||
72 | } |
||
73 | |||
74 | //PluginServices.getMainFrame().enableControls();
|
||
75 | |||
76 | } |
||
77 | |||
78 | /**
|
||
79 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
80 | 4118 | caballero | */
|
81 | public boolean isEnabled() { |
||
82 | 6071 | caballero | |
83 | 4118 | caballero | return true; |
84 | } |
||
85 | |||
86 | /**
|
||
87 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isVisible()
|
88 | 4118 | caballero | */
|
89 | public boolean isVisible() { |
||
90 | if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
|
||
91 | return true; |
||
92 | 6604 | caballero | return false; |
93 | 4118 | caballero | |
94 | } |
||
95 | 6071 | caballero | |
96 | 22986 | vcaballero | // public void commandRepaint() {
|
97 | // try {
|
||
98 | // CADExtension.getCADTool().clearSelection();
|
||
99 | // } catch (ReadException e) {
|
||
100 | // NotificationManager.addError(e.getMessage(),e);
|
||
101 | // }
|
||
102 | //
|
||
103 | // }
|
||
104 | //
|
||
105 | // public void commandRefresh() {
|
||
106 | // try {
|
||
107 | // CADExtension.getCADTool().clearSelection();
|
||
108 | // } catch (ReadException e) {
|
||
109 | // NotificationManager.addError(e.getMessage(),e);
|
||
110 | // }
|
||
111 | // }
|
||
112 | 6071 | caballero | |
113 | 4118 | caballero | } |