code: function(layer) {
          if(this.active) {
              this.deactivate();
              if(this.handler) {
                  this.handler.destroy();
                  delete this.handler;
              }
              this.source = layer;
              this.activate();
          } else {
              this.source = layer;
          }
      }
docs: APIMethod: setSource
  Set the source layer for edits layer.
  
  Parameters:
  layer - {<OpenLayers.Layer.Vector>}  The new source layer layer.  If
  null, a temporary sketch layer will be created.