Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/25/14 13:55:01 (10 years ago)
Author:
jkarder
Message:

#2136: applied some of the changes suggested in comment:11:ticket:2136

  • change namespaces to HeuristicLab.Scripting.*
  • added extra compile button and registered F6 as a shortcut
  • changed the order of the output window and the error list
  • tabs (output window and error list) are selected automatically
  • thrown exceptions are shown using the PluginInfrastructure
  • removed namespace declaration in the script
  • names in the VariableStore are now conform to C# property names
Location:
trunk/sources/HeuristicLab.HLScript/3.3
Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.HLScript/3.3/HeuristicLab.Scripting-3.3.csproj

    r10501 r10506  
    88    <OutputType>Library</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    10     <RootNamespace>HeuristicLab.HLScript</RootNamespace>
    11     <AssemblyName>HeuristicLab.HLScript-3.3</AssemblyName>
     10    <RootNamespace>HeuristicLab.Scripting</RootNamespace>
     11    <AssemblyName>HeuristicLab.Scripting-3.3</AssemblyName>
    1212    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
  • trunk/sources/HeuristicLab.HLScript/3.3/Plugin.cs.frame

    r10332 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.PluginInfrastructure;
    2323
    24 namespace HeuristicLab.HLScript {
    25   [Plugin("HeuristicLab.HLScript", "3.3.9.$WCREV$")]
    26   [PluginFile("HeuristicLab.HLScript-3.3.dll", PluginFileType.Assembly)]
     24namespace HeuristicLab.Scripting {
     25  [Plugin("HeuristicLab.Scripting", "3.3.9.$WCREV$")]
     26  [PluginFile("HeuristicLab.Scripting-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2828  [PluginDependency("HeuristicLab.Common", "3.3")]
     
    3030  [PluginDependency("HeuristicLab.Core", "3.3")]
    3131  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    32   public class HeuristicLabHLScriptPlugin : PluginBase {
     32  public class HeuristicLabScriptingPlugin : PluginBase {
    3333  }
    3434}
  • trunk/sources/HeuristicLab.HLScript/3.3/Properties/AssemblyInfo.cs.frame

    r10332 r10506  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2727// set of attributes. Change these attribute values to modify the information
    2828// associated with an assembly.
    29 [assembly: AssemblyTitle("HeuristicLab.HLScript")]
     29[assembly: AssemblyTitle("HeuristicLab.Scripting")]
    3030[assembly: AssemblyDescription("")]
    3131[assembly: AssemblyConfiguration("")]
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2002-2014 HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
  • trunk/sources/HeuristicLab.HLScript/3.3/Script.cs

    r10401 r10506  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.CodeDom;
    324using System.CodeDom.Compiler;
     
    1637using Microsoft.CSharp;
    1738
    18 namespace HeuristicLab.HLScript {
    19   [Item("Script", "A HeuristicLab script.")]
     39namespace HeuristicLab.Scripting {
     40  [Item("Script", "An empty C# script.")]
    2041  [Creatable("Scripts")]
    2142  [StorableClass]
     
    2748
    2849using System;
    29 
    30 namespace UserScripts {
    31   public class UserScript : HeuristicLab.HLScript.UserScriptBase {
    32     public override void Main() {
    33       // type your code here
    34     }
    35 
    36     // further classes and methods
    37 
     50using System.Linq;
     51using System.Collections.Generic;
     52using HeuristicLab.Common;
     53using HeuristicLab.Core;
     54using HeuristicLab.Data;
     55
     56public class UserScript : HeuristicLab.Scripting.UserScriptBase {
     57  public override void Main() {
     58    // type your code here
    3859  }
     60
     61  // further classes and methods
     62
    3963}";
    4064    #endregion
     
    126150        GenerateExecutable = false,
    127151        GenerateInMemory = true,
    128         IncludeDebugInformation = false
     152        IncludeDebugInformation = true,
     153        WarningLevel = 4
    129154      };
    130155      parameters.ReferencedAssemblies.AddRange(
     
    212237      if (executeMethod != null) {
    213238        scriptThread = new Thread(() => {
     239          Exception ex = null;
    214240          try {
    215241            OnScriptExecutionStarted();
    216242            executeMethod.Invoke(compiledScript, new[] { VariableStore });
     243          } catch (ThreadAbortException) {
     244            // the execution was cancelled by the user
     245          } catch (TargetInvocationException e) {
     246            ex = e.InnerException;
    217247          } finally {
    218             OnScriptExecutionFinished();
     248            OnScriptExecutionFinished(ex);
    219249          }
    220250        });
     
    250280    }
    251281
    252     public event EventHandler ScriptExecutionFinished;
    253     private void OnScriptExecutionFinished() {
     282    public event EventHandler<EventArgs<Exception>> ScriptExecutionFinished;
     283    private void OnScriptExecutionFinished(Exception e) {
    254284      var handler = ScriptExecutionFinished;
    255       if (handler != null) handler(this, EventArgs.Empty);
     285      if (handler != null) handler(this, new EventArgs<Exception>(e));
    256286    }
    257287
  • trunk/sources/HeuristicLab.HLScript/3.3/UserScriptBase.cs

    r10401 r10506  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Dynamic;
    324using System.IO;
    425using System.Text;
    5 using System.Threading;
    626using HeuristicLab.Common;
    727
    8 namespace HeuristicLab.HLScript {
     28namespace HeuristicLab.Scripting {
    929  public abstract class UserScriptBase {
    1030    protected dynamic vars;
     
    2343    private void Execute(VariableStore variableStore) {
    2444      vars = new Variables(variableStore);
    25       try {
    26         Main();
    27       } catch (ThreadAbortException) {
    28       } catch (Exception e) {
    29         Console.WriteLine("---");
    30         Console.WriteLine(e);
    31       }
     45      Main();
    3246    }
    3347
  • trunk/sources/HeuristicLab.HLScript/3.3/VariableStore.cs

    r10332 r10506  
    1 using HeuristicLab.Collections;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using HeuristicLab.Collections;
    223using HeuristicLab.Common;
    324using HeuristicLab.Core;
    425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    526
    6 namespace HeuristicLab.HLScript {
     27namespace HeuristicLab.Scripting {
    728  [Item("VariableStore", "Represents a variable store.")]
    829  [StorableClass]
Note: See TracChangeset for help on using the changeset viewer.