Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7201


Ignore:
Timestamp:
12/19/11 03:17:35 (13 years ago)
Author:
swagner
Message:

Implemented static item image properties to avoid instance creation in TypeSelector and NewItemDialog (#1651)

Location:
trunk/sources
Files:
69 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/Benchmark.cs

    r7015 r7201  
    189189    }
    190190
     191    public static Image StaticItemImage {
     192      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     193    }
    191194    public Image ItemImage {
    192195      get {
     
    195198        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePaused;
    196199        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
    197         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     200        else return ItemAttribute.GetImage(this.GetType());
    198201      }
    199202    }
  • trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/DhrystoneBenchmark.cs

    r7006 r7201  
    6464    }
    6565
     66    public static Image StaticItemImage {
     67      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     68    }
    6669    public Image ItemImage {
    67       get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     70      get { return ItemAttribute.GetImage(this.GetType()); }
    6871    }
    6972
  • trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/LinpackBenchmark.cs

    r7007 r7201  
    6464    }
    6565
     66    public static Image StaticItemImage {
     67      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     68    }
    6669    public Image ItemImage {
    67       get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     70      get { return ItemAttribute.GetImage(this.GetType()); }
    6871    }
    6972
  • trunk/sources/HeuristicLab.Algorithms.Benchmarks/3.3/WhetstoneBenchmark.cs

    r7006 r7201  
    6464    }
    6565
     66    public static Image StaticItemImage {
     67      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     68    }
    6669    public Image ItemImage {
    67       get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     70      get { return ItemAttribute.GetImage(this.GetType()); }
    6871    }
    6972
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r7112 r7201  
    224224      }
    225225    }
     226    public static new Image StaticItemImage {
     227      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     228    }
    226229    public override Image ItemImage {
    227230      get {
     
    230233        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePaused;
    231234        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
    232         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     235        else return base.ItemImage;
    233236      }
    234237    }
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClusteringModel.cs

    r5809 r7201  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    24 using System.IO;
     23using System.Drawing;
    2524using System.Linq;
    26 using System.Text;
    2725using HeuristicLab.Common;
    2826using HeuristicLab.Core;
    2927using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using SVM;
    3128using HeuristicLab.Problems.DataAnalysis;
    32 using System.Drawing;
    3329
    3430namespace HeuristicLab.Algorithms.DataAnalysis {
     
    3935  [Item("KMeansClusteringModel", "Represents a k-Means clustering model.")]
    4036  public sealed class KMeansClusteringModel : NamedItem, IClusteringModel {
    41     public override Image ItemImage {
     37    public static new Image StaticItemImage {
    4238      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
    4339    }
  • trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyCollection.cs

    r5445 r7201  
    3333  [StorableClass]
    3434  public class AlleleFrequencyCollection : ReadOnlyItemCollection<AlleleFrequency> {
    35     public override Image ItemImage {
     35    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.Statistics; }
    3737    }
  • trunk/sources/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyCollectionHistory.cs

    r5445 r7201  
    3333  [StorableClass]
    3434  public class AlleleFrequencyCollectionHistory : ItemCollection<AlleleFrequencyCollection> {
    35     public override Image ItemImage {
     35    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.Cab; }
    3737    }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataTable.cs

    r5445 r7201  
    3838  [StorableClass]
    3939  public class DataTable : NamedItem, IStringConvertibleMatrix {
    40     public override Image ItemImage {
     40    public static new Image StaticItemImage {
    4141      get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; }
    4242    }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataTableHistory.cs

    r5445 r7201  
    3333  [StorableClass]
    3434  public class DataTableHistory : ItemCollection<DataTable> {
    35     public override Image ItemImage {
     35    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.Cab; }
    3737    }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/HeatMap.cs

    r5445 r7201  
    3131  [StorableClass]
    3232  public class HeatMap : DoubleMatrix {
    33     public override Image ItemImage {
     33    public static new Image StaticItemImage {
    3434      get { return HeuristicLab.Common.Resources.VSImageLibrary.Gradient; }
    3535    }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/HeatMapHistory.cs

    r5445 r7201  
    3333  [StorableClass]
    3434  public class HeatMapHistory : ItemCollection<HeatMap> {
    35     public override Image ItemImage {
     35    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.Cab; }
    3737    }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs

    r7192 r7201  
    4040    protected ReaderWriterLockSlim childHiveTasksLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
    4141
     42    public static new Image StaticItemImage {
     43      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     44    }
    4245    public override Image ItemImage {
    4346      get {
     
    5255          else if (task.State == TaskState.Failed) return HeuristicLab.Common.Resources.VSImageLibrary.Error;
    5356          else if (task.State == TaskState.Finished) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
    54           else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     57          else return base.ItemImage;
    5558        }
    5659      }
     
    120123              hiveJob.IsControllable = value;
    121124            }
    122           } finally {
     125          }
     126          finally {
    123127            childHiveTasksLock.ExitReadLock();
    124128          }
     
    134138        try {
    135139          return childHiveTasks.AsReadOnly();
    136         } finally { childHiveTasksLock.ExitReadLock(); }
     140        }
     141        finally { childHiveTasksLock.ExitReadLock(); }
    137142      }
    138143    }
     
    193198      try {
    194199        this.childHiveTasks = cloner.Clone(original.childHiveTasks);
    195       } finally { original.childHiveTasksLock.ExitReadLock(); }
     200      }
     201      finally { original.childHiveTasksLock.ExitReadLock(); }
    196202      this.syncTasksWithOptimizers = original.syncTasksWithOptimizers;
    197203      this.isFinishedTaskDownloaded = original.isFinishedTaskDownloaded;
     
    242248      try {
    243249        this.childHiveTasks.Add(hiveTask);
    244       } finally { childHiveTasksLock.ExitWriteLock(); }
     250      }
     251      finally { childHiveTasksLock.ExitWriteLock(); }
    245252    }
    246253
     
    359366        }
    360367        return jobs;
    361       } finally { childHiveTasksLock.ExitReadLock(); }
     368      }
     369      finally { childHiveTasksLock.ExitReadLock(); }
    362370    }
    363371
     
    373381        }
    374382        return null;
    375       } finally { childHiveTasksLock.ExitWriteLock(); }
     383      }
     384      finally { childHiveTasksLock.ExitWriteLock(); }
    376385    }
    377386
     
    390399              return result;
    391400          }
    392         } finally { childHiveTasksLock.ExitReadLock(); }
     401        }
     402        finally { childHiveTasksLock.ExitReadLock(); }
    393403      }
    394404      return null;
     
    405415          child.RemoveByTaskId(jobId);
    406416        }
    407       } finally { childHiveTasksLock.ExitWriteLock(); }
     417      }
     418      finally { childHiveTasksLock.ExitWriteLock(); }
    408419    }
    409420
     
    458469            HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id));
    459470          }
    460         } finally { childHiveTasksLock.ExitReadLock(); }
     471        }
     472        finally { childHiveTasksLock.ExitReadLock(); }
    461473      } else {
    462474        HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));
     
    471483            HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id));
    472484          }
    473         } finally { childHiveTasksLock.ExitReadLock(); }
     485        }
     486        finally { childHiveTasksLock.ExitReadLock(); }
    474487      } else {
    475488        HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveItem.cs

    r6976 r7201  
    3838      get { return ItemAttribute.GetVersion(this.GetType()); }
    3939    }
     40    public static new Image StaticItemImage {
     41      get { return HeuristicLab.Common.Resources.VSImageLibrary.Database; }
     42    }
    4043    public virtual Image ItemImage {
    4144      get {
     
    4346          return HeuristicLab.Common.Resources.VSImageLibrary.DatabaseModified;
    4447        else
    45           return HeuristicLab.Common.Resources.VSImageLibrary.Database;
     48          return ItemAttribute.GetImage(this.GetType());
    4649      }
    4750    }
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs

    r6976 r7201  
    152152    }
    153153
    154     public override Image ItemImage {
     154    public static new Image StaticItemImage {
    155155      get { return HeuristicLab.Common.Resources.VSImageLibrary.Operator; }
    156156    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r7123 r7201  
    142142              else if (type.ContainsGenericParameters) typeNode.ImageIndex = 3;
    143143              else if (imageList.Images.ContainsKey(type.FullName)) typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName);
    144               else if (typeof(IItem).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract && type.GetConstructor(Type.EmptyTypes) != null) {
    145                 IItem item = (IItem)Activator.CreateInstance(type);
    146                 imageList.Images.Add(type.FullName, item.ItemImage);
    147                 typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName);
     144              else {
     145                var image = ItemAttribute.GetImage(type);
     146                if (image != null) {
     147                  imageList.Images.Add(type.FullName, image);
     148                  typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName);
     149                }
    148150              }
    149151              typeNode.SelectedImageIndex = typeNode.ImageIndex;
  • trunk/sources/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs

    r5445 r7201  
    2121
    2222using System;
     23using System.Drawing;
    2324using System.Linq;
    2425using System.Reflection;
     
    8283      }
    8384    }
     85    public static Image GetImage(Type type) {
     86      var staticItemImageProperty = type.GetProperty("StaticItemImage", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
     87      return staticItemImageProperty == null ? null : (Image)staticItemImageProperty.GetValue(null, null);
     88    }
    8489  }
    8590}
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemArray.cs

    r5445 r7201  
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
    28 using HeuristicLab.Common.Resources;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    4241      get { return ItemAttribute.GetVersion(this.GetType()); }
    4342    }
     43    public static Image StaticItemImage {
     44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     45    }
    4446    public virtual Image ItemImage {
    45       get { return VSImageLibrary.Class; }
     47      get { return ItemAttribute.GetImage(this.GetType()); }
    4648    }
    4749
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemCollection.cs

    r5445 r7201  
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
    28 using HeuristicLab.Common.Resources;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    4241      get { return ItemAttribute.GetVersion(this.GetType()); }
    4342    }
     43    public static Image StaticItemImage {
     44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     45    }
    4446    public virtual Image ItemImage {
    45       get { return VSImageLibrary.Class; }
     47      get { return ItemAttribute.GetImage(this.GetType()); }
    4648    }
    4749
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs

    r5445 r7201  
    2525using HeuristicLab.Collections;
    2626using HeuristicLab.Common;
    27 using HeuristicLab.Common.Resources;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928
     
    4443      get { return ItemAttribute.GetVersion(this.GetType()); }
    4544    }
     45    public static Image StaticItemImage {
     46      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     47    }
    4648    public virtual Image ItemImage {
    47       get { return VSImageLibrary.Class; }
     49      get { return ItemAttribute.GetImage(this.GetType()); }
    4850    }
    4951
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemList.cs

    r5445 r7201  
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
    28 using HeuristicLab.Common.Resources;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    4241      get { return ItemAttribute.GetVersion(this.GetType()); }
    4342    }
     43    public static Image StaticItemImage {
     44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     45    }
    4446    public virtual Image ItemImage {
    45       get { return VSImageLibrary.Class; }
     47      get { return ItemAttribute.GetImage(this.GetType()); }
    4648    }
    4749
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemSet.cs

    r6525 r7201  
    2626using HeuristicLab.Collections;
    2727using HeuristicLab.Common;
    28 using HeuristicLab.Common.Resources;
    2928using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3029
     
    4241      get { return ItemAttribute.GetVersion(this.GetType()); }
    4342    }
     43    public static Image StaticItemImage {
     44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     45    }
    4446    public virtual Image ItemImage {
    45       get { return VSImageLibrary.Class; }
     47      get { return ItemAttribute.GetImage(this.GetType()); }
    4648    }
    4749
  • trunk/sources/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs

    r5445 r7201  
    4040      get { return ItemAttribute.GetVersion(this.GetType()); }
    4141    }
     42    public static Image StaticItemImage {
     43      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     44    }
    4245    public virtual Image ItemImage {
    43       get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     46      get { return ItemAttribute.GetImage(this.GetType()); }
    4447    }
    4548
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4039      get { return ItemAttribute.GetVersion(this.GetType()); }
    4140    }
     41    public static Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     43    }
    4244    public virtual Image ItemImage {
    43       get { return VSImageLibrary.Class; }
     45      get { return ItemAttribute.GetImage(this.GetType()); }
    4446    }
    4547
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4039      get { return ItemAttribute.GetVersion(this.GetType()); }
    4140    }
     41    public static Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     43    }
    4244    public virtual Image ItemImage {
    43       get { return VSImageLibrary.Class; }
     45      get { return ItemAttribute.GetImage(this.GetType()); }
    4446    }
    4547
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4342      get { return ItemAttribute.GetVersion(this.GetType()); }
    4443    }
     44    public static Image StaticItemImage {
     45      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     46    }
    4547    public virtual Image ItemImage {
    46       get { return VSImageLibrary.Class; }
     48      get { return ItemAttribute.GetImage(this.GetType()); }
    4749    }
    4850
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4039      get { return ItemAttribute.GetVersion(this.GetType()); }
    4140    }
     41    public static Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     43    }
    4244    public virtual Image ItemImage {
    43       get { return VSImageLibrary.Class; }
     45      get { return ItemAttribute.GetImage(this.GetType()); }
    4446    }
    4547
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4039      get { return ItemAttribute.GetVersion(this.GetType()); }
    4140    }
     41    public static Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     43    }
    4244    public virtual Image ItemImage {
    43       get { return VSImageLibrary.Class; }
     45      get { return ItemAttribute.GetImage(this.GetType()); }
    4446    }
    4547
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs

    r5445 r7201  
    2424using HeuristicLab.Collections;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2827
     
    4039      get { return ItemAttribute.GetVersion(this.GetType()); }
    4140    }
     41    public static Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     43    }
    4244    public virtual Image ItemImage {
    43       get { return VSImageLibrary.Class; }
     45      get { return ItemAttribute.GetImage(this.GetType()); }
    4446    }
    4547
  • trunk/sources/HeuristicLab.Core/3.3/Executable.cs

    r5445 r7201  
    2929  [StorableClass]
    3030  public abstract class Executable : Item, IExecutable {
     31    public static new Image StaticItemImage {
     32      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     33    }
    3134    public override Image ItemImage {
    3235      get {
     
    3538        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePaused;
    3639        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
    37         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     40        else return base.ItemImage;
    3841      }
    3942    }
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r5445 r7201  
    4141      get { return ItemAttribute.GetVersion(this.GetType()); }
    4242    }
     43    public static Image StaticItemImage {
     44      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     45    }
    4346    public virtual Image ItemImage {
    44       get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
     47      get { return ItemAttribute.GetImage(this.GetType()); }
    4548    }
    4649
  • trunk/sources/HeuristicLab.Core/3.3/Log.cs

    r6862 r7201  
    3333    public string Filename { get; set; }
    3434
    35     public override Image ItemImage {
     35    public static new Image StaticItemImage {
    3636      get { return HeuristicLab.Common.Resources.VSImageLibrary.File; }
    3737    }
  • trunk/sources/HeuristicLab.Core/3.3/Scope.cs

    r5445 r7201  
    3232  [StorableClass]
    3333  public sealed class Scope : NamedItem, IScope {
    34     public override Image ItemImage {
     34    public static new Image StaticItemImage {
    3535      get { return HeuristicLab.Common.Resources.VSImageLibrary.OrgChart; }
    3636    }
  • trunk/sources/HeuristicLab.Data/3.3/BoolValue.cs

    r5445 r7201  
    3131  [StorableClass]
    3232  public class BoolValue : ValueTypeValue<bool>, IComparable, IStringConvertibleValue {
    33     public override Image ItemImage {
     33    public static new Image StaticItemImage {
    3434      get { return HeuristicLab.Common.Resources.VSImageLibrary.Field; }
    3535    }
  • trunk/sources/HeuristicLab.Data/3.3/Comparison.cs

    r5445 r7201  
    3030  [StorableClass]
    3131  public class Comparison : ValueTypeValue<ComparisonType>, IComparable {
    32     public override Image ItemImage {
     32    public static new Image StaticItemImage {
    3333      get { return HeuristicLab.Common.Resources.VSImageLibrary.Enum; }
    3434    }
  • trunk/sources/HeuristicLab.Data/3.3/DoubleValue.cs

    r5445 r7201  
    3131  [StorableClass]
    3232  public class DoubleValue : ValueTypeValue<double>, IComparable, IStringConvertibleValue {
    33     public override Image ItemImage {
     33    public static new Image StaticItemImage {
    3434      get { return HeuristicLab.Common.Resources.VSImageLibrary.Field; }
    3535    }
  • trunk/sources/HeuristicLab.Data/3.3/IntValue.cs

    r5445 r7201  
    3131  [StorableClass]
    3232  public class IntValue : ValueTypeValue<int>, IComparable, IStringConvertibleValue {
    33     public override Image ItemImage {
     33    public static new Image StaticItemImage {
    3434      get { return HeuristicLab.Common.Resources.VSImageLibrary.Field; }
    3535    }
  • trunk/sources/HeuristicLab.Data/3.3/StringArray.cs

    r5445 r7201  
    3434  [StorableClass]
    3535  public class StringArray : Item, IEnumerable<string>, IStringConvertibleArray {
    36     public override Image ItemImage {
     36    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    3838    }
  • trunk/sources/HeuristicLab.Data/3.3/StringConvertibleValueTuple.cs

    r5809 r7201  
    3232    where T : class, IDeepCloneable, IStringConvertibleValue
    3333    where U : class, IDeepCloneable, IStringConvertibleValue {
    34     public override Image ItemImage {
     34    public static new Image StaticItemImage {
    3535      get { return HeuristicLab.Common.Resources.VSImageLibrary.ValueType; }
    3636    }
  • trunk/sources/HeuristicLab.Data/3.3/StringMatrix.cs

    r5445 r7201  
    3434  [StorableClass]
    3535  public class StringMatrix : Item, IEnumerable<string>, IStringConvertibleMatrix {
    36     public override Image ItemImage {
     36    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    3838    }
  • trunk/sources/HeuristicLab.Data/3.3/StringValue.cs

    r5445 r7201  
    3030  [StorableClass]
    3131  public class StringValue : Item, IComparable, IStringConvertibleValue {
    32     public override Image ItemImage {
     32    public static new Image StaticItemImage {
    3333      get { return HeuristicLab.Common.Resources.VSImageLibrary.Field; }
    3434    }
  • trunk/sources/HeuristicLab.Data/3.3/ValueTypeArray.cs

    r5445 r7201  
    3434  [StorableClass]
    3535  public abstract class ValueTypeArray<T> : Item, IEnumerable<T> where T : struct {
    36     public override Image ItemImage {
     36    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    3838    }
  • trunk/sources/HeuristicLab.Data/3.3/ValueTypeMatrix.cs

    r5445 r7201  
    3434  [StorableClass]
    3535  public abstract class ValueTypeMatrix<T> : Item, IEnumerable<T> where T : struct {
    36     public override Image ItemImage {
     36    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    3838    }
  • trunk/sources/HeuristicLab.Data/3.3/ValueTypeValue.cs

    r5445 r7201  
    3030  [StorableClass]
    3131  public abstract class ValueTypeValue<T> : Item where T : struct {
    32     public override Image ItemImage {
     32    public static new Image StaticItemImage {
    3333      get { return HeuristicLab.Common.Resources.VSImageLibrary.ValueType; }
    3434    }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationType.cs

    r5445 r7201  
    3030  [StorableClass]
    3131  public class PermutationType : ValueTypeValue<PermutationTypes> {
    32     public override Image ItemImage {
     32    public static new Image StaticItemImage {
    3333      get { return HeuristicLab.Common.Resources.VSImageLibrary.Enum; }
    3434    }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTree.cs

    r5809 r7201  
    3131  [Item("SymbolicExpressionTree", "Represents a symbolic expression tree.")]
    3232  public class SymbolicExpressionTree : Item, ISymbolicExpressionTree {
    33     public override Image ItemImage {
     33    public static new Image StaticItemImage {
    3434      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
    3535    }
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs

    r5781 r7201  
    5252    }
    5353
    54     public override System.Drawing.Image ItemImage { get { return VSImageLibrary.Script; } }
     54    public static new System.Drawing.Image StaticItemImage { get { return VSImageLibrary.Script; } }
    5555
    5656    private MethodInfo executeMethod;
     
    280280            assemblies.Add(a, false);
    281281          }
    282         } catch (NotSupportedException) {
     282        }
     283        catch (NotSupportedException) {
    283284          // NotSupportedException is thrown while accessing
    284285          // the Location property of the anonymously hosted
  • trunk/sources/HeuristicLab.Operators/3.3/AlgorithmOperator.cs

    r5445 r7201  
    3232  [StorableClass]
    3333  public abstract class AlgorithmOperator : SingleSuccessorOperator {
     34    public static new Image StaticItemImage {
     35      get { return HeuristicLab.Common.Resources.VSImageLibrary.Module; }
     36    }
    3437    public override Image ItemImage {
    3538      get {
    3639        if (Breakpoint) return HeuristicLab.Common.Resources.VSImageLibrary.BreakpointActive;
    37         else return HeuristicLab.Common.Resources.VSImageLibrary.Module;
     40        else return base.ItemImage;
    3841      }
    3942    }
  • trunk/sources/HeuristicLab.Operators/3.3/Operator.cs

    r6114 r7201  
    3434  [StorableClass]
    3535  public abstract class Operator : ParameterizedNamedItem, IOperator, IStatefulItem {
     36    public static new Image StaticItemImage {
     37      get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
     38    }
    3639    public override Image ItemImage {
    3740      get {
    3841        if (Breakpoint) return HeuristicLab.Common.Resources.VSImageLibrary.BreakpointActive;
    39         else return HeuristicLab.Common.Resources.VSImageLibrary.Method;
     42        else return base.ItemImage;
    4043      }
    4144    }
  • trunk/sources/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r6114 r7201  
    3737  [StorableClass]
    3838  public abstract class Algorithm : ParameterizedNamedItem, IAlgorithm {
     39    public static new Image StaticItemImage {
     40      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     41    }
    3942    public override Image ItemImage {
    4043      get {
     
    4346        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePaused;
    4447        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped;
    45         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     48        else return base.ItemImage;
    4649      }
    4750    }
  • trunk/sources/HeuristicLab.Optimization/3.3/BatchRun.cs

    r6816 r7201  
    3939    public string Filename { get; set; }
    4040
     41    public static new Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     43    }
    4144    public override Image ItemImage {
    4245      get {
     
    4548        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunPaused;
    4649        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.BatchRunStopped;
    47         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     50        else return base.ItemImage;
    4851      }
    4952    }
  • trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs

    r7197 r7201  
    3939    public string Filename { get; set; }
    4040
     41    public static new Image StaticItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }
     43    }
    4144    public override Image ItemImage {
    4245      get {
     
    4548        else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentPaused;
    4649        else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExperimentStopped;
    47         else return HeuristicLab.Common.Resources.VSImageLibrary.Event;
     50        else return base.ItemImage;
    4851      }
    4952    }
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/Problem.cs

    r6938 r7201  
    3939    }
    4040
    41     public override Image ItemImage {
     41    public static new Image StaticItemImage {
    4242      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
    4343    }
  • trunk/sources/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs

    r5954 r7201  
    4343    public string Filename { get; set; }
    4444
    45     public override Image ItemImage {
     45    public static new Image StaticItemImage {
    4646      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
    4747    }
     
    263263      #endregion
    264264
    265       public override Image ItemImage {
     265      public static new Image StaticItemImage {
    266266        get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
    267267      }
  • trunk/sources/HeuristicLab.Optimization/3.3/ResultCollection.cs

    r6524 r7201  
    4141    }
    4242
    43     public override System.Drawing.Image ItemImage {
     43    public static new System.Drawing.Image StaticItemImage {
    4444      get { return HeuristicLab.Common.Resources.VSImageLibrary.Object; }
    4545    }
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r5445 r7201  
    2121
    2222using System;
    23 using System.Collections.Generic;
     23using System.Drawing;
    2424using System.Linq;
    2525using System.Windows.Forms;
     
    3030  internal partial class NewItemDialog : Form {
    3131    private bool initialized;
    32     private List<IItem> items;
    3332
    3433    private IItem item;
     
    3938    public NewItemDialog() {
    4039      initialized = false;
    41       items = new List<IItem>();
    4240      item = null;
    4341      InitializeComponent();
     
    5351
    5452        itemsListView.SmallImageList = new ImageList();
     53        itemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class);  // default icon
    5554        foreach (var category in categories) {
    5655          ListViewGroup group = new ListViewGroup(category.Key);
    5756          itemsListView.Groups.Add(group);
    5857          foreach (var creatable in category) {
    59             IItem i = (IItem)Activator.CreateInstance(creatable);
    60             items.Add(i);
    61             ListViewItem item = new ListViewItem(new string[] { i.ItemName, i.ItemVersion.ToString(), i.ItemDescription }, group);
    62             itemsListView.SmallImageList.Images.Add(i.ItemImage);
    63             item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
    64             item.Tag = i;
     58            string name = ItemAttribute.GetName(creatable);
     59            string version = ItemAttribute.GetVersion(creatable).ToString();
     60            string description = ItemAttribute.GetDescription(creatable);
     61            ListViewItem item = new ListViewItem(new string[] { name, version, description }, group);
     62            item.ImageIndex = 0;
     63            Image image = ItemAttribute.GetImage(creatable);
     64            if (image != null) {
     65              itemsListView.SmallImageList.Images.Add(image);
     66              item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     67            }
     68            item.Tag = creatable;
    6569            itemsListView.Items.Add(item);
    6670          }
     
    8286    private void okButton_Click(object sender, EventArgs e) {
    8387      if (itemsListView.SelectedItems.Count == 1) {
    84         item = (IItem)((IItem)itemsListView.SelectedItems[0].Tag).Clone();
     88        item = (IItem)Activator.CreateInstance((Type)itemsListView.SelectedItems[0].Tag);
    8589        DialogResult = DialogResult.OK;
    8690        Close();
     
    8993    private void itemTypesListView_DoubleClick(object sender, EventArgs e) {
    9094      if (itemsListView.SelectedItems.Count == 1) {
    91         item = (IItem)((IItem)itemsListView.SelectedItems[0].Tag).Clone();
     95        item = (IItem)Activator.CreateInstance((Type)itemsListView.SelectedItems[0].Tag);
    9296        DialogResult = DialogResult.OK;
    9397        Close();
  • trunk/sources/HeuristicLab.Problems.ArtificialAnt/3.4/AntTrail.cs

    r5809 r7201  
    3535  [StorableClass]
    3636  public sealed class AntTrail : Item {
    37     public override Image ItemImage {
     37    public static new Image StaticItemImage {
    3838      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    3939    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs

    r5914 r7201  
    3232  [StorableClass]
    3333  public abstract class SymbolicDataAnalysisModel : NamedItem, ISymbolicDataAnalysisModel {
    34     public override Image ItemImage {
     34    public static new Image StaticItemImage {
    3535      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
    3636    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r7037 r7201  
    102102    #region properties
    103103    public string Filename { get; set; }
    104     public override Image ItemImage { get { return VSImageLibrary.Type; } }
     104    public static new Image StaticItemImage { get { return VSImageLibrary.Type; } }
    105105
    106106    IDataAnalysisProblemData IDataAnalysisProblem.ProblemData {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisSolution.cs

    r6653 r7201  
    3737    public string Filename { get; set; }
    3838
    39     public override Image ItemImage {
     39    public static new Image StaticItemImage {
    4040      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
    4141    }
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/EvaluationCache.cs

    r6519 r7201  
    8686
    8787    #region Properties
    88     public override System.Drawing.Image ItemImage {
     88    public static new System.Drawing.Image StaticItemImage {
    8989      get { return VSImageLibrary.Database; }
    9090    }
     
    220220                index[entry] = list.AddLast(entry);
    221221                Trim();
    222               } finally {
     222              }
     223              finally {
    223224                if (!lockTaken)
    224225                  Monitor.Enter(cacheLock, ref lockTaken);
     
    233234          }
    234235        }
    235       } finally {
     236      }
     237      finally {
    236238        if (lockTaken)
    237239          Monitor.Exit(cacheLock);
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r6189 r7201  
    4141    public string Filename { get; set; }
    4242
    43     public override Image ItemImage {
     43    public static new Image StaticItemImage {
    4444      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
    4545    }
  • trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackSolution.cs

    r5445 r7201  
    3535  [StorableClass]
    3636  public class KnapsackSolution : Item {
    37     public override Image ItemImage {
     37    public static new Image StaticItemImage {
    3838      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    3939    }
  • trunk/sources/HeuristicLab.Problems.OneMax/3.3/OneMaxSolution.cs

    r5445 r7201  
    3535  [StorableClass]
    3636  public sealed class OneMaxSolution : Item {
    37     public override Image ItemImage {
     37    public static new Image StaticItemImage {
    3838      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    3939    }
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r7041 r7201  
    4444    public string Filename { get; set; }
    4545
    46     public override Image ItemImage {
     46    public static new Image StaticItemImage {
    4747      get { return HeuristicLab.Common.Resources.VSImageLibrary.Type; }
    4848    }
  • trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionSolution.cs

    r5445 r7201  
    3636  [StorableClass]
    3737  public class SingleObjectiveTestFunctionSolution : Item {
    38     public override Image ItemImage {
     38    public static new Image StaticItemImage {
    3939      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    4040    }
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/PathTSPTour.cs

    r5445 r7201  
    3535  [StorableClass]
    3636  public sealed class PathTSPTour : Item {
    37     public override Image ItemImage {
     37    public static new Image StaticItemImage {
    3838      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    3939    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/TourEncoding.cs

    r5445 r7201  
    3232  [StorableClass]
    3333  public abstract class TourEncoding : Item, IVRPEncoding {
    34     public override Image ItemImage {
     34    public static new Image StaticItemImage {
    3535      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
    3636    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPSolution.cs

    r5445 r7201  
    3434  [StorableClass]
    3535  public sealed class VRPSolution : Item {
    36     public override Image ItemImage {
     36    public static new Image StaticItemImage {
    3737      get { return HeuristicLab.Common.Resources.VSImageLibrary.Image; }
    3838    }
Note: See TracChangeset for help on using the changeset viewer.