Revision 37534
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/TableCommandStackExtension.java | ||
---|---|---|
5 | 5 |
import org.gvsig.app.gui.command.CommandStackDialog; |
6 | 6 |
import org.gvsig.app.project.documents.table.TableDocument; |
7 | 7 |
import org.gvsig.app.project.documents.table.gui.FeatureTableDocumentPanel; |
8 |
import org.gvsig.fmap.dal.exception.DataException; |
|
9 | 8 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
10 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
11 | 9 |
|
12 | 10 |
|
13 | 11 |
/** |
... | ... | |
36 | 34 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
37 | 35 |
TableDocument model = table.getModel(); |
38 | 36 |
if (s.equals("COMMANDSTACK")) { |
39 |
// try {
|
|
40 |
FeatureStore featureStore=((FLyrVect)model.getAssociatedLayer()).getFeatureStore();
|
|
41 |
featureStore.addObserver(table);
|
|
37 |
FeatureStore featureStore = model.getStore();
|
|
38 |
featureStore.addObserver(table);
|
|
39 |
CommandStackDialog csd = new CommandStackDialog();
|
|
42 | 40 |
|
43 |
// CommandsRecord cr=null;
|
|
41 |
csd.setModel(featureStore);
|
|
44 | 42 |
|
45 |
// if (model.getAssociatedTable()!=null){ |
|
46 |
// try { |
|
47 |
// cr=((FLyrVect)model.getAssociatedTable()).getFeatureStore().getCommandsRecord(); |
|
48 |
// } catch (ReadException e) { |
|
49 |
// // TODO Auto-generated catch block |
|
50 |
// e.printStackTrace(); |
|
51 |
// } catch (DataException e) { |
|
52 |
// // TODO Auto-generated catch block |
|
53 |
// e.printStackTrace(); |
|
54 |
// } |
|
55 |
// cr.addObserver(table); |
|
56 |
// }else{ |
|
57 |
// try { |
|
58 |
// cr=model.getModel().getCommandsRecord(); |
|
59 |
// } catch (DataException e) { |
|
60 |
// // TODO Auto-generated catch block |
|
61 |
// e.printStackTrace(); |
|
62 |
// } |
|
63 |
// cr.addObserver(table); |
|
64 |
// } |
|
65 |
CommandStackDialog csd = new CommandStackDialog(); |
|
66 |
|
|
67 |
csd.setModel(featureStore); |
|
68 |
|
|
69 |
PluginServices.getMDIManager().addWindow(csd); |
|
70 |
// } catch (DataException e) { |
|
71 |
// e.printStackTrace(); |
|
72 |
// } |
|
43 |
PluginServices.getMDIManager().addWindow(csd); |
|
73 | 44 |
} |
74 | 45 |
} |
75 | 46 |
|
... | ... | |
85 | 56 |
*/ |
86 | 57 |
public boolean isVisible() { |
87 | 58 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
88 |
.getActiveWindow(); |
|
59 |
.getActiveWindow();
|
|
89 | 60 |
if (f instanceof FeatureTableDocumentPanel){ |
90 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f; |
|
91 |
TableDocument model = table.getModel(); |
|
92 |
if (model.getStore().isEditing()) |
|
93 |
return true; |
|
61 |
FeatureTableDocumentPanel table = (FeatureTableDocumentPanel) f;
|
|
62 |
TableDocument model = table.getModel();
|
|
63 |
if (model.getStore().isEditing())
|
|
64 |
return true;
|
|
94 | 65 |
} |
95 |
return false; |
|
96 |
|
|
66 |
return false; |
|
97 | 67 |
} |
98 | 68 |
} |
Also available in: Unified diff