svn-gvsig-desktop / tags / v1_0_2_Build_895 / extensions / extCAD / src / com / iver / cit / gvsig / TableCommandStackExtension.java @ 10328
History | View | Annotate | Download (1.86 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.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 |
import com.iver.cit.gvsig.project.documents.table.ProjectTable; |
10 |
import com.iver.cit.gvsig.project.documents.table.gui.Table; |
11 |
|
12 |
/**
|
13 |
* DOCUMENT ME!
|
14 |
*
|
15 |
* @author Vicente Caballero Navarro
|
16 |
*/
|
17 |
public class TableCommandStackExtension extends Extension { |
18 |
/**
|
19 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
20 |
*/
|
21 |
public void initialize() { |
22 |
} |
23 |
|
24 |
/**
|
25 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
26 |
*/
|
27 |
public void execute(String s) { |
28 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
29 |
.getActiveWindow(); |
30 |
|
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 |
cr.addCommandListener(table); |
39 |
}else{
|
40 |
cr=model.getModelo().getCommandRecord(); |
41 |
cr.addCommandListener(table); |
42 |
} |
43 |
CommandStackDialog csd = new CommandStackDialog();
|
44 |
csd.setModel(cr); |
45 |
PluginServices.getMDIManager().addWindow(csd); |
46 |
} |
47 |
} |
48 |
|
49 |
/**
|
50 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
51 |
*/
|
52 |
public boolean isEnabled() { |
53 |
return true; |
54 |
} |
55 |
|
56 |
/**
|
57 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
58 |
*/
|
59 |
public boolean isVisible() { |
60 |
com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
61 |
.getActiveWindow(); |
62 |
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 |
} |