Revision 89 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

View differences:

EndEditingExtension.java
10 10
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
11 11
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
12 12
import org.gvsig.vectorediting.app.mainplugin.BaseEditingServiceExtension;
13
import org.gvsig.vectorediting.swing.api.EditingContext;
13 14

  
14 15
public class EndEditingExtension extends BaseEditingServiceExtension {
15 16

  
16 17
  public void initialize() {
17
    
18

  
18 19
  }
19
  
20

  
20 21
  public void execute(String actionCommand) {
21
    DefaultViewPanel vista = getActiveView();
22 22

  
23
    if (vista != null) {
24
      FLyrVect layer = getActiveLayer(vista);
23
    if ("end-edit".equals(actionCommand)) {
24
      DefaultViewPanel view = getActiveView();
25 25

  
26
      if (layer != null && layer.isEditing()) {
27
          swingManager.endEdition(layer, vista.getMapControl());
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);
28 32
          ApplicationLocator.getManager().refreshMenusAndToolBars();
33
        }
29 34
      }
30 35
    }
31 36

  
......
34 39
  public boolean isEnabled() {
35 40
    DefaultViewPanel vista = getActiveView();
36 41
    FLyrVect activeLayer = getActiveLayer(vista);
37
    if(activeLayer != null && activeLayer.isEditing()){
42
    if (activeLayer != null && activeLayer.isEditing()) {
38 43
      return activeLayer.isEditing();
39 44
    }
40 45
    return false;
......
44 49
  public boolean isVisible() {
45 50
    DefaultViewPanel vista = getActiveView();
46 51
    FLyrVect activeLayer = getActiveLayer(vista);
47
    if(activeLayer != null && activeLayer.isEditing()){
52
    if (activeLayer != null && activeLayer.isEditing()) {
48 53
      return activeLayer.isEditing();
49 54
    }
50 55
    return false;

Also available in: Unified diff