gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.app / org.gvsig.vectorediting.app.mainplugin / src / main / java / org / gvsig / vectorediting / app / mainplugin / extensions / EndEditingExtension.java @ 89
History | View | Annotate | Download (1.59 KB)
1 |
/*
|
---|---|
2 |
* Copyright 2014 DiSiD Technologies S.L.L. All rights reserved.
|
3 |
*
|
4 |
* Project : DiSiD org.gvsig.vectorediting.app.mainplugin
|
5 |
* SVN Id : $Id$
|
6 |
*/
|
7 |
package org.gvsig.vectorediting.app.mainplugin.extensions; |
8 |
|
9 |
import org.gvsig.app.ApplicationLocator; |
10 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
11 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
12 |
import org.gvsig.vectorediting.app.mainplugin.BaseEditingServiceExtension; |
13 |
import org.gvsig.vectorediting.swing.api.EditingContext; |
14 |
|
15 |
public class EndEditingExtension extends BaseEditingServiceExtension { |
16 |
|
17 |
public void initialize() { |
18 |
|
19 |
} |
20 |
|
21 |
public void execute(String actionCommand) { |
22 |
|
23 |
if ("end-edit".equals(actionCommand)) { |
24 |
DefaultViewPanel view = getActiveView(); |
25 |
|
26 |
if (view != null) { |
27 |
FLyrVect layer = getActiveLayer(view); |
28 |
|
29 |
if (layer != null && layer.isEditing()) { |
30 |
EditingContext editingContext = swingManager.getEditingContext(view.getMapControl()); |
31 |
editingContext.endEdition(layer); |
32 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
33 |
} |
34 |
} |
35 |
} |
36 |
|
37 |
} |
38 |
|
39 |
public boolean isEnabled() { |
40 |
DefaultViewPanel vista = getActiveView(); |
41 |
FLyrVect activeLayer = getActiveLayer(vista); |
42 |
if (activeLayer != null && activeLayer.isEditing()) { |
43 |
return activeLayer.isEditing();
|
44 |
} |
45 |
return false; |
46 |
|
47 |
} |
48 |
|
49 |
public boolean isVisible() { |
50 |
DefaultViewPanel vista = getActiveView(); |
51 |
FLyrVect activeLayer = getActiveLayer(vista); |
52 |
if (activeLayer != null && activeLayer.isEditing()) { |
53 |
return activeLayer.isEditing();
|
54 |
} |
55 |
return false; |
56 |
} |
57 |
|
58 |
} |