Revision 44437 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesExtension.java
SelectByAttributesExtension.java | ||
---|---|---|
44 | 44 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
45 | 45 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
46 | 46 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
47 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
47 | 48 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
48 | 49 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
49 | 50 |
import org.gvsig.i18n.Messages; |
... | ... | |
116 | 117 |
|
117 | 118 |
@Override |
118 | 119 |
public boolean isEnabled() { |
119 |
return true; |
|
120 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
121 |
|
|
122 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
123 |
if (view == null) { |
|
124 |
return false; |
|
125 |
} |
|
126 |
ViewDocument document = view.getViewDocument(); |
|
127 |
if( document == null ) { |
|
128 |
return false; |
|
129 |
} |
|
130 |
boolean hasActiveVectorLayers = false; |
|
131 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
132 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
133 |
try { |
|
134 |
hasActiveVectorLayers = true; |
|
135 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
136 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
137 |
return false; |
|
138 |
} |
|
139 |
} catch (Exception ex) { |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
return hasActiveVectorLayers; |
|
120 | 144 |
} |
121 | 145 |
|
122 | 146 |
@Override |
Also available in: Unified diff