svn-gvsig-desktop / tags / v1_1_Build_1003 / extensions / extCAD / src / com / iver / cit / gvsig / TableCommandStackExtension.java @ 12271
History | View | Annotate | Download (1.86 KB)
1 | 4118 | caballero | 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.edition.IEditableSource; |
||
6 | import com.iver.cit.gvsig.fmap.edition.commands.CommandRecord; |
||
7 | import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
||
8 | import com.iver.cit.gvsig.gui.command.CommandStackDialog; |
||
9 | 8765 | jjdelcerro | import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
10 | import com.iver.cit.gvsig.project.documents.table.gui.Table; |
||
11 | 4118 | caballero | |
12 | /**
|
||
13 | * DOCUMENT ME!
|
||
14 | *
|
||
15 | * @author Vicente Caballero Navarro
|
||
16 | */
|
||
17 | 5005 | jorpiell | public class TableCommandStackExtension extends Extension { |
18 | 4118 | caballero | /**
|
19 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#initialize()
|
20 | 4118 | caballero | */
|
21 | 5005 | jorpiell | public void initialize() { |
22 | 4118 | caballero | } |
23 | |||
24 | /**
|
||
25 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
26 | 4118 | caballero | */
|
27 | public void execute(String s) { |
||
28 | 6877 | cesar | com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
29 | 6880 | cesar | .getActiveWindow(); |
30 | 4118 | caballero | |
31 | Table table = (Table) f; |
||
32 | ProjectTable model = table.getModel(); |
||
33 | if (s.equals("COMMANDSTACK")) { |
||
34 | CommandRecord cr=null;
|
||
35 | |||
36 | if (model.getAssociatedTable()!=null){ |
||
37 | cr=((IEditableSource)((FLyrVect)model.getAssociatedTable()).getSource()).getCommandRecord(); |
||
38 | 4142 | caballero | cr.addCommandListener(table); |
39 | 4118 | caballero | }else{
|
40 | cr=model.getModelo().getCommandRecord(); |
||
41 | 4142 | caballero | cr.addCommandListener(table); |
42 | 4118 | caballero | } |
43 | 4964 | caballero | CommandStackDialog csd = new CommandStackDialog();
|
44 | csd.setModel(cr); |
||
45 | 6880 | cesar | PluginServices.getMDIManager().addWindow(csd); |
46 | 4118 | caballero | } |
47 | } |
||
48 | |||
49 | /**
|
||
50 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#isEnabled()
|
51 | 4118 | caballero | */
|
52 | public boolean isEnabled() { |
||
53 | return true; |
||
54 | } |
||
55 | |||
56 | /**
|
||
57 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#isVisible()
|
58 | 4118 | caballero | */
|
59 | public boolean isVisible() { |
||
60 | 6877 | cesar | com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
61 | 6880 | cesar | .getActiveWindow(); |
62 | 4118 | caballero | if (f instanceof Table){ |
63 | Table table = (Table) f; |
||
64 | ProjectTable model = table.getModel(); |
||
65 | if (model.getModelo().isEditing())
|
||
66 | return true; |
||
67 | } |
||
68 | return false; |
||
69 | |||
70 | } |
||
71 | } |