Revision 44616 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geometrymeasurement.app/org.gvsig.geometrymeasurement.app.mainplugin/src/main/java/org/gvsig/geometrymeasurement/app/extension/AddXYPointThemeExtension.java
AddXYPointThemeExtension.java | ||
---|---|---|
24 | 24 |
package org.gvsig.geometrymeasurement.app.extension; |
25 | 25 |
|
26 | 26 |
import org.gvsig.andami.IconThemeHelper; |
27 |
import org.gvsig.andami.PluginServices; |
|
28 | 27 |
import org.gvsig.app.project.documents.table.TableDocument; |
28 |
import org.gvsig.fmap.dal.DataStoreProviderFactory; |
|
29 | 29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
30 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
|
30 | 31 |
import org.gvsig.fmap.geom.Geometry; |
31 | 32 |
import org.gvsig.geometrymeasurement.app.extension.utils.Operations; |
32 | 33 |
|
33 | 34 |
/** |
34 | 35 |
* Andami extension to show PerimeterMeasurementExtension in the application. |
35 |
*
|
|
36 |
* |
|
36 | 37 |
* @author gvSIG Team |
37 | 38 |
* @version $Id$ |
38 | 39 |
*/ |
39 | 40 |
public class AddXYPointThemeExtension extends |
40 |
AbstractGeometryMeasurementExtension { |
|
41 |
AbstractGeometryMeasurementExtension {
|
|
41 | 42 |
|
43 |
@Override |
|
42 | 44 |
public void initialize() { |
43 | 45 |
super.initialize(); |
44 | 46 |
IconThemeHelper.registerIcon("action", "table-add-xy", this); |
45 | 47 |
} |
46 | 48 |
|
49 |
@Override |
|
47 | 50 |
protected void execute(String actionCommand, FeatureStore featureStore) |
48 |
throws Exception { |
|
51 |
throws Exception {
|
|
49 | 52 |
new Operations().addXYPoints(featureStore, "X", "Y"); |
50 | 53 |
} |
51 | 54 |
|
55 |
@Override |
|
52 | 56 |
protected boolean isVisibleForTable(TableDocument tableDocument) { |
53 |
return isStoreOfAnyType(tableDocument, new int[] { Geometry.TYPES.POINT }); |
|
57 |
DataStoreProviderFactory factory = tableDocument.getFeatureStore().getProviderFactory(); |
|
58 |
if (factory instanceof FeatureStoreProviderFactory) { |
|
59 |
FeatureStoreProviderFactory ffactory = (FeatureStoreProviderFactory) factory; |
|
60 |
if (ffactory.allowEditableFeatureType() == FeatureStoreProviderFactory.NO) { |
|
61 |
return false; |
|
62 |
} |
|
63 |
} |
|
64 |
return isStoreOfAnyType(tableDocument, new int[]{Geometry.TYPES.POINT}); |
|
54 | 65 |
} |
55 | 66 |
} |
Also available in: Unified diff