Free cookie consent management tool by TermsFeed Policy Generator

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/HeuristicLab.Clients.Hive/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.