Revision 43147
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/MapContext.java | ||
---|---|---|
31 | 31 |
import java.util.ArrayList; |
32 | 32 |
import java.util.Iterator; |
33 | 33 |
import java.util.List; |
34 |
import org.apache.commons.lang3.ArrayUtils; |
|
34 | 35 |
|
35 | 36 |
import org.cresques.cts.ICoordTrans; |
36 | 37 |
import org.cresques.cts.IProjection; |
... | ... | |
1839 | 1840 |
return false; |
1840 | 1841 |
} |
1841 | 1842 |
|
1843 |
public boolean hasActiveLayers() { |
|
1844 |
FLayer[] layers = this.getLayers().getActives(); |
|
1845 |
return !ArrayUtils.isEmpty(layers); |
|
1846 |
} |
|
1847 |
|
|
1848 |
public boolean hasLayers() { |
|
1849 |
return !this.getLayers().isEmpty(); |
|
1850 |
} |
|
1851 |
|
|
1842 | 1852 |
private boolean hasVectorLayers(FLayers layers) { |
1843 | 1853 |
for (int i = 0; i < layers.getLayersCount(); i++) { |
1844 | 1854 |
FLayer lyr = layers.getLayer(i); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/LayerPropertiesExtension.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
public class LayerPropertiesExtension extends Extension { |
41 | 41 |
|
42 |
@Override |
|
42 | 43 |
public void initialize() { |
43 | 44 |
} |
44 | 45 |
|
... | ... | |
51 | 52 |
viewManager.addTOCContextAction("layer-properties","group-last",10000,900); |
52 | 53 |
} |
53 | 54 |
|
55 |
@Override |
|
54 | 56 |
public void execute(String s) { |
55 | 57 |
|
56 | 58 |
ApplicationManager application = ApplicationLocator.getManager(); |
... | ... | |
60 | 62 |
return; |
61 | 63 |
} |
62 | 64 |
ViewDocument document = view.getViewDocument(); |
63 |
if (!document.getMapContext().hasActiveVectorLayers()) {
|
|
65 |
if (!document.getMapContext().hasActiveLayers()) { |
|
64 | 66 |
return; |
65 | 67 |
} |
66 | 68 |
|
... | ... | |
76 | 78 |
} |
77 | 79 |
} |
78 | 80 |
|
81 |
@Override |
|
79 | 82 |
public boolean isEnabled() { |
80 | 83 |
ApplicationManager application = ApplicationLocator.getManager(); |
81 | 84 |
|
... | ... | |
84 | 87 |
return false; |
85 | 88 |
} |
86 | 89 |
ViewDocument document = view.getViewDocument(); |
87 |
return document.getMapContext().hasActiveVectorLayers();
|
|
90 |
return document.getMapContext().hasActiveLayers(); |
|
88 | 91 |
} |
89 | 92 |
|
93 |
@Override |
|
90 | 94 |
public boolean isVisible() { |
91 | 95 |
ApplicationManager application = ApplicationLocator.getManager(); |
92 | 96 |
|
... | ... | |
95 | 99 |
return false; |
96 | 100 |
} |
97 | 101 |
ViewDocument document = view.getViewDocument(); |
98 |
return document.getMapContext().hasVectorLayers();
|
|
102 |
return document.getMapContext().hasLayers(); |
|
99 | 103 |
} |
100 | 104 |
|
101 | 105 |
} |
Also available in: Unified diff