Revision 44437 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewSelectionByTheme.java
ViewSelectionByTheme.java | ||
---|---|---|
31 | 31 |
import org.gvsig.app.gui.selectionByTheme.SelectionByTheme; |
32 | 32 |
import org.gvsig.app.project.documents.view.ViewDocument; |
33 | 33 |
import org.gvsig.app.project.documents.view.gui.IView; |
34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
36 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
34 | 38 |
import org.gvsig.tools.ToolsLocator; |
35 | 39 |
import org.gvsig.tools.i18n.I18nManager; |
36 | 40 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
... | ... | |
80 | 84 |
} |
81 | 85 |
} |
82 | 86 |
|
87 |
@Override |
|
83 | 88 |
public boolean isEnabled() { |
84 | 89 |
ApplicationManager application = ApplicationLocator.getManager(); |
85 | 90 |
|
... | ... | |
88 | 93 |
return false; |
89 | 94 |
} |
90 | 95 |
ViewDocument document = view.getViewDocument(); |
91 |
|
|
92 |
return document.getMapContext().hasActiveVectorLayers(); |
|
96 |
if( document == null ) { |
|
97 |
return false; |
|
98 |
} |
|
99 |
boolean hasActiveVectorLayers = false; |
|
100 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
101 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
102 |
try { |
|
103 |
hasActiveVectorLayers = true; |
|
104 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
105 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
106 |
return false; |
|
107 |
} |
|
108 |
} catch (Exception ex) { |
|
109 |
} |
|
110 |
} |
|
111 |
} |
|
112 |
return hasActiveVectorLayers; |
|
93 | 113 |
} |
94 | 114 |
|
95 | 115 |
public boolean isVisible() { |
Also available in: Unified diff