Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/20/11 11:45:18 (13 years ago)
Author:
gkronber
Message:

#1081 merged r7103:7209 from trunk into time series branch

Location:
branches/HeuristicLab.TimeSeries
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs

    r5445 r7213  
    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}
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemArray.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemCollection.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemList.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemSet.cs

    r6525 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Executable.cs

    r5445 r7213  
    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    }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Item.cs

    r5445 r7213  
    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
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Log.cs

    r6862 r7213  
    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    }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Scope.cs

    r5445 r7213  
    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    }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/ThreadSafeLog.cs

    r6862 r7213  
    3030  [Item("ThreadSafeLog", "A thread-safe log for logging string messages.")]
    3131  [StorableClass]
    32   public class ThreadSafeLog : Log, IDeepCloneable {
    33     protected ReaderWriterLockSlim locker = new ReaderWriterLockSlim();
     32  public sealed class ThreadSafeLog : Log {
     33    private ReaderWriterLockSlim locker = new ReaderWriterLockSlim();
    3434
    3535    public override IEnumerable<string> Messages {
     
    3838        try {
    3939          return messages.ToArray(); // return copy of messages
    40         }
    41         finally { locker.ExitReadLock(); }
     40        } finally { locker.ExitReadLock(); }
    4241      }
    4342    }
    4443
    4544    [StorableConstructor]
    46     protected ThreadSafeLog(bool deserializing) : base(deserializing) { }
     45    private ThreadSafeLog(bool deserializing) : base(deserializing) { }
    4746    public ThreadSafeLog(long maxMessageCount = -1)
    4847      : base(maxMessageCount) {
    4948    }
    5049
    51     protected ThreadSafeLog(ThreadSafeLog original, Cloner cloner) {
    52       original.locker.EnterReadLock();
    53       try {
    54         cloner.RegisterClonedObject(original, this);
    55         this.messages = new List<string>(original.messages);
    56         this.maxMessageCount = original.maxMessageCount;
    57       }
    58       finally { original.locker.ExitReadLock(); }
    59     }
     50    private ThreadSafeLog(ThreadSafeLog original, Cloner cloner)
     51      : base(original, cloner) { }
    6052
    6153    public override IDeepCloneable Clone(Cloner cloner) {
    62       return new ThreadSafeLog(this, cloner);
     54      locker.EnterReadLock();
     55      try {
     56        return new ThreadSafeLog(this, cloner);
     57      } finally { locker.ExitReadLock(); }
    6358    }
    6459
     
    6762      try {
    6863        messages.Clear();
    69       }
    70       finally { locker.ExitWriteLock(); }
     64      } finally { locker.ExitWriteLock(); }
    7165      OnCleared();
    7266    }
     
    7872        messages.Add(s);
    7973        CapMessages();
    80       }
    81       finally { locker.ExitWriteLock(); }
     74      } finally { locker.ExitWriteLock(); }
    8275      OnMessageAdded(s);
    8376    }
     
    8982        messages.Add(s);
    9083        CapMessages();
    91       }
    92       finally { locker.ExitWriteLock(); }
     84      } finally { locker.ExitWriteLock(); }
    9385      OnMessageAdded(s);
    9486    }
Note: See TracChangeset for help on using the changeset viewer.