Revision 37603 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/undo/DefaultFeatureCommandsStack.java

View differences:

DefaultFeatureCommandsStack.java
18 18
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelect;
19 19
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSelectAll;
20 20
import org.gvsig.fmap.dal.feature.impl.undo.command.SelectionCommandSet;
21
import org.gvsig.tools.undo.command.Command;
21 22
import org.gvsig.tools.undo.command.impl.DefaultUndoRedoCommandStack;
22 23

  
23 24
/**
......
66 67

  
67 68
    public void deselectAll(DefaultFeatureReferenceSelection selection)
68 69
            throws DataException {
69
        SelectionCommandSelectAll command = new SelectionCommandSelectAll(
70
        if (isSameLastCommand("_selectionDeselectAll")){
71
        	return;
72
        }
73
    	SelectionCommandSelectAll command = new SelectionCommandSelectAll(
70 74
                selection, false, "_selectionDeselectAll");
71 75
        add(command);
72 76
    }
77
    
78
    private boolean isSameLastCommand(String description){
79
    	if (getUndoInfos().size() > 0){
80
	    	Command lastCommand = getNextUndoCommand();
81
	    	if (lastCommand.getDescription().equals(description)){
82
	    		return true;
83
	    	}
84
    	}
85
    	return false;
86
    }
73 87

  
74 88
    public void select(DefaultFeatureReferenceSelection selection,
75 89
            FeatureReference reference) {
......
80 94

  
81 95
    public void selectAll(DefaultFeatureReferenceSelection selection)
82 96
            throws DataException {
83
        SelectionCommandSelectAll command = new SelectionCommandSelectAll(
97
    	 if (isSameLastCommand("_selectionSelectAll")){
98
         	return;
99
         }
100
    	SelectionCommandSelectAll command = new SelectionCommandSelectAll(
84 101
                selection, true, "_selectionSelectAll");
85 102
        add(command);
86 103
    }

Also available in: Unified diff