Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2486


Ignore:
Timestamp:
11/12/09 17:43:59 (15 years ago)
Author:
gkronber
Message:

Copied main HL plugins from trunk for testing. #799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/AvailableOperatorsForm.cs

    r1529 r2486  
    6363      builtinOperatorsTreeView.TreeViewNodeSorter = nodeSorter;
    6464
    65       DiscoveryService discoveryService = new DiscoveryService();
    66       PluginInfo[] plugins = discoveryService.Plugins;
    67       foreach(PluginInfo plugin in plugins) {
     65      foreach (var plugin in ApplicationManager.Manager.Plugins) {
    6866        TreeNode pluginItem = new TreeNode();
    6967        pluginItem.Text = plugin.Name;
    7068        pluginItem.Tag = plugin;
    7169
    72         Type[] operators = discoveryService.GetTypes(typeof(IOperator), plugin);
    73         foreach(Type type in operators) {
    74           if(!type.IsAbstract) {
     70        foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IOperator), plugin)) {
     71          if (!type.IsAbstract) {
    7572            TreeNode operatorItem = new TreeNode();
    7673            operatorItem.Text = type.Name;
     
    8077        }
    8178        // add plugin node only if it contains operators
    82         if(pluginItem.Nodes.Count > 0) {
     79        if (pluginItem.Nodes.Count > 0) {
    8380          builtinOperatorsTreeView.Nodes.Add(pluginItem);
    8481        }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLab.AdvancedOptimizationFrontend-3.2.csproj

    r2134 r2486  
    1111    <RootNamespace>HeuristicLab.AdvancedOptimizationFrontend</RootNamespace>
    1212    <AssemblyName>HeuristicLab.AdvancedOptimizationFrontend-3.2</AssemblyName>
    13     <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
    1515    <SignAssembly>true</SignAssembly>
     
    7070  <ItemGroup>
    7171    <Reference Include="System" />
     72    <Reference Include="System.Core">
     73      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     74    </Reference>
    7275    <Reference Include="System.Data" />
    7376    <Reference Include="System.Drawing" />
  • branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendApplication.cs

    r1529 r2486  
    3030  /// The HeuristicLab Advanced Optimization Frontend Application.
    3131  /// </summary>
    32   [ClassInfo(Name = "HeuristicLab 3.2 (dockable)", Description="Next generation heuristic optimization environment.")]
     32  [Application("HeuristicLab 3.2 (dockable)", "Next generation heuristic optimization environment.")]
    3333  class HeuristicLabAdvancedOptimizationFrontendApplication : ApplicationBase {
    3434    /// <summary>
     
    3737    public override void Run() {
    3838      Form mainForm = new MainForm();
    39       PluginManager.ControlManager = (IControlManager)mainForm;
     39      ControlManager.RegisterManager((IControlManager)mainForm);
    4040      Application.Run(mainForm);
    4141    }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/HeuristicLabAdvancedOptimizationFrontendPlugin.cs

    r2134 r2486  
    3030  /// Plugin class for HeuristicLab.AdvancedOptimizationFrontend plugin.
    3131  /// </summary>
    32   [ClassInfo(Name = "HeuristicLab.AdvancedOptimizationFrontend-3.2")]
    33   [PluginFile(Filename = "HeuristicLab.AdvancedOptimizationFrontend-3.2.dll", Filetype = PluginFileType.Assembly)]
    34   [Dependency(Dependency = "HeuristicLab.Core-3.2")]
     32  [Plugin("HeuristicLab.AdvancedOptimizationFrontend-3.2")]
     33  [PluginFile("HeuristicLab.AdvancedOptimizationFrontend-3.2.dll", PluginFileType.Assembly)]
     34  [PluginDependency("HeuristicLab.Core-3.2")]
    3535  public class HeuristicLabAdvancedOptimizationFrontendPlugin : PluginBase {
    3636  }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.2/MainForm.cs

    r2143 r2486  
    3232using HeuristicLab.Core;
    3333using System.IO;
     34using System.Linq;
    3435
    3536namespace HeuristicLab.AdvancedOptimizationFrontend {
     
    6869      form.Show(dockPanel);
    6970
    70       DiscoveryService discoveryService = new DiscoveryService();
    71 
    72       // discover creatable items
    73       Type[] creatables = discoveryService.GetTypes(typeof(IEditable));
    74       string[] names = new string[creatables.Length];
    75       for (int i = 0; i < creatables.Length; i++)
    76         names[i] = creatables[i].Name;
    77       Array.Sort(names, creatables);
    78       foreach (Type type in creatables) {
     71      foreach (Type type in ApplicationManager.Manager.GetTypes(typeof(IEditable)).OrderBy(x => x.Name)) {
    7972        if (!type.IsAbstract) {
    8073          ToolStripMenuItem item = new ToolStripMenuItem();
     
    10194    /// <param name="control">The control to display.</param>
    10295    public void ShowControl(IControl control) {
    103       if (InvokeRequired) Invoke((Action<IControl>)ShowControl,control);
     96      if (InvokeRequired) Invoke((Action<IControl>)ShowControl, control);
    10497      else {
    10598        DockContent content;
     
    132125        saveAllToolStripButton.Enabled = true;
    133126        EditorForm form = ActiveMdiChild as EditorForm;
    134         if (form != null){
     127        if (form != null) {
    135128          if (((Control)form.Editor).Enabled) {
    136129            saveToolStripMenuItem.Enabled = true;
     
    158151      try {
    159152        task.storable = PersistenceManager.Load(task.filename);
    160       } catch(FileNotFoundException fileNotFoundEx) {
     153      }
     154      catch (FileNotFoundException fileNotFoundEx) {
    161155        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe file or plugin \"" + fileNotFoundEx.FileName + "\" is not available.\nPlease make sure you have all necessary plugins installed.",
    162156          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    163       } catch(TypeLoadException typeLoadEx) {
    164         MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName+ "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
     157      }
     158      catch (TypeLoadException typeLoadEx) {
     159        MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe type \"" + typeLoadEx.TypeName + "\" is not available.\nPlease make sure that you have the correct version the plugin installed.",
    165160          "Reader Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    166161      }
    167       LoadFinished(task);
     162      finally {
     163        LoadFinished(task);
     164      }
    168165    }
    169166    private delegate void TaskFinishedDelegate(Task task);
     
    183180          editor.Filename = task.filename;
    184181          editor.SaveFinished += new EventHandler(SaveFinished);
    185           PluginManager.ControlManager.ShowControl(editor);
     182          ControlManager.Manager.ShowControl(editor);
    186183        }
    187184        lock (locker) {
     
    239236        } else {
    240237          editor.SaveFinished += new EventHandler(SaveFinished);
    241           PluginManager.ControlManager.ShowControl(editor);
     238          ControlManager.Manager.ShowControl(editor);
    242239          EnableDisableItems();
    243240        }
     
    298295      for (int i = 0; i < MdiChildren.Length; i++) {
    299296        EditorForm form = MdiChildren[i] as EditorForm;
    300         if (form!=null && ((Control)form.Editor).Enabled) Save(form);
     297        if (form != null && ((Control)form.Editor).Enabled) Save(form);
    301298      }
    302299    }
Note: See TracChangeset for help on using the changeset viewer.