root / tags / v1_0_2_Build_897 / extensions / extCAD / src / com / iver / cit / gvsig / ViewCommandStackExtension.java @ 10444
History | View | Annotate | Download (2.39 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import com.iver.andami.PluginServices; |
4 |
import com.iver.andami.plugins.Extension; |
5 |
import com.iver.cit.gvsig.fmap.MapContext; |
6 |
import com.iver.cit.gvsig.fmap.edition.IEditableSource; |
7 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
8 |
import com.iver.cit.gvsig.fmap.edition.commands.CommandListener; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
10 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
11 |
import com.iver.cit.gvsig.gui.command.CommandStackDialog; |
12 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
13 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
14 |
|
15 |
/**
|
16 |
* DOCUMENT ME!
|
17 |
*
|
18 |
* @author Vicente Caballero Navarro
|
19 |
*/
|
20 |
public class ViewCommandStackExtension extends Extension implements CommandListener{ |
21 |
public static CommandStackDialog csd=null; |
22 |
/**
|
23 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
24 |
*/
|
25 |
public void initialize() { |
26 |
} |
27 |
|
28 |
/**
|
29 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
30 |
*/
|
31 |
public void execute(String s) { |
32 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
33 |
.getActiveWindow(); |
34 |
|
35 |
View vista = (View) f; |
36 |
IProjectView model = vista.getModel(); |
37 |
MapContext mapa = model.getMapContext(); |
38 |
FLayers layers = mapa.getLayers(); |
39 |
if (s.equals("COMMANDSTACK")) { |
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 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) lyrVect |
45 |
.getSource(); |
46 |
vea.getCommandRecord().addCommandListener(this);
|
47 |
csd=new CommandStackDialog();
|
48 |
csd.setModel(((IEditableSource)lyrVect.getSource()).getCommandRecord()); |
49 |
PluginServices.getMDIManager().addWindow(csd); |
50 |
return;
|
51 |
} |
52 |
} |
53 |
} |
54 |
} |
55 |
|
56 |
//PluginServices.getMainFrame().enableControls();
|
57 |
|
58 |
} |
59 |
|
60 |
/**
|
61 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
62 |
*/
|
63 |
public boolean isEnabled() { |
64 |
|
65 |
return true; |
66 |
} |
67 |
|
68 |
/**
|
69 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
70 |
*/
|
71 |
public boolean isVisible() { |
72 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
|
73 |
return true; |
74 |
return false; |
75 |
|
76 |
} |
77 |
|
78 |
public void commandRepaint() { |
79 |
CADExtension.getCADTool().clearSelection(); |
80 |
|
81 |
} |
82 |
|
83 |
public void commandRefresh() { |
84 |
CADExtension.getCADTool().clearSelection(); |
85 |
} |
86 |
} |