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