Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/15 00:06:42 (9 years ago)
Author:
ascheibe
Message:

#2409 added support for IProgrammableItem in Hive

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Util/PluginUtil.cs

    r12012 r12621  
    2626using System.Security.Cryptography;
    2727using System.ServiceModel;
     28using HeuristicLab.Common;
     29using HeuristicLab.Core;
    2830using HeuristicLab.PluginInfrastructure;
    2931
     
    7981    }
    8082
    81     public static Plugin CreatePlugin(IPluginDescription plugin) {
    82       return new Plugin() { Name = plugin.Name, Version = plugin.Version };
    83     }
    84 
    8583    public static List<PluginData> CreatePluginDatas(IPluginDescription plugin) {
    8684      List<PluginData> pluginDatas = new List<PluginData>();
     
    9694    }
    9795
    98     public static void CollectDeclaringPlugins(List<IPluginDescription> plugins, IEnumerable<Type> usedTypes) {
     96    public static List<IPluginDescription> GetPluginsForTask(IEnumerable<Type> usedTypes, object task) {
     97      if (task.GetObjectGraphObjects().Any(x => typeof(IProgrammableItem).IsInstanceOfType(x))) {
     98        //when a programmable item is used all plugins that are currently loaded need to be sent to Hive
     99        return ApplicationManager.Manager.Plugins.ToList();
     100      } else {
     101        return CollectDeclaringPlugins(usedTypes);
     102      }
     103    }
     104
     105    private static List<IPluginDescription> CollectDeclaringPlugins(IEnumerable<Type> usedTypes) {
     106      List<IPluginDescription> plugins = new List<IPluginDescription>();
    99107      foreach (Type type in usedTypes) {
    100108        var plugin = ApplicationManager.Manager.GetDeclaringPlugin(type);
     
    104112        }
    105113      }
     114      return plugins;
    106115    }
    107116
    108     public static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
     117    private static void CollectPluginDependencies(List<IPluginDescription> plugins, IPluginDescription plugin) {
    109118      if (plugin == null) return;
    110119      foreach (var dependency in plugin.Dependencies) {
Note: See TracChangeset for help on using the changeset viewer.