svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / ViewCommandStackExtension.java @ 10626
History | View | Annotate | Download (2.67 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
4 |
import com.iver.andami.PluginServices; |
5 |
import com.iver.andami.plugins.Extension; |
6 |
import com.iver.cit.gvsig.fmap.MapContext; |
7 |
import com.iver.cit.gvsig.fmap.edition.IEditableSource; |
8 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
9 |
import com.iver.cit.gvsig.fmap.edition.commands.CommandListener; |
10 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
11 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
12 |
import com.iver.cit.gvsig.gui.command.CommandStackDialog; |
13 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
14 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
15 |
|
16 |
/**
|
17 |
* DOCUMENT ME!
|
18 |
*
|
19 |
* @author Vicente Caballero Navarro
|
20 |
*/
|
21 |
public class ViewCommandStackExtension extends Extension implements CommandListener{ |
22 |
public static CommandStackDialog csd=null; |
23 |
/**
|
24 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
25 |
*/
|
26 |
public void initialize() { |
27 |
} |
28 |
|
29 |
/**
|
30 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
31 |
*/
|
32 |
public void execute(String s) { |
33 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
34 |
.getActiveWindow(); |
35 |
|
36 |
View vista = (View) f; |
37 |
IProjectView model = vista.getModel(); |
38 |
MapContext mapa = model.getMapContext(); |
39 |
FLayers layers = mapa.getLayers(); |
40 |
if (s.equals("COMMANDSTACK")) { |
41 |
for (int i =0;i<layers.getLayersCount();i++){ |
42 |
if (layers.getLayer(i) instanceof FLyrVect){ |
43 |
FLyrVect lyrVect=(FLyrVect)layers.getLayer(i); |
44 |
if (lyrVect.isEditing() && lyrVect.isActive()){
|
45 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) lyrVect |
46 |
.getSource(); |
47 |
vea.getCommandRecord().addCommandListener(this);
|
48 |
csd=new CommandStackDialog();
|
49 |
csd.setModel(((IEditableSource)lyrVect.getSource()).getCommandRecord()); |
50 |
PluginServices.getMDIManager().addWindow(csd); |
51 |
return;
|
52 |
} |
53 |
} |
54 |
} |
55 |
} |
56 |
|
57 |
//PluginServices.getMainFrame().enableControls();
|
58 |
|
59 |
} |
60 |
|
61 |
/**
|
62 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
63 |
*/
|
64 |
public boolean isEnabled() { |
65 |
|
66 |
return true; |
67 |
} |
68 |
|
69 |
/**
|
70 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
71 |
*/
|
72 |
public boolean isVisible() { |
73 |
if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
|
74 |
return true; |
75 |
return false; |
76 |
|
77 |
} |
78 |
|
79 |
public void commandRepaint() { |
80 |
try {
|
81 |
CADExtension.getCADTool().clearSelection(); |
82 |
} catch (ReadDriverException e) {
|
83 |
// TODO Auto-generated catch block
|
84 |
e.printStackTrace(); |
85 |
} |
86 |
|
87 |
} |
88 |
|
89 |
public void commandRefresh() { |
90 |
try {
|
91 |
CADExtension.getCADTool().clearSelection(); |
92 |
} catch (ReadDriverException e) {
|
93 |
// TODO Auto-generated catch block
|
94 |
e.printStackTrace(); |
95 |
} |
96 |
} |
97 |
} |