Revision 41264 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewSimpleSelectionControl.java
ViewSimpleSelectionControl.java | ||
---|---|---|
52 | 52 |
public void execute(String actionCommand) { |
53 | 53 |
ApplicationManager application = ApplicationLocator.getManager(); |
54 | 54 |
|
55 |
ViewDocument document = (ViewDocument) application.getActiveDocument(ViewDocument.class);
|
|
56 |
if (document == null) {
|
|
55 |
IView view = (IView) application.getActiveComponent(ViewDocument.class);
|
|
56 |
if (view == null) {
|
|
57 | 57 |
return; |
58 | 58 |
} |
59 |
IView view = (IView) document.getMainComponent();
|
|
59 |
ViewDocument document = view.getViewDocument();
|
|
60 | 60 |
MapControl mapCtrl = view.getMapControl(); |
61 | 61 |
if (actionCommand.equalsIgnoreCase("selection-simple-select-view")) { |
62 | 62 |
mapCtrl.setTool("pointSelection"); |
... | ... | |
67 | 67 |
public boolean isEnabled() { |
68 | 68 |
ApplicationManager application = ApplicationLocator.getManager(); |
69 | 69 |
|
70 |
ViewDocument document = (ViewDocument) application.getActiveDocument(ViewDocument.class);
|
|
71 |
if (document == null) {
|
|
70 |
IView view = (IView) application.getActiveComponent(ViewDocument.class);
|
|
71 |
if (view == null) {
|
|
72 | 72 |
return false; |
73 | 73 |
} |
74 |
ViewDocument document = view.getViewDocument(); |
|
74 | 75 |
return document.getMapContext().hasActiveVectorLayers(); |
75 | 76 |
} |
76 | 77 |
|
77 | 78 |
public boolean isVisible() { |
78 | 79 |
ApplicationManager application = ApplicationLocator.getManager(); |
79 | 80 |
|
80 |
ViewDocument document = (ViewDocument) application.getActiveDocument(ViewDocument.class);
|
|
81 |
if (document == null) {
|
|
81 |
IView view = (IView) application.getActiveComponent(ViewDocument.class);
|
|
82 |
if (view == null) {
|
|
82 | 83 |
return false; |
83 | 84 |
} |
85 |
ViewDocument document = view.getViewDocument(); |
|
84 | 86 |
return document.getMapContext().hasVectorLayers(); |
85 | 87 |
} |
86 | 88 |
|
Also available in: Unified diff