root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / TableCommandStackExtension.java @ 38533
History | View | Annotate | Download (1.82 KB)
1 | 29616 | jpiera | package org.gvsig.editing; |
---|---|---|---|
2 | 4118 | caballero | |
3 | 29616 | jpiera | import org.gvsig.andami.PluginServices; |
4 | import org.gvsig.andami.plugins.Extension; |
||
5 | import org.gvsig.app.gui.command.CommandStackDialog; |
||
6 | 31496 | jjdelcerro | import org.gvsig.app.project.documents.table.TableDocument; |
7 | 29616 | jpiera | import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel; |
8 | 24966 | vcaballero | import org.gvsig.fmap.dal.feature.FeatureStore; |
9 | 21666 | vcaballero | |
10 | 4118 | caballero | |
11 | /**
|
||
12 | * DOCUMENT ME!
|
||
13 | *
|
||
14 | * @author Vicente Caballero Navarro
|
||
15 | */
|
||
16 | 5005 | jorpiell | public class TableCommandStackExtension extends Extension { |
17 | 4118 | caballero | /**
|
18 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#initialize()
|
19 | 4118 | caballero | */
|
20 | 5005 | jorpiell | public void initialize() { |
21 | 15637 | jmvivo | PluginServices.getIconTheme().registerDefault( |
22 | 14810 | jmvivo | "commands-stack",
|
23 | this.getClass().getClassLoader().getResource("images/commandstack.png") |
||
24 | ); |
||
25 | 4118 | caballero | } |
26 | |||
27 | /**
|
||
28 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
29 | 4118 | caballero | */
|
30 | public void execute(String s) { |
||
31 | 29616 | jpiera | org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
32 | 24966 | vcaballero | .getActiveWindow(); |
33 | 4118 | caballero | |
34 | 25069 | vcaballero | FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
35 | 31496 | jjdelcerro | TableDocument model = table.getModel(); |
36 | 4118 | caballero | if (s.equals("COMMANDSTACK")) { |
37 | 37534 | jpiera | FeatureStore featureStore = model.getStore(); |
38 | featureStore.addObserver(table); |
||
39 | CommandStackDialog csd = new CommandStackDialog();
|
||
40 | 4118 | caballero | |
41 | 37534 | jpiera | csd.setModel(featureStore); |
42 | 24966 | vcaballero | |
43 | 37534 | jpiera | PluginServices.getMDIManager().addWindow(csd); |
44 | 4118 | caballero | } |
45 | } |
||
46 | |||
47 | /**
|
||
48 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
49 | 4118 | caballero | */
|
50 | public boolean isEnabled() { |
||
51 | return true; |
||
52 | } |
||
53 | |||
54 | /**
|
||
55 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isVisible()
|
56 | 4118 | caballero | */
|
57 | public boolean isVisible() { |
||
58 | 29616 | jpiera | org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
59 | 37534 | jpiera | .getActiveWindow(); |
60 | 25069 | vcaballero | if (f instanceof FeatureTableDocumentPanel){ |
61 | 37534 | jpiera | FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
62 | TableDocument model = table.getModel(); |
||
63 | if (model.getStore().isEditing())
|
||
64 | return true; |
||
65 | 4118 | caballero | } |
66 | 37534 | jpiera | return false; |
67 | 4118 | caballero | } |
68 | } |