Revision 44437 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewSelectionControls.java
ViewSelectionControls.java | ||
---|---|---|
28 | 28 |
import org.gvsig.app.ApplicationManager; |
29 | 29 |
import org.gvsig.app.project.documents.view.ViewDocument; |
30 | 30 |
import org.gvsig.app.project.documents.view.gui.IView; |
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
33 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
34 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
31 | 35 |
import org.gvsig.fmap.mapcontrol.MapControl; |
32 | 36 |
import org.slf4j.Logger; |
33 | 37 |
import org.slf4j.LoggerFactory; |
... | ... | |
52 | 56 |
IconThemeHelper.registerIcon("action", "selection-clear", this); |
53 | 57 |
} |
54 | 58 |
|
59 |
@Override |
|
55 | 60 |
public void execute(String actionCommand) { |
56 | 61 |
ApplicationManager application = ApplicationLocator.getManager(); |
57 | 62 |
|
... | ... | |
73 | 78 |
} |
74 | 79 |
} |
75 | 80 |
|
81 |
@Override |
|
76 | 82 |
public boolean isEnabled() { |
77 | 83 |
ApplicationManager application = ApplicationLocator.getManager(); |
78 | 84 |
|
... | ... | |
81 | 87 |
return false; |
82 | 88 |
} |
83 | 89 |
ViewDocument document = view.getViewDocument(); |
84 |
return document.getMapContext().hasActiveVectorLayers(); |
|
90 |
if( document == null ) { |
|
91 |
return false; |
|
92 |
} |
|
93 |
boolean hasActiveVectorLayers = false; |
|
94 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
95 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
96 |
try { |
|
97 |
hasActiveVectorLayers = true; |
|
98 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
99 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
100 |
return false; |
|
101 |
} |
|
102 |
} catch (Exception ex) { |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
106 |
return hasActiveVectorLayers ; |
|
85 | 107 |
} |
86 | 108 |
|
109 |
@Override |
|
87 | 110 |
public boolean isVisible() { |
88 | 111 |
ApplicationManager application = ApplicationLocator.getManager(); |
89 | 112 |
|
Also available in: Unified diff