Changeset 2767


Ignore:
Timestamp:
Feb 21, 2011, 8:34:18 PM (11 years ago)
Author:
kopal
Message:

executing operations on model elements now return model objects if there operations are a 'new' operation

Location:
trunk/WorkspaceManagerModel/Model
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WorkspaceManagerModel/Model/Elements/WorkspaceModel.cs

    r2756 r2767  
    430430        /// <summary>
    431431        /// Modify the current WorkspaceModel by using an operation
     432        /// returns the created object or true if its not a 'new' operation
    432433        /// </summary>
    433434        /// <param name="operation"></param>
    434         public void ModifyModel(Operation operation){
    435             operation.Execute(this);
    436             this.UndoRedoManager.DidOperation(operation);           
     435        public object ModifyModel(Operation operation){           
     436            this.UndoRedoManager.DidOperation(operation);
     437            return operation.Execute(this);
    437438        }
    438439
  • trunk/WorkspaceManagerModel/Model/Operations/Operations.cs

    r2756 r2767  
    3434        }
    3535        public VisualElementModel Model { get; internal set; }
    36         internal abstract void Execute(WorkspaceModel workspaceModel);
     36        internal abstract object Execute(WorkspaceModel workspaceModel);
    3737        internal abstract void Undo(WorkspaceModel workspaceModel);       
    3838    }
     
    5959        #region Operation Members
    6060
    61         internal override void Execute(WorkspaceModel workspaceModel)
     61        internal override object Execute(WorkspaceModel workspaceModel)
    6262        {
    6363            if (this.Model == null)
     
    7272                workspaceModel.addPluginModel((PluginModel)Model);
    7373            }
     74            return this.Model;
    7475        }
    7576
     
    103104        #region Operation Members
    104105
    105         internal override void Execute(WorkspaceModel workspaceModel)
     106        internal override object Execute(WorkspaceModel workspaceModel)
    106107        {
    107108            workspaceModel.deletePluginModel((PluginModel)this.Model);
     109            return true;
    108110        }
    109111
     
    135137        #region Operation Members
    136138
    137         internal override void Execute(WorkspaceModel workspaceModel)
     139        internal override object Execute(WorkspaceModel workspaceModel)
    138140        {
    139141            if (this.Model == null)
     
    145147                workspaceModel.addConnectionModel((ConnectionModel)this.Model);
    146148            }
     149            return this.Model;
    147150        }
    148151
     
    167170        #region Operation Members
    168171
    169         internal override void Execute(WorkspaceModel workspaceModel)
     172        internal override object Execute(WorkspaceModel workspaceModel)
    170173        {
    171174            workspaceModel.deleteConnectionModel((ConnectionModel)Model);
     175            return true;
    172176        }
    173177
     
    197201        #region Operation Members
    198202
    199         internal override void Execute(WorkspaceModel workspaceModel)
     203        internal override object Execute(WorkspaceModel workspaceModel)
    200204        {
    201205            Model.Position = NewPosition;
     206            return true;
    202207        }
    203208
     
    231236        #region Operation Members
    232237
    233         internal override void Execute(WorkspaceModel workspaceModel)
     238        internal override object Execute(WorkspaceModel workspaceModel)
    234239        {
    235240            Model.Width = NewWidth;
    236241            Model.Height = NewHeight;
     242            return true;
    237243        }
    238244
Note: See TracChangeset for help on using the changeset viewer.