Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5837


Ignore:
Timestamp:
03/28/11 14:53:01 (13 years ago)
Author:
swagner
Message:

Implemented review comments of mkommend (#1112)

Location:
trunk/sources
Files:
1 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.3/CrossValidationView.cs

    r5744 r5837  
    317317    private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) {
    318318      e.Effect = DragDropEffects.None;
    319       IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     319      IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm;
    320320      if (!ReadOnly && (algorithm != null) && Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType())) {
    321321        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
     
    328328    private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) {
    329329      if (e.Effect != DragDropEffects.None) {
    330         IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     330        IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm;
    331331        if (e.Effect.HasFlag(DragDropEffects.Copy)) algorithm = (IAlgorithm)algorithm.Clone();
    332332        Content.Algorithm = algorithm;
     
    336336    private void algorithmProblemTabPage_DragEnterOver(object sender, DragEventArgs e) {
    337337      e.Effect = DragDropEffects.None;
    338       Type type = e.Data.GetData("HeuristicLab") != null ? e.Data.GetData("HeuristicLab").GetType() : null;
     338      Type type = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null ? e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType() : null;
    339339      if (!ReadOnly && (type != null) && Content.ProblemType.IsAssignableFrom(type) && Content.Algorithm.ProblemType.IsAssignableFrom(type)) {
    340340        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
     
    347347    private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) {
    348348      if (e.Effect != DragDropEffects.None) {
    349         ISingleObjectiveDataAnalysisProblem problem = e.Data.GetData("HeuristicLab") as ISingleObjectiveDataAnalysisProblem;
     349        ISingleObjectiveDataAnalysisProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ISingleObjectiveDataAnalysisProblem;
    350350        if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (ISingleObjectiveDataAnalysisProblem)problem.Clone();
    351351        Content.Problem = problem;
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs

    r5834 r5837  
    317317    private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) {
    318318      e.Effect = DragDropEffects.None;
    319       IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     319      IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm;
    320320      if (!ReadOnly && algorithm != null &&
    321321        (algorithm.ProblemType != null || Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType()))) {
     
    329329    private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) {
    330330      if (e.Effect != DragDropEffects.None) {
    331         IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     331        IAlgorithm algorithm = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IAlgorithm;
    332332        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) algorithm = (IAlgorithm)algorithm.Clone();
    333333        Content.Algorithm = algorithm;
     
    338338      e.Effect = DragDropEffects.None;
    339339      if (ReadOnly) return;
    340       IProblem problem = e.Data.GetData("HeuristicLab") as IProblem;
     340      IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem;
    341341      if (problem != null && Content.ProblemType.IsAssignableFrom(problem.GetType()) &&
    342342        Content.Algorithm.ProblemType.IsAssignableFrom(problem.GetType())) {
     
    350350    private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) {
    351351      if (e.Effect != DragDropEffects.None) {
    352         IDataAnalysisProblem problem = e.Data.GetData("HeuristicLab") as IDataAnalysisProblem;
     352        IDataAnalysisProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IDataAnalysisProblem;
    353353        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (IDataAnalysisProblem)problem.Clone();
    354354        Content.Problem = problem;
  • trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r5193 r5837  
    120120    <Compile Include="Content\ContentManager.cs" />
    121121    <Compile Include="Content\IStorableContent.cs" />
     122    <Compile Include="Constants.cs" />
    122123    <Compile Include="DeepCloneable.cs" />
    123124    <Compile Include="Content\IContent.cs" />
  • trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r5744 r5837  
    275275      if (items.Count > 0) {
    276276        DataObject data = new DataObject();
    277         if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    278         else data.SetData("HeuristicLab", items);
     277        if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     278        else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    279279        if (ReadOnly) {
    280280          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    291291      validDragOperation = false;
    292292      draggedItemsAlreadyContained = false;
    293       if (e.Data.GetData("HeuristicLab") is T) {
     293      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
    294294        validDragOperation = true;
    295         draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData("HeuristicLab"));
    296       } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
     295        draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat));
     296      } else if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    297297        validDragOperation = true;
    298         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     298        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    299299        foreach (object item in items) {
    300300          validDragOperation = validDragOperation && (item is T);
     
    302302        }
    303303      }
    304       validDragOperation = validDragOperation && !ReadOnly;
    305304    }
    306305    private void listView_DragOver(object sender, DragEventArgs e) {
     
    317316      if (e.Effect != DragDropEffects.None) {
    318317        try {
    319           if (e.Data.GetData("HeuristicLab") is T) {
    320             T item = (T)e.Data.GetData("HeuristicLab");
     318          if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     319            T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    321320            AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
    322           } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    323             IEnumerable<T> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<T>();
     321          } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     322            IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
    324323            foreach (T item in items)
    325324              AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs

    r5744 r5837  
    283283        if (items.Count > 0) {
    284284          DataObject data = new DataObject();
    285           if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    286           else data.SetData("HeuristicLab", items);
     285          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     286          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    287287          if (Content.IsReadOnly || ReadOnly) {
    288288            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    298298    }
    299299    protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) {
    300       validDragOperation = !Content.IsReadOnly && !ReadOnly && e.Data.GetData("HeuristicLab") is T;
     300      validDragOperation = !Content.IsReadOnly && !ReadOnly && e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T;
    301301    }
    302302    protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    318318        Point p = itemsListView.PointToClient(new Point(e.X, e.Y));
    319319        ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y);
    320         T item = e.Data.GetData("HeuristicLab") as T;
     320        T item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T;
    321321        Content[listViewItem.Index] = e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item;
    322322      }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r5744 r5837  
    253253        if (items.Count > 0) {
    254254          DataObject data = new DataObject();
    255           if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    256           else data.SetData("HeuristicLab", items);
     255          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     256          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    257257          if (Content.IsReadOnly || ReadOnly) {
    258258            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    268268    protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) {
    269269      validDragOperation = false;
    270       if (e.Data.GetData("HeuristicLab") is T) {
     270      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
    271271        validDragOperation = true;
    272       } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
     272      } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    273273        validDragOperation = true;
    274         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     274        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    275275        foreach (object item in items)
    276276          validDragOperation = validDragOperation && (item is T);
    277277      }
    278       validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;
    279278    }
    280279    protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    290289    protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
    291290      if (e.Effect != DragDropEffects.None) {
    292         if (e.Data.GetData("HeuristicLab") is T) {
    293           T item = (T)e.Data.GetData("HeuristicLab");
     291        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     292          T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    294293          Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
    295         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    296           IEnumerable<T> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<T>();
     294        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     295          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
    297296          foreach (T item in items)
    298297            Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r5744 r5837  
    287287        if (items.Count > 0) {
    288288          DataObject data = new DataObject();
    289           if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    290           else data.SetData("HeuristicLab", items);
     289          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     290          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    291291          if (Content.IsReadOnly || ReadOnly) {
    292292            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    304304    protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) {
    305305      validDragOperation = false;
    306       if (e.Data.GetData("HeuristicLab") is T) {
     306      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
    307307        validDragOperation = true;
    308       } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
     308      } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    309309        validDragOperation = true;
    310         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     310        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    311311        foreach (object item in items)
    312312          validDragOperation = validDragOperation && (item is T);
    313313      }
    314       validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;
    315314    }
    316315    protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    329328        ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y);
    330329
    331         if (e.Data.GetData("HeuristicLab") is T) {
    332           T item = (T)e.Data.GetData("HeuristicLab");
     330        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     331          T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    333332          if (listViewItem != null) Content.Insert(listViewItem.Index, e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
    334333          else Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
    335         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    336           IEnumerable<T> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<T>();
     334        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     335          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
    337336          foreach (T item in items) {
    338337            if (listViewItem != null) Content.Insert(listViewItem.Index, e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemSetView.cs

    r5744 r5837  
    4444      draggedItemsAlreadyContained = false;
    4545      if (validDragOperation) {
    46         if (e.Data.GetData("HeuristicLab") is T) {
    47           draggedItemsAlreadyContained = Content.Contains((T)e.Data.GetData("HeuristicLab"));
    48         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    49           IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     46        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     47          draggedItemsAlreadyContained = Content.Contains((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat));
     48        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     49          IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    5050          foreach (object item in items)
    5151            draggedItemsAlreadyContained = draggedItemsAlreadyContained || Content.Contains((T)item);
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemCollectionView.cs

    r5829 r5837  
    8282      base.itemsListView_DragEnter(sender, e);
    8383      if (validDragOperation) {
    84         if (e.Data.GetData("HeuristicLab") is T) {
    85           validDragOperation = validDragOperation && !Content.ContainsKey(((T)e.Data.GetData("HeuristicLab")).Name);
    86         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    87           IEnumerable<T> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<T>();
     84        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     85          validDragOperation = validDragOperation && !Content.ContainsKey(((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Name);
     86        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     87          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
    8888          foreach (T item in items)
    8989            validDragOperation = validDragOperation && !Content.ContainsKey(item.Name);
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorTreeView.cs

    r5744 r5837  
    353353        IOperator op = GetOperatorTag(node);
    354354        DataObject data = new DataObject();
    355         data.SetData("HeuristicLab", op);
     355        data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, op);
    356356        if (ReadOnly || (opParam == null)) {
    357357          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    365365    private void graphTreeView_DragEnterOver(object sender, DragEventArgs e) {
    366366      e.Effect = DragDropEffects.None;
    367       if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IOperator)) {
     367      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOperator)) {
    368368        TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y)));
    369369        if ((node != null) && !node.IsExpanded) node.Expand();
     
    379379    private void graphTreeView_DragDrop(object sender, DragEventArgs e) {
    380380      if (e.Effect != DragDropEffects.None) {
    381         IOperator op = e.Data.GetData("HeuristicLab") as IOperator;
     381        IOperator op = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOperator;
    382382        if (e.Effect.HasFlag(DragDropEffects.Copy)) op = (IOperator)op.Clone();
    383383        TreeNode node = graphTreeView.GetNodeAt(graphTreeView.PointToClient(new Point(e.X, e.Y)));
  • trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs

    r5744 r5837  
    168168        if (scope != null) {
    169169          DataObject data = new DataObject();
    170           data.SetData("HeuristicLab", scope);
     170          data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, scope);
    171171          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    172172        }
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r5744 r5837  
    318318        object o = Activator.CreateInstance(type);
    319319        DataObject data = new DataObject();
    320         data.SetData("HeuristicLab", o);
     320        data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, o);
    321321        DoDragDrop(data, DragDropEffects.Copy);
    322322      }
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableValueView.cs

    r5744 r5837  
    8888    protected virtual void VariableValueView_DragEnterOver(object sender, DragEventArgs e) {
    8989      e.Effect = DragDropEffects.None;
    90       if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IItem)) {
     90      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IItem)) {
    9191        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    9292        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    9898    protected virtual void VariableValueView_DragDrop(object sender, DragEventArgs e) {
    9999      if (e.Effect != DragDropEffects.None) {
    100         IItem item = e.Data.GetData("HeuristicLab") as IItem;
     100        IItem item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem;
    101101        if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone();
    102102        Content.Value = item;
  • trunk/sources/HeuristicLab.Core.Views/3.3/VariableView.cs

    r5744 r5837  
    135135    protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
    136136      e.Effect = DragDropEffects.None;
    137       if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IItem)) {
     137      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IItem)) {
    138138        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    139139        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    145145    protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) {
    146146      if (e.Effect != DragDropEffects.None) {
    147         IItem item = e.Data.GetData("HeuristicLab") as IItem;
     147        IItem item = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IItem;
    148148        if (e.Effect.HasFlag(DragDropEffects.Copy)) item = (IItem)item.Clone();
    149149        Content.Value = item;
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs

    r5744 r5837  
    281281      if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left && startDragAndDrop) {
    282282        DataObject data = new DataObject();
    283         data.SetData("HeuristicLab", Content);
     283        data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, Content);
    284284        DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    285285      } else
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorGraphView.cs

    r5744 r5837  
    204204    private void OperatorGraphView_DragEnterOver(object sender, DragEventArgs e) {
    205205      e.Effect = DragDropEffects.None;
    206       if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IOperator)) {
     206      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOperator)) {
    207207        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    208208        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    215215    private void OperatorGraphView_DragDrop(object sender, DragEventArgs e) {
    216216      if (e.Effect != DragDropEffects.None) {
    217         IOperator op = e.Data.GetData("HeuristicLab") as IOperator;
     217        IOperator op = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOperator;
    218218        if (e.Effect.HasFlag(DragDropEffects.Copy)) op = (IOperator)op.Clone();
    219219        IOperatorShapeInfo shapeInfo = OperatorShapeInfoFactory.CreateOperatorShapeInfo(op);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r5809 r5837  
    278278    protected virtual void problemTabPage_DragEnterOver(object sender, DragEventArgs e) {
    279279      e.Effect = DragDropEffects.None;
    280       if (!ReadOnly && (e.Data.GetData("HeuristicLab") != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {
     280      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) {
    281281        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    282282        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    288288    protected virtual void problemTabPage_DragDrop(object sender, DragEventArgs e) {
    289289      if (e.Effect != DragDropEffects.None) {
    290         IProblem problem = e.Data.GetData("HeuristicLab") as IProblem;
     290        IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem;
    291291        if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (IProblem)problem.Clone();
    292292        Content.Problem = problem;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r5744 r5837  
    253253    private void optimizerTabPage_DragEnterOver(object sender, DragEventArgs e) {
    254254      e.Effect = DragDropEffects.None;
    255       if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IOptimizer)) {
     255      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOptimizer)) {
    256256        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    257257        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    263263    private void optimizerTabPage_DragDrop(object sender, DragEventArgs e) {
    264264      if (e.Effect != DragDropEffects.None) {
    265         IOptimizer optimizer = e.Data.GetData("HeuristicLab") as IOptimizer;
     265        IOptimizer optimizer = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOptimizer;
    266266        if (e.Effect.HasFlag(DragDropEffects.Copy)) optimizer = (IOptimizer)optimizer.Clone();
    267267        Content.Optimizer = optimizer;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r5824 r5837  
    493493        if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) {
    494494          DataObject data = new DataObject();
    495           data.SetData("HeuristicLab", draggedRun);
     495          data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, draggedRun);
    496496          if (ReadOnly)
    497497            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r5744 r5837  
    273273        if (items.Count > 0) {
    274274          DataObject data = new DataObject();
    275           if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    276           else data.SetData("HeuristicLab", items);
     275          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     276          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    277277          if (Content.IsReadOnly || ReadOnly) {
    278278            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    288288    private void itemsListView_DragEnter(object sender, DragEventArgs e) {
    289289      validDragOperation = false;
    290       if (e.Data.GetData("HeuristicLab") is IRun) {
     290      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun)) {
    291291        validDragOperation = true;
    292       } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
     292      } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    293293        validDragOperation = true;
    294         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     294        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    295295        foreach (object item in items)
    296296          validDragOperation = validDragOperation && (item is IRun);
    297297      }
    298       validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;
    299298    }
    300299    private void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    310309    private void itemsListView_DragDrop(object sender, DragEventArgs e) {
    311310      if (e.Effect != DragDropEffects.None) {
    312         if (e.Data.GetData("HeuristicLab") is IRun) {
    313           IRun item = (IRun)e.Data.GetData("HeuristicLab");
     311        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun) {
     312          IRun item = (IRun)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    314313          Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item);
    315         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    316           IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<IRun>();
     314        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     315          IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<IRun>();
    317316          foreach (IRun item in items)
    318317            Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r5744 r5837  
    149149        if (item != null) {
    150150          DataObject data = new DataObject();
    151           data.SetData("HeuristicLab", item);
     151          data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, item);
    152152          DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy);
    153153        }
  • trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs

    r5744 r5837  
    122122      IItem item = (IItem)listViewItem.Tag;
    123123      DataObject data = new DataObject();
    124       data.SetData("HeuristicLab", item);
     124      data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, item);
    125125      DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy);
    126126    }
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs

    r5744 r5837  
    162162    protected virtual void valueGroupBox_DragEnterOver(object sender, DragEventArgs e) {
    163163      e.Effect = DragDropEffects.None;
    164       if (!ReadOnly && (e.Data.GetData("HeuristicLab") != null) && Content.DataType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {
     164      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.DataType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) {
    165165        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    166166        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    172172    protected virtual void valueGroupBox_DragDrop(object sender, DragEventArgs e) {
    173173      if (e.Effect != DragDropEffects.None) {
    174         T value = e.Data.GetData("HeuristicLab") as T;
     174        T value = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T;
    175175        if (e.Effect.HasFlag(DragDropEffects.Copy)) value = (T)value.Clone();
    176176        Content.Value = value;
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r5809 r5837  
    150150      e.Effect = DragDropEffects.None;
    151151      if (Content is IFixedValueParameter) return;
    152       if (!ReadOnly && (e.Data.GetData("HeuristicLab") != null) && Content.DataType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {
     152      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.DataType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) {
    153153        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    154154        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    160160    protected virtual void valueGroupBox_DragDrop(object sender, DragEventArgs e) {
    161161      if (e.Effect != DragDropEffects.None) {
    162         T value = e.Data.GetData("HeuristicLab") as T;
     162        T value = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as T;
    163163        if (e.Effect.HasFlag(DragDropEffects.Copy)) value = (T)value.Clone();
    164164        Content.Value = value;
Note: See TracChangeset for help on using the changeset viewer.