Changeset 6527


Ignore:
Timestamp:
07/07/11 09:00:45 (10 years ago)
Author:
swagner
Message:

Corrected cloning of multiple dropped items (#1564)

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

    • Property svn:ignore
      •  

        old new  
        1212*.psess
        1313*.vsp
         14*.docstates
  • trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r5839 r6527  
    2727using System.Threading;
    2828using System.Windows.Forms;
     29using HeuristicLab.Common;
    2930using HeuristicLab.MainForm;
    3031using HeuristicLab.Persistence.Default.Xml;
     
    321322          } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
    322323            IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
     324            if (e.Effect.HasFlag(DragDropEffects.Copy)) {
     325              Cloner cloner = new Cloner();
     326              items = items.Select(x => cloner.Clone(x));
     327            }
    323328            foreach (T item in items)
    324               AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
     329              AddItem(item);
    325330          }
    326331        }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r6472 r6527  
    297297          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
    298298            Cloner cloner = new Cloner();
    299             items = items.Select(i => (T)i.Clone(cloner));
     299            items = items.Select(x => cloner.Clone(x));
    300300          }
    301301          foreach (T item in items)
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r6472 r6527  
    337337          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
    338338            Cloner cloner = new Cloner();
    339             items = items.Select(i => (T)i.Clone(cloner));
     339            items = items.Select(x => cloner.Clone(x));
    340340          }
    341341          foreach (T item in items) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r5839 r6527  
    2727using System.Windows.Forms;
    2828using HeuristicLab.Collections;
     29using HeuristicLab.Common;
    2930using HeuristicLab.Core;
    3031using HeuristicLab.Core.Views;
     
    314315        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
    315316          IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<IRun>();
     317          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
     318            Cloner cloner = new Cloner();
     319            items = items.Select(x => cloner.Clone(x));
     320          }
    316321          foreach (IRun item in items)
    317             Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item);
     322            Content.Add(item);
    318323        }
    319324      }
Note: See TracChangeset for help on using the changeset viewer.