root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / TableCommandStackExtension.java @ 38564
History | View | Annotate | Download (1.69 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 | 4118 | caballero | } |
22 | |||
23 | /**
|
||
24 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
|
25 | 4118 | caballero | */
|
26 | public void execute(String s) { |
||
27 | 29616 | jpiera | org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
28 | 24966 | vcaballero | .getActiveWindow(); |
29 | 4118 | caballero | |
30 | 25069 | vcaballero | FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
31 | 31496 | jjdelcerro | TableDocument model = table.getModel(); |
32 | 38564 | jjdelcerro | if (s.equals("edit-undo-redo-actions-table")) { |
33 | 37534 | jpiera | FeatureStore featureStore = model.getStore(); |
34 | featureStore.addObserver(table); |
||
35 | CommandStackDialog csd = new CommandStackDialog();
|
||
36 | 4118 | caballero | |
37 | 37534 | jpiera | csd.setModel(featureStore); |
38 | 24966 | vcaballero | |
39 | 37534 | jpiera | PluginServices.getMDIManager().addWindow(csd); |
40 | 4118 | caballero | } |
41 | } |
||
42 | |||
43 | /**
|
||
44 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isEnabled()
|
45 | 4118 | caballero | */
|
46 | public boolean isEnabled() { |
||
47 | return true; |
||
48 | } |
||
49 | |||
50 | /**
|
||
51 | 29616 | jpiera | * @see org.gvsig.andami.plugins.IExtension#isVisible()
|
52 | 4118 | caballero | */
|
53 | public boolean isVisible() { |
||
54 | 29616 | jpiera | org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
55 | 37534 | jpiera | .getActiveWindow(); |
56 | 25069 | vcaballero | if (f instanceof FeatureTableDocumentPanel){ |
57 | 37534 | jpiera | FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
58 | TableDocument model = table.getModel(); |
||
59 | if (model.getStore().isEditing())
|
||
60 | return true; |
||
61 | 4118 | caballero | } |
62 | 37534 | jpiera | return false; |
63 | 4118 | caballero | } |
64 | } |