Revision 22932 branches/v2_0_0_prep/applications/appgvSIG/src/com/iver/cit/gvsig/RemoveTableUnion.java
RemoveTableUnion.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig; |
2 | 2 |
|
3 |
import org.gvsig.fmap.data.ReadException; |
|
3 |
import org.gvsig.fmap.data.CloseException; |
|
4 |
import org.gvsig.fmap.data.DataManager; |
|
5 |
import org.gvsig.fmap.data.DataStoreParameters; |
|
6 |
import org.gvsig.fmap.data.InitializeException; |
|
4 | 7 |
import org.gvsig.fmap.data.feature.FeatureStore; |
5 | 8 |
import org.gvsig.fmap.data.feature.joinstore.JoinFeatureStore; |
9 |
import org.gvsig.fmap.data.feature.joinstore.JoinFeatureStoreParameters; |
|
6 | 10 |
|
7 | 11 |
import com.iver.andami.PluginServices; |
8 | 12 |
import com.iver.andami.messages.NotificationManager; |
... | ... | |
30 | 34 |
public void execute(String actionCommand) { |
31 | 35 |
Table t = (Table) PluginServices.getMDIManager().getActiveWindow(); |
32 | 36 |
ProjectTable pt = t.getModel(); |
33 |
// try { |
|
34 |
FeatureStore fs=pt.getModelo(); |
|
35 |
if (fs instanceof JoinFeatureStore){ |
|
36 |
pt.setModel(((JoinFeatureStore)fs).getPrimaryStore()); |
|
37 |
FeatureStore fs = pt.getModel(); |
|
38 |
if (fs instanceof JoinFeatureStore) { |
|
39 |
DataManager dm = DataManager.getManager(); |
|
40 |
DataStoreParameters originalParams = ((JoinFeatureStoreParameters) fs |
|
41 |
.getParameters()).getStorePrimary(); |
|
42 |
FeatureStore original = null; |
|
43 |
try { |
|
44 |
original = (FeatureStore) dm.createDataStore(originalParams); |
|
45 |
} catch (InitializeException e) { |
|
46 |
NotificationManager.addError(e.getMessage(), e); |
|
47 |
return; |
|
37 | 48 |
} |
38 | 49 |
|
39 |
// pt.restoreDataSource(); |
|
40 |
// Por si acaso ten?amos seleccionado un campo |
|
41 |
// de los de la uni?n, no seleccionamos |
|
42 |
// ning?n campo. |
|
43 |
t.clearSelectedFields(); |
|
50 |
pt.setModel(original); |
|
51 |
try { |
|
52 |
fs.dispose(); |
|
53 |
} catch (CloseException e) { |
|
54 |
NotificationManager.addError(e); |
|
55 |
} |
|
56 |
t.setModel(pt); |
|
44 | 57 |
|
45 |
// } catch (ReadException e) {
|
|
46 |
// NotificationManager.addError(e.getMessage(), e); |
|
47 |
// }
|
|
48 |
t.getModel().setModified(true);
|
|
58 |
}
|
|
59 |
|
|
60 |
t.clearSelectedFields();
|
|
61 |
t.getModel().setModified(true);
|
|
49 | 62 |
} |
50 | 63 |
|
51 | 64 |
/** |
... | ... | |
60 | 73 |
|
61 | 74 |
if (v.getClass() == Table.class) { |
62 | 75 |
Table t = (Table) v; |
63 |
if (t.getModel().getOriginal() != null){ |
|
76 |
// FIXME !!!! Asi se hacia antes |
|
77 |
// if (t.getModel().getOriginal() != null){ |
|
78 |
// return true; |
|
79 |
// } |
|
80 |
|
|
81 |
ProjectTable pt = t.getModel(); |
|
82 |
FeatureStore fs = pt.getModel(); |
|
83 |
if (fs instanceof JoinFeatureStore) { |
|
64 | 84 |
return true; |
65 | 85 |
} |
86 |
|
|
66 | 87 |
} |
67 | 88 |
return false; |
68 | 89 |
} |
Also available in: Unified diff