root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / TableCommandStackExtension.java @ 4850
History | View | Annotate | Download (1.96 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.FMap; |
6 |
import com.iver.cit.gvsig.fmap.edition.IEditableSource; |
7 |
import com.iver.cit.gvsig.fmap.edition.commands.CommandRecord; |
8 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
10 |
import com.iver.cit.gvsig.gui.Table; |
11 |
import com.iver.cit.gvsig.gui.View; |
12 |
import com.iver.cit.gvsig.gui.command.CommandStackDialog; |
13 |
import com.iver.cit.gvsig.project.ProjectTable; |
14 |
import com.iver.cit.gvsig.project.ProjectView; |
15 |
|
16 |
/**
|
17 |
* DOCUMENT ME!
|
18 |
*
|
19 |
* @author Vicente Caballero Navarro
|
20 |
*/
|
21 |
public class TableCommandStackExtension implements Extension { |
22 |
/**
|
23 |
* @see com.iver.andami.plugins.Extension#inicializar()
|
24 |
*/
|
25 |
public void inicializar() { |
26 |
} |
27 |
|
28 |
/**
|
29 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String)
|
30 |
*/
|
31 |
public void execute(String s) { |
32 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
33 |
.getActiveView(); |
34 |
|
35 |
Table table = (Table) f; |
36 |
ProjectTable model = table.getModel(); |
37 |
if (s.equals("COMMANDSTACK")) { |
38 |
CommandRecord cr=null;
|
39 |
|
40 |
if (model.getAssociatedTable()!=null){ |
41 |
cr=((IEditableSource)((FLyrVect)model.getAssociatedTable()).getSource()).getCommandRecord(); |
42 |
cr.addCommandListener(table); |
43 |
}else{
|
44 |
cr=model.getModelo().getCommandRecord(); |
45 |
cr.addCommandListener(table); |
46 |
} |
47 |
CommandStackDialog csd = new CommandStackDialog(cr);
|
48 |
PluginServices.getMDIManager().addView(csd); |
49 |
} |
50 |
} |
51 |
|
52 |
/**
|
53 |
* @see com.iver.andami.plugins.Extension#isEnabled()
|
54 |
*/
|
55 |
public boolean isEnabled() { |
56 |
return true; |
57 |
} |
58 |
|
59 |
/**
|
60 |
* @see com.iver.andami.plugins.Extension#isVisible()
|
61 |
*/
|
62 |
public boolean isVisible() { |
63 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
64 |
.getActiveView(); |
65 |
if (f instanceof Table){ |
66 |
Table table = (Table) f; |
67 |
ProjectTable model = table.getModel(); |
68 |
if (model.getModelo().isEditing())
|
69 |
return true; |
70 |
} |
71 |
return false; |
72 |
|
73 |
} |
74 |
} |