Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2748 for trunk/sources


Ignore:
Timestamp:
02/04/10 09:38:25 (15 years ago)
Author:
gkronber
Message:

Fixed issues in plugin infrastructure as identified by abeham. #863 (Code review)

Location:
trunk/sources/HeuristicLab.PluginInfrastructure
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/ApplicationManager.cs

    r2693 r2748  
    4646    }
    4747
     48    /// <summary>
     49    /// Fired when a plugin is loaded.
     50    /// </summary>
    4851    internal event EventHandler<PluginInfrastructureEventArgs> PluginLoaded;
     52    /// <summary>
     53    /// Fired when a plugin is unloaded (when the application terminates).
     54    /// </summary>
    4955    internal event EventHandler<PluginInfrastructureEventArgs> PluginUnloaded;
    5056
     
    8389    }
    8490
     91    /// <summary>
     92    /// Prepares the application domain for the execution of an HL application.
     93    /// Pre-loads all <paramref name="plugins"/>.
     94    /// </summary>
     95    /// <param name="apps">Enumerable of available HL applications.</param>
     96    /// <param name="plugins">Enumerable of plugins that should be pre-loaded.</param>
    8597    internal void PrepareApplicationDomain(IEnumerable<ApplicationDescription> apps, IEnumerable<PluginDescription> plugins) {
    8698      this.plugins = new List<PluginDescription>(plugins);
     
    99111    }
    100112
     113    /// <summary>
     114    /// Loads the <paramref name="plugins"/> into this application domain.
     115    /// </summary>
     116    /// <param name="plugins">Enumerable of plugins that should be loaded.</param>
    101117    private void LoadPlugins(IEnumerable<PluginDescription> plugins) {
    102118      // load all loadable plugins (all dependencies available) into the execution context
     
    116132    }
    117133
     134    /// <summary>
     135    /// Runs the application declared in <paramref name="appInfo"/>.
     136    /// This is a synchronous call. When the application is terminated all plugins are unloaded.
     137    /// </summary>
     138    /// <param name="appInfo">Description of the application to run</param>
    118139    internal void Run(ApplicationDescription appInfo) {
    119140      IApplication runnablePlugin = (IApplication)Activator.CreateInstance(appInfo.DeclaringAssemblyName, appInfo.DeclaringTypeName).Unwrap();
     
    193214    /// </summary>
    194215    /// <param name="type">Most general type for which to find matching types.</param>
    195     /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
     216    /// <param name="onlyInstantiable">Return only types that are instantiable
     217    /// (interfaces, abstract classes... are not returned)</param>
    196218    /// <returns>Enumerable of the discovered types.</returns>
    197219    internal static IEnumerable<Type> GetTypes(Type type, bool onlyInstantiable) {
     
    207229    /// <param name="type">Most general type for which to find matching types.</param>
    208230    /// <param name="plugin">The plugin the subtypes must be part of.</param>
    209     /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
     231    /// <param name="onlyInstantiable">Return only types that are instantiable
     232    /// (interfaces, abstract classes... are not returned)</param>
    210233    /// <returns>Enumerable of the discovered types.</returns>
    211234    internal static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription, bool onlyInstantiable) {
     
    223246    /// <param name="type">Most general type we want to find.</param>
    224247    /// <param name="assembly">Assembly that should be searched for types.</param>
    225     /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
     248    /// <param name="onlyInstantiable">Return only types that are instantiable
     249    /// (interfaces, abstract classes...  are not returned)</param>
    226250    /// <returns>Enumerable of the discovered types.</returns>
    227251    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable) {
  • trunk/sources/HeuristicLab.PluginInfrastructure/Attributes/PluginAttribute.cs

    r2504 r2748  
    5252    /// </summary>
    5353    public PluginAttribute(string name)
    54       : this(name, "") {
     54      : this(name, string.Empty) {
    5555    }
    5656
     
    6161    /// </summary>
    6262    public PluginAttribute(string name, string description) {
     63      if (string.IsNullOrEmpty(name)) throw new ArgumentException("Plugin name is null or empty.");
     64      if (description == null) throw new ArgumentNullException("description");
    6365      this.name = name;
    6466      this.description = description;
  • trunk/sources/HeuristicLab.PluginInfrastructure/Attributes/PluginDependencyAttribute.cs

    r2504 r2748  
    2626namespace HeuristicLab.PluginInfrastructure {
    2727  /// <summary>
    28   /// This attribute can be used to declare that an plugin depends on a another plugin.
     28  /// This attribute can be used to declare that a plugin depends on a another plugin.
    2929  /// </summary>
    3030  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
  • trunk/sources/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs

    r2592 r2748  
    5858    }
    5959
    60     /// <inhertitdoc>
     60    /// <inhertitdoc />
    6161    public virtual void OnLoad() { }
    62     /// <inhertitdoc>
     62    /// <inhertitdoc />
    6363    public virtual void OnUnload() { }
    6464    #endregion
  • trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj

    r2688 r2748  
    9494    <Compile Include="Advanced\InstallationManagerConsole.cs" />
    9595    <Compile Include="Advanced\InstallationManager.cs" />
     96    <Compile Include="Advanced\InstallationManagerForm.cs">
     97      <SubType>Form</SubType>
     98    </Compile>
     99    <Compile Include="Advanced\InstallationManagerForm.Designer.cs">
     100      <DependentUpon>InstallationManagerForm.cs</DependentUpon>
     101    </Compile>
    96102    <Compile Include="Attributes\ApplicationAttribute.cs" />
    97103    <Compile Include="Attributes\AssemblyBuildDateAttribute.cs" />
     
    122128    <Compile Include="Main.cs" />
    123129    <Compile Include="Properties\AssemblyInfo.cs" />
     130    <EmbeddedResource Include="Advanced\InstallationManagerForm.resx">
     131      <DependentUpon>InstallationManagerForm.cs</DependentUpon>
     132    </EmbeddedResource>
    124133    <EmbeddedResource Include="Properties\Resources.resx">
    125134      <Generator>ResXFileCodeGenerator</Generator>
  • trunk/sources/HeuristicLab.PluginInfrastructure/Starter/StarterForm.cs

    r2527 r2748  
    3333using HeuristicLab.PluginInfrastructure.Manager;
    3434using System.IO;
     35using HeuristicLab.PluginInfrastructure.Advanced;
    3536
    3637namespace HeuristicLab.PluginInfrastructure.Starter {
     
    4546      InitializeComponent();
    4647
    47       string pluginPath = Path.GetFullPath(Application.StartupPath);     
     48      string pluginPath = Path.GetFullPath(Application.StartupPath);
    4849      pluginManager = new PluginManager(pluginPath);
    4950      SplashScreen splashScreen = new SplashScreen(pluginManager, 1000, "Loading HeuristicLab...");
     
    7778      var appDesc = (from desc in pluginManager.Applications
    7879                     where desc.Name == appName
    79                      select desc).Single();
     80                     select desc).SingleOrDefault();
    8081      if (appDesc != null) {
    8182        StartApplication(appDesc);
     
    9394        if (selected == pluginManagerListViewItem) {
    9495          try {
    95             //Cursor = Cursors.AppStarting;
    96             //ManagerForm form = new ManagerForm();
    97             //this.Visible = false;
    98             //form.ShowDialog(this);
    99             //// RefreshApplicationsList();
    100             //this.Visible = true;
     96            Cursor = Cursors.AppStarting;
     97            InstallationManagerForm form = new InstallationManagerForm();
     98            this.Visible = false;
     99            form.ShowDialog(this);
     100            // RefreshApplicationsList();
     101            this.Visible = true;
    101102          }
    102103          finally {
Note: See TracChangeset for help on using the changeset viewer.